162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * BRIEF MODULE DESCRIPTION 362306a36Sopenharmony_ci * Hardware definitions for the Au1100 LCD controller 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2002 MontaVista Software 662306a36Sopenharmony_ci * Copyright 2002 Alchemy Semiconductor 762306a36Sopenharmony_ci * Author: Alchemy Semiconductor, MontaVista Software 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 1062306a36Sopenharmony_ci * under the terms of the GNU General Public License as published by the 1162306a36Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 1262306a36Sopenharmony_ci * option) any later version. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 1562306a36Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1662306a36Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 1762306a36Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1862306a36Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1962306a36Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 2062306a36Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 2162306a36Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2262306a36Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2362306a36Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2462306a36Sopenharmony_ci * 2562306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License along 2662306a36Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 2762306a36Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#ifndef _AU1100LCD_H 3162306a36Sopenharmony_ci#define _AU1100LCD_H 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#include <asm/mach-au1x00/au1000.h> 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg) 3662306a36Sopenharmony_ci#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg) 3762306a36Sopenharmony_ci#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#if DEBUG 4062306a36Sopenharmony_ci#define print_dbg(f, arg...) printk(__FILE__ ": " f "\n", ## arg) 4162306a36Sopenharmony_ci#else 4262306a36Sopenharmony_ci#define print_dbg(f, arg...) do {} while (0) 4362306a36Sopenharmony_ci#endif 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#if defined(__BIG_ENDIAN) 4662306a36Sopenharmony_ci#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11 4762306a36Sopenharmony_ci#else 4862306a36Sopenharmony_ci#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00 4962306a36Sopenharmony_ci#endif 5062306a36Sopenharmony_ci#define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/********************************************************************/ 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* LCD controller restrictions */ 5562306a36Sopenharmony_ci#define AU1100_LCD_MAX_XRES 800 5662306a36Sopenharmony_ci#define AU1100_LCD_MAX_YRES 600 5762306a36Sopenharmony_ci#define AU1100_LCD_MAX_BPP 16 5862306a36Sopenharmony_ci#define AU1100_LCD_MAX_CLK 48000000 5962306a36Sopenharmony_ci#define AU1100_LCD_NBR_PALETTE_ENTRIES 256 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* Default number of visible screen buffer to allocate */ 6262306a36Sopenharmony_ci#define AU1100FB_NBR_VIDEO_BUFFERS 4 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/********************************************************************/ 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_cistruct au1100fb_panel 6762306a36Sopenharmony_ci{ 6862306a36Sopenharmony_ci const char name[25]; /* Full name <vendor>_<model> */ 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci u32 control_base; /* Mode-independent control values */ 7162306a36Sopenharmony_ci u32 clkcontrol_base; /* Panel pixclock preferences */ 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci u32 horztiming; 7462306a36Sopenharmony_ci u32 verttiming; 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci u32 xres; /* Maximum horizontal resolution */ 7762306a36Sopenharmony_ci u32 yres; /* Maximum vertical resolution */ 7862306a36Sopenharmony_ci u32 bpp; /* Maximum depth supported */ 7962306a36Sopenharmony_ci}; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_cistruct au1100fb_regs 8262306a36Sopenharmony_ci{ 8362306a36Sopenharmony_ci u32 lcd_control; 8462306a36Sopenharmony_ci u32 lcd_intstatus; 8562306a36Sopenharmony_ci u32 lcd_intenable; 8662306a36Sopenharmony_ci u32 lcd_horztiming; 8762306a36Sopenharmony_ci u32 lcd_verttiming; 8862306a36Sopenharmony_ci u32 lcd_clkcontrol; 8962306a36Sopenharmony_ci u32 lcd_dmaaddr0; 9062306a36Sopenharmony_ci u32 lcd_dmaaddr1; 9162306a36Sopenharmony_ci u32 lcd_words; 9262306a36Sopenharmony_ci u32 lcd_pwmdiv; 9362306a36Sopenharmony_ci u32 lcd_pwmhi; 9462306a36Sopenharmony_ci u32 reserved[(0x0400-0x002C)/4]; 9562306a36Sopenharmony_ci u32 lcd_palettebase[256]; 9662306a36Sopenharmony_ci}; 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_cistruct au1100fb_device { 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci struct fb_info info; /* FB driver info record */ 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci struct au1100fb_panel *panel; /* Panel connected to this device */ 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci struct au1100fb_regs* regs; /* Registers memory map */ 10562306a36Sopenharmony_ci size_t regs_len; 10662306a36Sopenharmony_ci unsigned int regs_phys; 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci unsigned char* fb_mem; /* FrameBuffer memory map */ 10962306a36Sopenharmony_ci size_t fb_len; 11062306a36Sopenharmony_ci dma_addr_t fb_phys; 11162306a36Sopenharmony_ci int panel_idx; 11262306a36Sopenharmony_ci struct clk *lcdclk; 11362306a36Sopenharmony_ci struct device *dev; 11462306a36Sopenharmony_ci}; 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci/********************************************************************/ 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci#define LCD_CONTROL (AU1100_LCD_BASE + 0x0) 11962306a36Sopenharmony_ci #define LCD_CONTROL_SBB_BIT 21 12062306a36Sopenharmony_ci #define LCD_CONTROL_SBB_MASK (0x3 << LCD_CONTROL_SBB_BIT) 12162306a36Sopenharmony_ci #define LCD_CONTROL_SBB_1 (0 << LCD_CONTROL_SBB_BIT) 12262306a36Sopenharmony_ci #define LCD_CONTROL_SBB_2 (1 << LCD_CONTROL_SBB_BIT) 12362306a36Sopenharmony_ci #define LCD_CONTROL_SBB_3 (2 << LCD_CONTROL_SBB_BIT) 12462306a36Sopenharmony_ci #define LCD_CONTROL_SBB_4 (3 << LCD_CONTROL_SBB_BIT) 12562306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_BIT 18 12662306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_MASK (0x7 << LCD_CONTROL_SBPPF_BIT) 12762306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_655 (0 << LCD_CONTROL_SBPPF_BIT) 12862306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_565 (1 << LCD_CONTROL_SBPPF_BIT) 12962306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_556 (2 << LCD_CONTROL_SBPPF_BIT) 13062306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_1555 (3 << LCD_CONTROL_SBPPF_BIT) 13162306a36Sopenharmony_ci #define LCD_CONTROL_SBPPF_5551 (4 << LCD_CONTROL_SBPPF_BIT) 13262306a36Sopenharmony_ci #define LCD_CONTROL_WP (1<<17) 13362306a36Sopenharmony_ci #define LCD_CONTROL_WD (1<<16) 13462306a36Sopenharmony_ci #define LCD_CONTROL_C (1<<15) 13562306a36Sopenharmony_ci #define LCD_CONTROL_SM_BIT 13 13662306a36Sopenharmony_ci #define LCD_CONTROL_SM_MASK (0x3 << LCD_CONTROL_SM_BIT) 13762306a36Sopenharmony_ci #define LCD_CONTROL_SM_0 (0 << LCD_CONTROL_SM_BIT) 13862306a36Sopenharmony_ci #define LCD_CONTROL_SM_90 (1 << LCD_CONTROL_SM_BIT) 13962306a36Sopenharmony_ci #define LCD_CONTROL_SM_180 (2 << LCD_CONTROL_SM_BIT) 14062306a36Sopenharmony_ci #define LCD_CONTROL_SM_270 (3 << LCD_CONTROL_SM_BIT) 14162306a36Sopenharmony_ci #define LCD_CONTROL_DB (1<<12) 14262306a36Sopenharmony_ci #define LCD_CONTROL_CCO (1<<11) 14362306a36Sopenharmony_ci #define LCD_CONTROL_DP (1<<10) 14462306a36Sopenharmony_ci #define LCD_CONTROL_PO_BIT 8 14562306a36Sopenharmony_ci #define LCD_CONTROL_PO_MASK (0x3 << LCD_CONTROL_PO_BIT) 14662306a36Sopenharmony_ci #define LCD_CONTROL_PO_00 (0 << LCD_CONTROL_PO_BIT) 14762306a36Sopenharmony_ci #define LCD_CONTROL_PO_01 (1 << LCD_CONTROL_PO_BIT) 14862306a36Sopenharmony_ci #define LCD_CONTROL_PO_10 (2 << LCD_CONTROL_PO_BIT) 14962306a36Sopenharmony_ci #define LCD_CONTROL_PO_11 (3 << LCD_CONTROL_PO_BIT) 15062306a36Sopenharmony_ci #define LCD_CONTROL_MPI (1<<7) 15162306a36Sopenharmony_ci #define LCD_CONTROL_PT (1<<6) 15262306a36Sopenharmony_ci #define LCD_CONTROL_PC (1<<5) 15362306a36Sopenharmony_ci #define LCD_CONTROL_BPP_BIT 1 15462306a36Sopenharmony_ci #define LCD_CONTROL_BPP_MASK (0x7 << LCD_CONTROL_BPP_BIT) 15562306a36Sopenharmony_ci #define LCD_CONTROL_BPP_1 (0 << LCD_CONTROL_BPP_BIT) 15662306a36Sopenharmony_ci #define LCD_CONTROL_BPP_2 (1 << LCD_CONTROL_BPP_BIT) 15762306a36Sopenharmony_ci #define LCD_CONTROL_BPP_4 (2 << LCD_CONTROL_BPP_BIT) 15862306a36Sopenharmony_ci #define LCD_CONTROL_BPP_8 (3 << LCD_CONTROL_BPP_BIT) 15962306a36Sopenharmony_ci #define LCD_CONTROL_BPP_12 (4 << LCD_CONTROL_BPP_BIT) 16062306a36Sopenharmony_ci #define LCD_CONTROL_BPP_16 (5 << LCD_CONTROL_BPP_BIT) 16162306a36Sopenharmony_ci #define LCD_CONTROL_GO (1<<0) 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci#define LCD_INTSTATUS (AU1100_LCD_BASE + 0x4) 16462306a36Sopenharmony_ci#define LCD_INTENABLE (AU1100_LCD_BASE + 0x8) 16562306a36Sopenharmony_ci #define LCD_INT_SD (1<<7) 16662306a36Sopenharmony_ci #define LCD_INT_OF (1<<6) 16762306a36Sopenharmony_ci #define LCD_INT_UF (1<<5) 16862306a36Sopenharmony_ci #define LCD_INT_SA (1<<3) 16962306a36Sopenharmony_ci #define LCD_INT_SS (1<<2) 17062306a36Sopenharmony_ci #define LCD_INT_S1 (1<<1) 17162306a36Sopenharmony_ci #define LCD_INT_S0 (1<<0) 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define LCD_HORZTIMING (AU1100_LCD_BASE + 0xC) 17462306a36Sopenharmony_ci #define LCD_HORZTIMING_HN2_BIT 24 17562306a36Sopenharmony_ci #define LCD_HORZTIMING_HN2_MASK (0xFF << LCD_HORZTIMING_HN2_BIT) 17662306a36Sopenharmony_ci #define LCD_HORZTIMING_HN2_N(N) ((((N)-1) << LCD_HORZTIMING_HN2_BIT) & LCD_HORZTIMING_HN2_MASK) 17762306a36Sopenharmony_ci #define LCD_HORZTIMING_HN1_BIT 16 17862306a36Sopenharmony_ci #define LCD_HORZTIMING_HN1_MASK (0xFF << LCD_HORZTIMING_HN1_BIT) 17962306a36Sopenharmony_ci #define LCD_HORZTIMING_HN1_N(N) ((((N)-1) << LCD_HORZTIMING_HN1_BIT) & LCD_HORZTIMING_HN1_MASK) 18062306a36Sopenharmony_ci #define LCD_HORZTIMING_HPW_BIT 10 18162306a36Sopenharmony_ci #define LCD_HORZTIMING_HPW_MASK (0x3F << LCD_HORZTIMING_HPW_BIT) 18262306a36Sopenharmony_ci #define LCD_HORZTIMING_HPW_N(N) ((((N)-1) << LCD_HORZTIMING_HPW_BIT) & LCD_HORZTIMING_HPW_MASK) 18362306a36Sopenharmony_ci #define LCD_HORZTIMING_PPL_BIT 0 18462306a36Sopenharmony_ci #define LCD_HORZTIMING_PPL_MASK (0x3FF << LCD_HORZTIMING_PPL_BIT) 18562306a36Sopenharmony_ci #define LCD_HORZTIMING_PPL_N(N) ((((N)-1) << LCD_HORZTIMING_PPL_BIT) & LCD_HORZTIMING_PPL_MASK) 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ci#define LCD_VERTTIMING (AU1100_LCD_BASE + 0x10) 18862306a36Sopenharmony_ci #define LCD_VERTTIMING_VN2_BIT 24 18962306a36Sopenharmony_ci #define LCD_VERTTIMING_VN2_MASK (0xFF << LCD_VERTTIMING_VN2_BIT) 19062306a36Sopenharmony_ci #define LCD_VERTTIMING_VN2_N(N) ((((N)-1) << LCD_VERTTIMING_VN2_BIT) & LCD_VERTTIMING_VN2_MASK) 19162306a36Sopenharmony_ci #define LCD_VERTTIMING_VN1_BIT 16 19262306a36Sopenharmony_ci #define LCD_VERTTIMING_VN1_MASK (0xFF << LCD_VERTTIMING_VN1_BIT) 19362306a36Sopenharmony_ci #define LCD_VERTTIMING_VN1_N(N) ((((N)-1) << LCD_VERTTIMING_VN1_BIT) & LCD_VERTTIMING_VN1_MASK) 19462306a36Sopenharmony_ci #define LCD_VERTTIMING_VPW_BIT 10 19562306a36Sopenharmony_ci #define LCD_VERTTIMING_VPW_MASK (0x3F << LCD_VERTTIMING_VPW_BIT) 19662306a36Sopenharmony_ci #define LCD_VERTTIMING_VPW_N(N) ((((N)-1) << LCD_VERTTIMING_VPW_BIT) & LCD_VERTTIMING_VPW_MASK) 19762306a36Sopenharmony_ci #define LCD_VERTTIMING_LPP_BIT 0 19862306a36Sopenharmony_ci #define LCD_VERTTIMING_LPP_MASK (0x3FF << LCD_VERTTIMING_LPP_BIT) 19962306a36Sopenharmony_ci #define LCD_VERTTIMING_LPP_N(N) ((((N)-1) << LCD_VERTTIMING_LPP_BIT) & LCD_VERTTIMING_LPP_MASK) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define LCD_CLKCONTROL (AU1100_LCD_BASE + 0x14) 20262306a36Sopenharmony_ci #define LCD_CLKCONTROL_IB (1<<18) 20362306a36Sopenharmony_ci #define LCD_CLKCONTROL_IC (1<<17) 20462306a36Sopenharmony_ci #define LCD_CLKCONTROL_IH (1<<16) 20562306a36Sopenharmony_ci #define LCD_CLKCONTROL_IV (1<<15) 20662306a36Sopenharmony_ci #define LCD_CLKCONTROL_BF_BIT 10 20762306a36Sopenharmony_ci #define LCD_CLKCONTROL_BF_MASK (0x1F << LCD_CLKCONTROL_BF_BIT) 20862306a36Sopenharmony_ci #define LCD_CLKCONTROL_BF_N(N) ((((N)-1) << LCD_CLKCONTROL_BF_BIT) & LCD_CLKCONTROL_BF_MASK) 20962306a36Sopenharmony_ci #define LCD_CLKCONTROL_PCD_BIT 0 21062306a36Sopenharmony_ci #define LCD_CLKCONTROL_PCD_MASK (0x3FF << LCD_CLKCONTROL_PCD_BIT) 21162306a36Sopenharmony_ci #define LCD_CLKCONTROL_PCD_N(N) (((N) << LCD_CLKCONTROL_PCD_BIT) & LCD_CLKCONTROL_PCD_MASK) 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci#define LCD_DMAADDR0 (AU1100_LCD_BASE + 0x18) 21462306a36Sopenharmony_ci#define LCD_DMAADDR1 (AU1100_LCD_BASE + 0x1C) 21562306a36Sopenharmony_ci #define LCD_DMA_SA_BIT 5 21662306a36Sopenharmony_ci #define LCD_DMA_SA_MASK (0x7FFFFFF << LCD_DMA_SA_BIT) 21762306a36Sopenharmony_ci #define LCD_DMA_SA_N(N) ((N) & LCD_DMA_SA_MASK) 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci#define LCD_WORDS (AU1100_LCD_BASE + 0x20) 22062306a36Sopenharmony_ci #define LCD_WRD_WRDS_BIT 0 22162306a36Sopenharmony_ci #define LCD_WRD_WRDS_MASK (0xFFFFFFFF << LCD_WRD_WRDS_BIT) 22262306a36Sopenharmony_ci #define LCD_WRD_WRDS_N(N) ((((N)-1) << LCD_WRD_WRDS_BIT) & LCD_WRD_WRDS_MASK) 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci#define LCD_PWMDIV (AU1100_LCD_BASE + 0x24) 22562306a36Sopenharmony_ci #define LCD_PWMDIV_EN (1<<12) 22662306a36Sopenharmony_ci #define LCD_PWMDIV_PWMDIV_BIT 0 22762306a36Sopenharmony_ci #define LCD_PWMDIV_PWMDIV_MASK (0xFFF << LCD_PWMDIV_PWMDIV_BIT) 22862306a36Sopenharmony_ci #define LCD_PWMDIV_PWMDIV_N(N) ((((N)-1) << LCD_PWMDIV_PWMDIV_BIT) & LCD_PWMDIV_PWMDIV_MASK) 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci#define LCD_PWMHI (AU1100_LCD_BASE + 0x28) 23162306a36Sopenharmony_ci #define LCD_PWMHI_PWMHI1_BIT 12 23262306a36Sopenharmony_ci #define LCD_PWMHI_PWMHI1_MASK (0xFFF << LCD_PWMHI_PWMHI1_BIT) 23362306a36Sopenharmony_ci #define LCD_PWMHI_PWMHI1_N(N) (((N) << LCD_PWMHI_PWMHI1_BIT) & LCD_PWMHI_PWMHI1_MASK) 23462306a36Sopenharmony_ci #define LCD_PWMHI_PWMHI0_BIT 0 23562306a36Sopenharmony_ci #define LCD_PWMHI_PWMHI0_MASK (0xFFF << LCD_PWMHI_PWMHI0_BIT) 23662306a36Sopenharmony_ci #define LCD_PWMHI_PWMHI0_N(N) (((N) << LCD_PWMHI_PWMHI0_BIT) & LCD_PWMHI_PWMHI0_MASK) 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci#define LCD_PALLETTEBASE (AU1100_LCD_BASE + 0x400) 23962306a36Sopenharmony_ci #define LCD_PALLETTE_MONO_MI_BIT 0 24062306a36Sopenharmony_ci #define LCD_PALLETTE_MONO_MI_MASK (0xF << LCD_PALLETTE_MONO_MI_BIT) 24162306a36Sopenharmony_ci #define LCD_PALLETTE_MONO_MI_N(N) (((N)<< LCD_PALLETTE_MONO_MI_BIT) & LCD_PALLETTE_MONO_MI_MASK) 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_RI_BIT 8 24462306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_RI_MASK (0xF << LCD_PALLETTE_COLOR_RI_BIT) 24562306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_RI_N(N) (((N)<< LCD_PALLETTE_COLOR_RI_BIT) & LCD_PALLETTE_COLOR_RI_MASK) 24662306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_GI_BIT 4 24762306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_GI_MASK (0xF << LCD_PALLETTE_COLOR_GI_BIT) 24862306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_GI_N(N) (((N)<< LCD_PALLETTE_COLOR_GI_BIT) & LCD_PALLETTE_COLOR_GI_MASK) 24962306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_BI_BIT 0 25062306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_BI_MASK (0xF << LCD_PALLETTE_COLOR_BI_BIT) 25162306a36Sopenharmony_ci #define LCD_PALLETTE_COLOR_BI_N(N) (((N)<< LCD_PALLETTE_COLOR_BI_BIT) & LCD_PALLETTE_COLOR_BI_MASK) 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci #define LCD_PALLETTE_TFT_DC_BIT 0 25462306a36Sopenharmony_ci #define LCD_PALLETTE_TFT_DC_MASK (0xFFFF << LCD_PALLETTE_TFT_DC_BIT) 25562306a36Sopenharmony_ci #define LCD_PALLETTE_TFT_DC_N(N) (((N)<< LCD_PALLETTE_TFT_DC_BIT) & LCD_PALLETTE_TFT_DC_MASK) 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci/********************************************************************/ 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ci/* List of panels known to work with the AU1100 LCD controller. 26062306a36Sopenharmony_ci * To add a new panel, enter the same specifications as the 26162306a36Sopenharmony_ci * Generic_TFT one, and MAKE SURE that it doesn't conflicts 26262306a36Sopenharmony_ci * with the controller restrictions. Restrictions are: 26362306a36Sopenharmony_ci * 26462306a36Sopenharmony_ci * STN color panels: max_bpp <= 12 26562306a36Sopenharmony_ci * STN mono panels: max_bpp <= 4 26662306a36Sopenharmony_ci * TFT panels: max_bpp <= 16 26762306a36Sopenharmony_ci * max_xres <= 800 26862306a36Sopenharmony_ci * max_yres <= 600 26962306a36Sopenharmony_ci */ 27062306a36Sopenharmony_cistatic struct au1100fb_panel known_lcd_panels[] = 27162306a36Sopenharmony_ci{ 27262306a36Sopenharmony_ci /* 800x600x16bpp CRT */ 27362306a36Sopenharmony_ci [0] = { 27462306a36Sopenharmony_ci .name = "CRT_800x600_16", 27562306a36Sopenharmony_ci .xres = 800, 27662306a36Sopenharmony_ci .yres = 600, 27762306a36Sopenharmony_ci .bpp = 16, 27862306a36Sopenharmony_ci .control_base = 0x0004886A | 27962306a36Sopenharmony_ci LCD_CONTROL_DEFAULT_PO | LCD_CONTROL_DEFAULT_SBPPF | 28062306a36Sopenharmony_ci LCD_CONTROL_BPP_16 | LCD_CONTROL_SBB_4, 28162306a36Sopenharmony_ci .clkcontrol_base = 0x00020000, 28262306a36Sopenharmony_ci .horztiming = 0x005aff1f, 28362306a36Sopenharmony_ci .verttiming = 0x16000e57, 28462306a36Sopenharmony_ci }, 28562306a36Sopenharmony_ci /* just the standard LCD */ 28662306a36Sopenharmony_ci [1] = { 28762306a36Sopenharmony_ci .name = "WWPC LCD", 28862306a36Sopenharmony_ci .xres = 240, 28962306a36Sopenharmony_ci .yres = 320, 29062306a36Sopenharmony_ci .bpp = 16, 29162306a36Sopenharmony_ci .control_base = 0x0006806A, 29262306a36Sopenharmony_ci .horztiming = 0x0A1010EF, 29362306a36Sopenharmony_ci .verttiming = 0x0301013F, 29462306a36Sopenharmony_ci .clkcontrol_base = 0x00018001, 29562306a36Sopenharmony_ci }, 29662306a36Sopenharmony_ci /* Sharp 320x240 TFT panel */ 29762306a36Sopenharmony_ci [2] = { 29862306a36Sopenharmony_ci .name = "Sharp_LQ038Q5DR01", 29962306a36Sopenharmony_ci .xres = 320, 30062306a36Sopenharmony_ci .yres = 240, 30162306a36Sopenharmony_ci .bpp = 16, 30262306a36Sopenharmony_ci .control_base = 30362306a36Sopenharmony_ci ( LCD_CONTROL_SBPPF_565 30462306a36Sopenharmony_ci | LCD_CONTROL_C 30562306a36Sopenharmony_ci | LCD_CONTROL_SM_0 30662306a36Sopenharmony_ci | LCD_CONTROL_DEFAULT_PO 30762306a36Sopenharmony_ci | LCD_CONTROL_PT 30862306a36Sopenharmony_ci | LCD_CONTROL_PC 30962306a36Sopenharmony_ci | LCD_CONTROL_BPP_16 ), 31062306a36Sopenharmony_ci .horztiming = 31162306a36Sopenharmony_ci ( LCD_HORZTIMING_HN2_N(8) 31262306a36Sopenharmony_ci | LCD_HORZTIMING_HN1_N(60) 31362306a36Sopenharmony_ci | LCD_HORZTIMING_HPW_N(12) 31462306a36Sopenharmony_ci | LCD_HORZTIMING_PPL_N(320) ), 31562306a36Sopenharmony_ci .verttiming = 31662306a36Sopenharmony_ci ( LCD_VERTTIMING_VN2_N(5) 31762306a36Sopenharmony_ci | LCD_VERTTIMING_VN1_N(17) 31862306a36Sopenharmony_ci | LCD_VERTTIMING_VPW_N(1) 31962306a36Sopenharmony_ci | LCD_VERTTIMING_LPP_N(240) ), 32062306a36Sopenharmony_ci .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 32162306a36Sopenharmony_ci }, 32262306a36Sopenharmony_ci 32362306a36Sopenharmony_ci /* Hitachi SP14Q005 and possibly others */ 32462306a36Sopenharmony_ci [3] = { 32562306a36Sopenharmony_ci .name = "Hitachi_SP14Qxxx", 32662306a36Sopenharmony_ci .xres = 320, 32762306a36Sopenharmony_ci .yres = 240, 32862306a36Sopenharmony_ci .bpp = 4, 32962306a36Sopenharmony_ci .control_base = 33062306a36Sopenharmony_ci ( LCD_CONTROL_C 33162306a36Sopenharmony_ci | LCD_CONTROL_BPP_4 ), 33262306a36Sopenharmony_ci .horztiming = 33362306a36Sopenharmony_ci ( LCD_HORZTIMING_HN2_N(1) 33462306a36Sopenharmony_ci | LCD_HORZTIMING_HN1_N(1) 33562306a36Sopenharmony_ci | LCD_HORZTIMING_HPW_N(1) 33662306a36Sopenharmony_ci | LCD_HORZTIMING_PPL_N(320) ), 33762306a36Sopenharmony_ci .verttiming = 33862306a36Sopenharmony_ci ( LCD_VERTTIMING_VN2_N(1) 33962306a36Sopenharmony_ci | LCD_VERTTIMING_VN1_N(1) 34062306a36Sopenharmony_ci | LCD_VERTTIMING_VPW_N(1) 34162306a36Sopenharmony_ci | LCD_VERTTIMING_LPP_N(240) ), 34262306a36Sopenharmony_ci .clkcontrol_base = LCD_CLKCONTROL_PCD_N(4), 34362306a36Sopenharmony_ci }, 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci /* Generic 640x480 TFT panel */ 34662306a36Sopenharmony_ci [4] = { 34762306a36Sopenharmony_ci .name = "TFT_640x480_16", 34862306a36Sopenharmony_ci .xres = 640, 34962306a36Sopenharmony_ci .yres = 480, 35062306a36Sopenharmony_ci .bpp = 16, 35162306a36Sopenharmony_ci .control_base = 0x004806a | LCD_CONTROL_DEFAULT_PO, 35262306a36Sopenharmony_ci .horztiming = 0x3434d67f, 35362306a36Sopenharmony_ci .verttiming = 0x0e0e39df, 35462306a36Sopenharmony_ci .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 35562306a36Sopenharmony_ci }, 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci /* Pb1100 LCDB 640x480 PrimeView TFT panel */ 35862306a36Sopenharmony_ci [5] = { 35962306a36Sopenharmony_ci .name = "PrimeView_640x480_16", 36062306a36Sopenharmony_ci .xres = 640, 36162306a36Sopenharmony_ci .yres = 480, 36262306a36Sopenharmony_ci .bpp = 16, 36362306a36Sopenharmony_ci .control_base = 0x0004886a | LCD_CONTROL_DEFAULT_PO, 36462306a36Sopenharmony_ci .horztiming = 0x0e4bfe7f, 36562306a36Sopenharmony_ci .verttiming = 0x210805df, 36662306a36Sopenharmony_ci .clkcontrol_base = 0x00038001, 36762306a36Sopenharmony_ci }, 36862306a36Sopenharmony_ci}; 36962306a36Sopenharmony_ci 37062306a36Sopenharmony_ci/********************************************************************/ 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_ci/* Inline helpers */ 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci#define panel_is_dual(panel) (panel->control_base & LCD_CONTROL_DP) 37562306a36Sopenharmony_ci#define panel_is_active(panel)(panel->control_base & LCD_CONTROL_PT) 37662306a36Sopenharmony_ci#define panel_is_color(panel) (panel->control_base & LCD_CONTROL_PC) 37762306a36Sopenharmony_ci#define panel_swap_rgb(panel) (panel->control_base & LCD_CONTROL_CCO) 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci#endif /* _AU1100LCD_H */ 380