18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * BRIEF MODULE DESCRIPTION 38c2ecf20Sopenharmony_ci * Hardware definitions for the Au1100 LCD controller 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2002 MontaVista Software 68c2ecf20Sopenharmony_ci * Copyright 2002 Alchemy Semiconductor 78c2ecf20Sopenharmony_ci * Author: Alchemy Semiconductor, MontaVista Software 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it 108c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the 118c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your 128c2ecf20Sopenharmony_ci * option) any later version. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 158c2ecf20Sopenharmony_ci * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 168c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 178c2ecf20Sopenharmony_ci * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 188c2ecf20Sopenharmony_ci * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 198c2ecf20Sopenharmony_ci * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 208c2ecf20Sopenharmony_ci * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 218c2ecf20Sopenharmony_ci * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 228c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 238c2ecf20Sopenharmony_ci * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along 268c2ecf20Sopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc., 278c2ecf20Sopenharmony_ci * 675 Mass Ave, Cambridge, MA 02139, USA. 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#ifndef _AU1100LCD_H 318c2ecf20Sopenharmony_ci#define _AU1100LCD_H 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#include <asm/mach-au1x00/au1000.h> 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg) 368c2ecf20Sopenharmony_ci#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg) 378c2ecf20Sopenharmony_ci#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#if DEBUG 408c2ecf20Sopenharmony_ci#define print_dbg(f, arg...) printk(__FILE__ ": " f "\n", ## arg) 418c2ecf20Sopenharmony_ci#else 428c2ecf20Sopenharmony_ci#define print_dbg(f, arg...) do {} while (0) 438c2ecf20Sopenharmony_ci#endif 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN) 468c2ecf20Sopenharmony_ci#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11 478c2ecf20Sopenharmony_ci#else 488c2ecf20Sopenharmony_ci#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00 498c2ecf20Sopenharmony_ci#endif 508c2ecf20Sopenharmony_ci#define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci/********************************************************************/ 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* LCD controller restrictions */ 558c2ecf20Sopenharmony_ci#define AU1100_LCD_MAX_XRES 800 568c2ecf20Sopenharmony_ci#define AU1100_LCD_MAX_YRES 600 578c2ecf20Sopenharmony_ci#define AU1100_LCD_MAX_BPP 16 588c2ecf20Sopenharmony_ci#define AU1100_LCD_MAX_CLK 48000000 598c2ecf20Sopenharmony_ci#define AU1100_LCD_NBR_PALETTE_ENTRIES 256 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* Default number of visible screen buffer to allocate */ 628c2ecf20Sopenharmony_ci#define AU1100FB_NBR_VIDEO_BUFFERS 4 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/********************************************************************/ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cistruct au1100fb_panel 678c2ecf20Sopenharmony_ci{ 688c2ecf20Sopenharmony_ci const char name[25]; /* Full name <vendor>_<model> */ 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci u32 control_base; /* Mode-independent control values */ 718c2ecf20Sopenharmony_ci u32 clkcontrol_base; /* Panel pixclock preferences */ 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci u32 horztiming; 748c2ecf20Sopenharmony_ci u32 verttiming; 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci u32 xres; /* Maximum horizontal resolution */ 778c2ecf20Sopenharmony_ci u32 yres; /* Maximum vertical resolution */ 788c2ecf20Sopenharmony_ci u32 bpp; /* Maximum depth supported */ 798c2ecf20Sopenharmony_ci}; 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistruct au1100fb_regs 828c2ecf20Sopenharmony_ci{ 838c2ecf20Sopenharmony_ci u32 lcd_control; 848c2ecf20Sopenharmony_ci u32 lcd_intstatus; 858c2ecf20Sopenharmony_ci u32 lcd_intenable; 868c2ecf20Sopenharmony_ci u32 lcd_horztiming; 878c2ecf20Sopenharmony_ci u32 lcd_verttiming; 888c2ecf20Sopenharmony_ci u32 lcd_clkcontrol; 898c2ecf20Sopenharmony_ci u32 lcd_dmaaddr0; 908c2ecf20Sopenharmony_ci u32 lcd_dmaaddr1; 918c2ecf20Sopenharmony_ci u32 lcd_words; 928c2ecf20Sopenharmony_ci u32 lcd_pwmdiv; 938c2ecf20Sopenharmony_ci u32 lcd_pwmhi; 948c2ecf20Sopenharmony_ci u32 reserved[(0x0400-0x002C)/4]; 958c2ecf20Sopenharmony_ci u32 lcd_pallettebase[256]; 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_cistruct au1100fb_device { 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci struct fb_info info; /* FB driver info record */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci struct au1100fb_panel *panel; /* Panel connected to this device */ 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci struct au1100fb_regs* regs; /* Registers memory map */ 1058c2ecf20Sopenharmony_ci size_t regs_len; 1068c2ecf20Sopenharmony_ci unsigned int regs_phys; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci unsigned char* fb_mem; /* FrameBuffer memory map */ 1098c2ecf20Sopenharmony_ci size_t fb_len; 1108c2ecf20Sopenharmony_ci dma_addr_t fb_phys; 1118c2ecf20Sopenharmony_ci int panel_idx; 1128c2ecf20Sopenharmony_ci struct clk *lcdclk; 1138c2ecf20Sopenharmony_ci struct device *dev; 1148c2ecf20Sopenharmony_ci}; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci/********************************************************************/ 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci#define LCD_CONTROL (AU1100_LCD_BASE + 0x0) 1198c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBB_BIT 21 1208c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBB_MASK (0x3 << LCD_CONTROL_SBB_BIT) 1218c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBB_1 (0 << LCD_CONTROL_SBB_BIT) 1228c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBB_2 (1 << LCD_CONTROL_SBB_BIT) 1238c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBB_3 (2 << LCD_CONTROL_SBB_BIT) 1248c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBB_4 (3 << LCD_CONTROL_SBB_BIT) 1258c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_BIT 18 1268c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_MASK (0x7 << LCD_CONTROL_SBPPF_BIT) 1278c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_655 (0 << LCD_CONTROL_SBPPF_BIT) 1288c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_565 (1 << LCD_CONTROL_SBPPF_BIT) 1298c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_556 (2 << LCD_CONTROL_SBPPF_BIT) 1308c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_1555 (3 << LCD_CONTROL_SBPPF_BIT) 1318c2ecf20Sopenharmony_ci #define LCD_CONTROL_SBPPF_5551 (4 << LCD_CONTROL_SBPPF_BIT) 1328c2ecf20Sopenharmony_ci #define LCD_CONTROL_WP (1<<17) 1338c2ecf20Sopenharmony_ci #define LCD_CONTROL_WD (1<<16) 1348c2ecf20Sopenharmony_ci #define LCD_CONTROL_C (1<<15) 1358c2ecf20Sopenharmony_ci #define LCD_CONTROL_SM_BIT 13 1368c2ecf20Sopenharmony_ci #define LCD_CONTROL_SM_MASK (0x3 << LCD_CONTROL_SM_BIT) 1378c2ecf20Sopenharmony_ci #define LCD_CONTROL_SM_0 (0 << LCD_CONTROL_SM_BIT) 1388c2ecf20Sopenharmony_ci #define LCD_CONTROL_SM_90 (1 << LCD_CONTROL_SM_BIT) 1398c2ecf20Sopenharmony_ci #define LCD_CONTROL_SM_180 (2 << LCD_CONTROL_SM_BIT) 1408c2ecf20Sopenharmony_ci #define LCD_CONTROL_SM_270 (3 << LCD_CONTROL_SM_BIT) 1418c2ecf20Sopenharmony_ci #define LCD_CONTROL_DB (1<<12) 1428c2ecf20Sopenharmony_ci #define LCD_CONTROL_CCO (1<<11) 1438c2ecf20Sopenharmony_ci #define LCD_CONTROL_DP (1<<10) 1448c2ecf20Sopenharmony_ci #define LCD_CONTROL_PO_BIT 8 1458c2ecf20Sopenharmony_ci #define LCD_CONTROL_PO_MASK (0x3 << LCD_CONTROL_PO_BIT) 1468c2ecf20Sopenharmony_ci #define LCD_CONTROL_PO_00 (0 << LCD_CONTROL_PO_BIT) 1478c2ecf20Sopenharmony_ci #define LCD_CONTROL_PO_01 (1 << LCD_CONTROL_PO_BIT) 1488c2ecf20Sopenharmony_ci #define LCD_CONTROL_PO_10 (2 << LCD_CONTROL_PO_BIT) 1498c2ecf20Sopenharmony_ci #define LCD_CONTROL_PO_11 (3 << LCD_CONTROL_PO_BIT) 1508c2ecf20Sopenharmony_ci #define LCD_CONTROL_MPI (1<<7) 1518c2ecf20Sopenharmony_ci #define LCD_CONTROL_PT (1<<6) 1528c2ecf20Sopenharmony_ci #define LCD_CONTROL_PC (1<<5) 1538c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_BIT 1 1548c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_MASK (0x7 << LCD_CONTROL_BPP_BIT) 1558c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_1 (0 << LCD_CONTROL_BPP_BIT) 1568c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_2 (1 << LCD_CONTROL_BPP_BIT) 1578c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_4 (2 << LCD_CONTROL_BPP_BIT) 1588c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_8 (3 << LCD_CONTROL_BPP_BIT) 1598c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_12 (4 << LCD_CONTROL_BPP_BIT) 1608c2ecf20Sopenharmony_ci #define LCD_CONTROL_BPP_16 (5 << LCD_CONTROL_BPP_BIT) 1618c2ecf20Sopenharmony_ci #define LCD_CONTROL_GO (1<<0) 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#define LCD_INTSTATUS (AU1100_LCD_BASE + 0x4) 1648c2ecf20Sopenharmony_ci#define LCD_INTENABLE (AU1100_LCD_BASE + 0x8) 1658c2ecf20Sopenharmony_ci #define LCD_INT_SD (1<<7) 1668c2ecf20Sopenharmony_ci #define LCD_INT_OF (1<<6) 1678c2ecf20Sopenharmony_ci #define LCD_INT_UF (1<<5) 1688c2ecf20Sopenharmony_ci #define LCD_INT_SA (1<<3) 1698c2ecf20Sopenharmony_ci #define LCD_INT_SS (1<<2) 1708c2ecf20Sopenharmony_ci #define LCD_INT_S1 (1<<1) 1718c2ecf20Sopenharmony_ci #define LCD_INT_S0 (1<<0) 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci#define LCD_HORZTIMING (AU1100_LCD_BASE + 0xC) 1748c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HN2_BIT 24 1758c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HN2_MASK (0xFF << LCD_HORZTIMING_HN2_BIT) 1768c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HN2_N(N) ((((N)-1) << LCD_HORZTIMING_HN2_BIT) & LCD_HORZTIMING_HN2_MASK) 1778c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HN1_BIT 16 1788c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HN1_MASK (0xFF << LCD_HORZTIMING_HN1_BIT) 1798c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HN1_N(N) ((((N)-1) << LCD_HORZTIMING_HN1_BIT) & LCD_HORZTIMING_HN1_MASK) 1808c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HPW_BIT 10 1818c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HPW_MASK (0x3F << LCD_HORZTIMING_HPW_BIT) 1828c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_HPW_N(N) ((((N)-1) << LCD_HORZTIMING_HPW_BIT) & LCD_HORZTIMING_HPW_MASK) 1838c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_PPL_BIT 0 1848c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_PPL_MASK (0x3FF << LCD_HORZTIMING_PPL_BIT) 1858c2ecf20Sopenharmony_ci #define LCD_HORZTIMING_PPL_N(N) ((((N)-1) << LCD_HORZTIMING_PPL_BIT) & LCD_HORZTIMING_PPL_MASK) 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci#define LCD_VERTTIMING (AU1100_LCD_BASE + 0x10) 1888c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VN2_BIT 24 1898c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VN2_MASK (0xFF << LCD_VERTTIMING_VN2_BIT) 1908c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VN2_N(N) ((((N)-1) << LCD_VERTTIMING_VN2_BIT) & LCD_VERTTIMING_VN2_MASK) 1918c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VN1_BIT 16 1928c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VN1_MASK (0xFF << LCD_VERTTIMING_VN1_BIT) 1938c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VN1_N(N) ((((N)-1) << LCD_VERTTIMING_VN1_BIT) & LCD_VERTTIMING_VN1_MASK) 1948c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VPW_BIT 10 1958c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VPW_MASK (0x3F << LCD_VERTTIMING_VPW_BIT) 1968c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_VPW_N(N) ((((N)-1) << LCD_VERTTIMING_VPW_BIT) & LCD_VERTTIMING_VPW_MASK) 1978c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_LPP_BIT 0 1988c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_LPP_MASK (0x3FF << LCD_VERTTIMING_LPP_BIT) 1998c2ecf20Sopenharmony_ci #define LCD_VERTTIMING_LPP_N(N) ((((N)-1) << LCD_VERTTIMING_LPP_BIT) & LCD_VERTTIMING_LPP_MASK) 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci#define LCD_CLKCONTROL (AU1100_LCD_BASE + 0x14) 2028c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_IB (1<<18) 2038c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_IC (1<<17) 2048c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_IH (1<<16) 2058c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_IV (1<<15) 2068c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_BF_BIT 10 2078c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_BF_MASK (0x1F << LCD_CLKCONTROL_BF_BIT) 2088c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_BF_N(N) ((((N)-1) << LCD_CLKCONTROL_BF_BIT) & LCD_CLKCONTROL_BF_MASK) 2098c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_PCD_BIT 0 2108c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_PCD_MASK (0x3FF << LCD_CLKCONTROL_PCD_BIT) 2118c2ecf20Sopenharmony_ci #define LCD_CLKCONTROL_PCD_N(N) (((N) << LCD_CLKCONTROL_PCD_BIT) & LCD_CLKCONTROL_PCD_MASK) 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci#define LCD_DMAADDR0 (AU1100_LCD_BASE + 0x18) 2148c2ecf20Sopenharmony_ci#define LCD_DMAADDR1 (AU1100_LCD_BASE + 0x1C) 2158c2ecf20Sopenharmony_ci #define LCD_DMA_SA_BIT 5 2168c2ecf20Sopenharmony_ci #define LCD_DMA_SA_MASK (0x7FFFFFF << LCD_DMA_SA_BIT) 2178c2ecf20Sopenharmony_ci #define LCD_DMA_SA_N(N) ((N) & LCD_DMA_SA_MASK) 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define LCD_WORDS (AU1100_LCD_BASE + 0x20) 2208c2ecf20Sopenharmony_ci #define LCD_WRD_WRDS_BIT 0 2218c2ecf20Sopenharmony_ci #define LCD_WRD_WRDS_MASK (0xFFFFFFFF << LCD_WRD_WRDS_BIT) 2228c2ecf20Sopenharmony_ci #define LCD_WRD_WRDS_N(N) ((((N)-1) << LCD_WRD_WRDS_BIT) & LCD_WRD_WRDS_MASK) 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci#define LCD_PWMDIV (AU1100_LCD_BASE + 0x24) 2258c2ecf20Sopenharmony_ci #define LCD_PWMDIV_EN (1<<12) 2268c2ecf20Sopenharmony_ci #define LCD_PWMDIV_PWMDIV_BIT 0 2278c2ecf20Sopenharmony_ci #define LCD_PWMDIV_PWMDIV_MASK (0xFFF << LCD_PWMDIV_PWMDIV_BIT) 2288c2ecf20Sopenharmony_ci #define LCD_PWMDIV_PWMDIV_N(N) ((((N)-1) << LCD_PWMDIV_PWMDIV_BIT) & LCD_PWMDIV_PWMDIV_MASK) 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci#define LCD_PWMHI (AU1100_LCD_BASE + 0x28) 2318c2ecf20Sopenharmony_ci #define LCD_PWMHI_PWMHI1_BIT 12 2328c2ecf20Sopenharmony_ci #define LCD_PWMHI_PWMHI1_MASK (0xFFF << LCD_PWMHI_PWMHI1_BIT) 2338c2ecf20Sopenharmony_ci #define LCD_PWMHI_PWMHI1_N(N) (((N) << LCD_PWMHI_PWMHI1_BIT) & LCD_PWMHI_PWMHI1_MASK) 2348c2ecf20Sopenharmony_ci #define LCD_PWMHI_PWMHI0_BIT 0 2358c2ecf20Sopenharmony_ci #define LCD_PWMHI_PWMHI0_MASK (0xFFF << LCD_PWMHI_PWMHI0_BIT) 2368c2ecf20Sopenharmony_ci #define LCD_PWMHI_PWMHI0_N(N) (((N) << LCD_PWMHI_PWMHI0_BIT) & LCD_PWMHI_PWMHI0_MASK) 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci#define LCD_PALLETTEBASE (AU1100_LCD_BASE + 0x400) 2398c2ecf20Sopenharmony_ci #define LCD_PALLETTE_MONO_MI_BIT 0 2408c2ecf20Sopenharmony_ci #define LCD_PALLETTE_MONO_MI_MASK (0xF << LCD_PALLETTE_MONO_MI_BIT) 2418c2ecf20Sopenharmony_ci #define LCD_PALLETTE_MONO_MI_N(N) (((N)<< LCD_PALLETTE_MONO_MI_BIT) & LCD_PALLETTE_MONO_MI_MASK) 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_RI_BIT 8 2448c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_RI_MASK (0xF << LCD_PALLETTE_COLOR_RI_BIT) 2458c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_RI_N(N) (((N)<< LCD_PALLETTE_COLOR_RI_BIT) & LCD_PALLETTE_COLOR_RI_MASK) 2468c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_GI_BIT 4 2478c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_GI_MASK (0xF << LCD_PALLETTE_COLOR_GI_BIT) 2488c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_GI_N(N) (((N)<< LCD_PALLETTE_COLOR_GI_BIT) & LCD_PALLETTE_COLOR_GI_MASK) 2498c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_BI_BIT 0 2508c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_BI_MASK (0xF << LCD_PALLETTE_COLOR_BI_BIT) 2518c2ecf20Sopenharmony_ci #define LCD_PALLETTE_COLOR_BI_N(N) (((N)<< LCD_PALLETTE_COLOR_BI_BIT) & LCD_PALLETTE_COLOR_BI_MASK) 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci #define LCD_PALLETTE_TFT_DC_BIT 0 2548c2ecf20Sopenharmony_ci #define LCD_PALLETTE_TFT_DC_MASK (0xFFFF << LCD_PALLETTE_TFT_DC_BIT) 2558c2ecf20Sopenharmony_ci #define LCD_PALLETTE_TFT_DC_N(N) (((N)<< LCD_PALLETTE_TFT_DC_BIT) & LCD_PALLETTE_TFT_DC_MASK) 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci/********************************************************************/ 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci/* List of panels known to work with the AU1100 LCD controller. 2608c2ecf20Sopenharmony_ci * To add a new panel, enter the same specifications as the 2618c2ecf20Sopenharmony_ci * Generic_TFT one, and MAKE SURE that it doesn't conflicts 2628c2ecf20Sopenharmony_ci * with the controller restrictions. Restrictions are: 2638c2ecf20Sopenharmony_ci * 2648c2ecf20Sopenharmony_ci * STN color panels: max_bpp <= 12 2658c2ecf20Sopenharmony_ci * STN mono panels: max_bpp <= 4 2668c2ecf20Sopenharmony_ci * TFT panels: max_bpp <= 16 2678c2ecf20Sopenharmony_ci * max_xres <= 800 2688c2ecf20Sopenharmony_ci * max_yres <= 600 2698c2ecf20Sopenharmony_ci */ 2708c2ecf20Sopenharmony_cistatic struct au1100fb_panel known_lcd_panels[] = 2718c2ecf20Sopenharmony_ci{ 2728c2ecf20Sopenharmony_ci /* 800x600x16bpp CRT */ 2738c2ecf20Sopenharmony_ci [0] = { 2748c2ecf20Sopenharmony_ci .name = "CRT_800x600_16", 2758c2ecf20Sopenharmony_ci .xres = 800, 2768c2ecf20Sopenharmony_ci .yres = 600, 2778c2ecf20Sopenharmony_ci .bpp = 16, 2788c2ecf20Sopenharmony_ci .control_base = 0x0004886A | 2798c2ecf20Sopenharmony_ci LCD_CONTROL_DEFAULT_PO | LCD_CONTROL_DEFAULT_SBPPF | 2808c2ecf20Sopenharmony_ci LCD_CONTROL_BPP_16 | LCD_CONTROL_SBB_4, 2818c2ecf20Sopenharmony_ci .clkcontrol_base = 0x00020000, 2828c2ecf20Sopenharmony_ci .horztiming = 0x005aff1f, 2838c2ecf20Sopenharmony_ci .verttiming = 0x16000e57, 2848c2ecf20Sopenharmony_ci }, 2858c2ecf20Sopenharmony_ci /* just the standard LCD */ 2868c2ecf20Sopenharmony_ci [1] = { 2878c2ecf20Sopenharmony_ci .name = "WWPC LCD", 2888c2ecf20Sopenharmony_ci .xres = 240, 2898c2ecf20Sopenharmony_ci .yres = 320, 2908c2ecf20Sopenharmony_ci .bpp = 16, 2918c2ecf20Sopenharmony_ci .control_base = 0x0006806A, 2928c2ecf20Sopenharmony_ci .horztiming = 0x0A1010EF, 2938c2ecf20Sopenharmony_ci .verttiming = 0x0301013F, 2948c2ecf20Sopenharmony_ci .clkcontrol_base = 0x00018001, 2958c2ecf20Sopenharmony_ci }, 2968c2ecf20Sopenharmony_ci /* Sharp 320x240 TFT panel */ 2978c2ecf20Sopenharmony_ci [2] = { 2988c2ecf20Sopenharmony_ci .name = "Sharp_LQ038Q5DR01", 2998c2ecf20Sopenharmony_ci .xres = 320, 3008c2ecf20Sopenharmony_ci .yres = 240, 3018c2ecf20Sopenharmony_ci .bpp = 16, 3028c2ecf20Sopenharmony_ci .control_base = 3038c2ecf20Sopenharmony_ci ( LCD_CONTROL_SBPPF_565 3048c2ecf20Sopenharmony_ci | LCD_CONTROL_C 3058c2ecf20Sopenharmony_ci | LCD_CONTROL_SM_0 3068c2ecf20Sopenharmony_ci | LCD_CONTROL_DEFAULT_PO 3078c2ecf20Sopenharmony_ci | LCD_CONTROL_PT 3088c2ecf20Sopenharmony_ci | LCD_CONTROL_PC 3098c2ecf20Sopenharmony_ci | LCD_CONTROL_BPP_16 ), 3108c2ecf20Sopenharmony_ci .horztiming = 3118c2ecf20Sopenharmony_ci ( LCD_HORZTIMING_HN2_N(8) 3128c2ecf20Sopenharmony_ci | LCD_HORZTIMING_HN1_N(60) 3138c2ecf20Sopenharmony_ci | LCD_HORZTIMING_HPW_N(12) 3148c2ecf20Sopenharmony_ci | LCD_HORZTIMING_PPL_N(320) ), 3158c2ecf20Sopenharmony_ci .verttiming = 3168c2ecf20Sopenharmony_ci ( LCD_VERTTIMING_VN2_N(5) 3178c2ecf20Sopenharmony_ci | LCD_VERTTIMING_VN1_N(17) 3188c2ecf20Sopenharmony_ci | LCD_VERTTIMING_VPW_N(1) 3198c2ecf20Sopenharmony_ci | LCD_VERTTIMING_LPP_N(240) ), 3208c2ecf20Sopenharmony_ci .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 3218c2ecf20Sopenharmony_ci }, 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci /* Hitachi SP14Q005 and possibly others */ 3248c2ecf20Sopenharmony_ci [3] = { 3258c2ecf20Sopenharmony_ci .name = "Hitachi_SP14Qxxx", 3268c2ecf20Sopenharmony_ci .xres = 320, 3278c2ecf20Sopenharmony_ci .yres = 240, 3288c2ecf20Sopenharmony_ci .bpp = 4, 3298c2ecf20Sopenharmony_ci .control_base = 3308c2ecf20Sopenharmony_ci ( LCD_CONTROL_C 3318c2ecf20Sopenharmony_ci | LCD_CONTROL_BPP_4 ), 3328c2ecf20Sopenharmony_ci .horztiming = 3338c2ecf20Sopenharmony_ci ( LCD_HORZTIMING_HN2_N(1) 3348c2ecf20Sopenharmony_ci | LCD_HORZTIMING_HN1_N(1) 3358c2ecf20Sopenharmony_ci | LCD_HORZTIMING_HPW_N(1) 3368c2ecf20Sopenharmony_ci | LCD_HORZTIMING_PPL_N(320) ), 3378c2ecf20Sopenharmony_ci .verttiming = 3388c2ecf20Sopenharmony_ci ( LCD_VERTTIMING_VN2_N(1) 3398c2ecf20Sopenharmony_ci | LCD_VERTTIMING_VN1_N(1) 3408c2ecf20Sopenharmony_ci | LCD_VERTTIMING_VPW_N(1) 3418c2ecf20Sopenharmony_ci | LCD_VERTTIMING_LPP_N(240) ), 3428c2ecf20Sopenharmony_ci .clkcontrol_base = LCD_CLKCONTROL_PCD_N(4), 3438c2ecf20Sopenharmony_ci }, 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci /* Generic 640x480 TFT panel */ 3468c2ecf20Sopenharmony_ci [4] = { 3478c2ecf20Sopenharmony_ci .name = "TFT_640x480_16", 3488c2ecf20Sopenharmony_ci .xres = 640, 3498c2ecf20Sopenharmony_ci .yres = 480, 3508c2ecf20Sopenharmony_ci .bpp = 16, 3518c2ecf20Sopenharmony_ci .control_base = 0x004806a | LCD_CONTROL_DEFAULT_PO, 3528c2ecf20Sopenharmony_ci .horztiming = 0x3434d67f, 3538c2ecf20Sopenharmony_ci .verttiming = 0x0e0e39df, 3548c2ecf20Sopenharmony_ci .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 3558c2ecf20Sopenharmony_ci }, 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_ci /* Pb1100 LCDB 640x480 PrimeView TFT panel */ 3588c2ecf20Sopenharmony_ci [5] = { 3598c2ecf20Sopenharmony_ci .name = "PrimeView_640x480_16", 3608c2ecf20Sopenharmony_ci .xres = 640, 3618c2ecf20Sopenharmony_ci .yres = 480, 3628c2ecf20Sopenharmony_ci .bpp = 16, 3638c2ecf20Sopenharmony_ci .control_base = 0x0004886a | LCD_CONTROL_DEFAULT_PO, 3648c2ecf20Sopenharmony_ci .horztiming = 0x0e4bfe7f, 3658c2ecf20Sopenharmony_ci .verttiming = 0x210805df, 3668c2ecf20Sopenharmony_ci .clkcontrol_base = 0x00038001, 3678c2ecf20Sopenharmony_ci }, 3688c2ecf20Sopenharmony_ci}; 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci/********************************************************************/ 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci/* Inline helpers */ 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci#define panel_is_dual(panel) (panel->control_base & LCD_CONTROL_DP) 3758c2ecf20Sopenharmony_ci#define panel_is_active(panel)(panel->control_base & LCD_CONTROL_PT) 3768c2ecf20Sopenharmony_ci#define panel_is_color(panel) (panel->control_base & LCD_CONTROL_PC) 3778c2ecf20Sopenharmony_ci#define panel_swap_rgb(panel) (panel->control_base & LCD_CONTROL_CCO) 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci#endif /* _AU1100LCD_H */ 380