lcd.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*
  2. * LCD controller Memory Map
  3. *
  4. * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __LCDC_H__
  26. #define __LCDC_H__
  27. /* LCD module registers */
  28. typedef struct lcd_ctrl {
  29. u32 ssar; /* 0x00 Screen Start Address Register */
  30. u32 sr; /* 0x04 LCD Size Register */
  31. u32 vpw; /* 0x08 Virtual Page Width Register */
  32. u32 cpr; /* 0x0C Cursor Position Register */
  33. u32 cwhb; /* 0x10 Cursor Width Height and Blink Register */
  34. u32 ccmr; /* 0x14 Color Cursor Mapping Register */
  35. u32 pcr; /* 0x18 Panel Configuration Register */
  36. u32 hcr; /* 0x1C Horizontal Configuration Register */
  37. u32 vcr; /* 0x20 Vertical Configuration Register */
  38. u32 por; /* 0x24 Panning Offset Register */
  39. u32 scr; /* 0x28 Sharp Configuration Register */
  40. u32 pccr; /* 0x2C PWM Contrast Control Register */
  41. u32 dcr; /* 0x30 DMA Control Register */
  42. u32 rmcr; /* 0x34 Refresh Mode Control Register */
  43. u32 icr; /* 0x38 Refresh Mode Control Register */
  44. u32 ier; /* 0x3C Interrupt Enable Register */
  45. u32 isr; /* 0x40 Interrupt Status Register */
  46. u32 res[4];
  47. u32 gwsar; /* 0x50 Graphic Window Start Address Register */
  48. u32 gwsr; /* 0x54 Graphic Window Size Register */
  49. u32 gwvpw; /* 0x58 Graphic Window Virtual Page Width Register */
  50. u32 gwpor; /* 0x5C Graphic Window Panning Offset Register */
  51. u32 gwpr; /* 0x60 Graphic Window Position Register */
  52. u32 gwcr; /* 0x64 Graphic Window Control Register */
  53. u32 gwdcr; /* 0x68 Graphic Window DMA Control Register */
  54. } lcd_t;
  55. typedef struct lcdbg_ctrl {
  56. u32 bglut[255];
  57. } lcdbg_t;
  58. typedef struct lcdgw_ctrl {
  59. u32 gwlut[255];
  60. } lcdgw_t;
  61. /* Bit definitions and macros for LCDC_LSSAR */
  62. #define LCDC_SSAR_SSA(x) (((x)&0x3FFFFFFF)<<2)
  63. /* Bit definitions and macros for LCDC_LSR */
  64. #define LCDC_SR_XMAX(x) (((x)&0x0000003F)<<20)
  65. #define LCDC_SR_YMAX(x) ((x)&0x000003FF)
  66. /* Bit definitions and macros for LCDC_LVPWR */
  67. #define LCDC_VPWR_VPW(x) (((x)&0x000003FF)
  68. /* Bit definitions and macros for LCDC_LCPR */
  69. #define LCDC_CPR_CC(x) (((x)&0x00000003)<<30)
  70. #define LCDC_CPR_CC_AND (0xC0000000)
  71. #define LCDC_CPR_CC_XOR (0x80000000)
  72. #define LCDC_CPR_CC_OR (0x40000000)
  73. #define LCDC_CPR_CC_TRANSPARENT (0x00000000)
  74. #define LCDC_CPR_OP (0x10000000)
  75. #define LCDC_CPR_CXP(x) (((x)&0x000003FF)<<16)
  76. #define LCDC_CPR_CYP(x) ((x)&0x000003FF)
  77. /* Bit definitions and macros for LCDC_LCWHBR */
  78. #define LCDC_CWHBR_BK_EN (0x80000000)
  79. #define LCDC_CWHBR_CW(x) (((x)&0x0000001F)<<24)
  80. #define LCDC_CWHBR_CH(x) (((x)&0x0000001F)<<16)
  81. #define LCDC_CWHBR_BD(x) ((x)&0x000000FF)
  82. /* Bit definitions and macros for LCDC_LCCMR */
  83. #define LCDC_CCMR_CUR_COL_R(x) (((x)&0x0000003F)<<12)
  84. #define LCDC_CCMR_CUR_COL_G(x) (((x)&0x0000003F)<<6)
  85. #define LCDC_CCMR_CUR_COL_B(x) ((x)&0x0000003F)
  86. /* Bit definitions and macros for LCDC_LPCR */
  87. #define LCDC_PCR_PANEL_TYPE(x) (((x)&0x00000003)<<30)
  88. #define LCDC_PCR_MODE_TFT (0xC0000000)
  89. #define LCDC_PCR_MODE_CSTN (0x40000000)
  90. #define LCDC_PCR_MODE_MONOCHROME (0x00000000)
  91. #define LCDC_PCR_TFT (0x80000000)
  92. #define LCDC_PCR_COLOR (0x40000000)
  93. #define LCDC_PCR_PBSIZ(x) (((x)&0x00000003)<<28)
  94. #define LCDC_PCR_PBSIZ_8 (0x30000000)
  95. #define LCDC_PCR_PBSIZ_4 (0x20000000)
  96. #define LCDC_PCR_PBSIZ_2 (0x10000000)
  97. #define LCDC_PCR_PBSIZ_1 (0x00000000)
  98. #define LCDC_PCR_BPIX(x) (((x)&0x00000007)<<25)
  99. #define LCDC_PCR_BPIX_18bpp (0x0C000000)
  100. #define LCDC_PCR_BPIX_16bpp (0x0A000000)
  101. #define LCDC_PCR_BPIX_12bpp (0x08000000)
  102. #define LCDC_PCR_BPIX_8bpp (0x06000000)
  103. #define LCDC_PCR_BPIX_4bpp (0x04000000)
  104. #define LCDC_PCR_BPIX_2bpp (0x02000000)
  105. #define LCDC_PCR_BPIX_1bpp (0x00000000)
  106. #define LCDC_PCR_PIXPOL (0x01000000)
  107. #define LCDC_PCR_FLM (0x00800000)
  108. #define LCDC_PCR_LPPOL (0x00400000)
  109. #define LCDC_PCR_CLKPOL (0x00200000)
  110. #define LCDC_PCR_OEPOL (0x00100000)
  111. #define LCDC_PCR_SCLKIDLE (0x00080000)
  112. #define LCDC_PCR_ENDSEL (0x00040000)
  113. #define LCDC_PCR_SWAP_SEL (0x00020000)
  114. #define LCDC_PCR_REV_VS (0x00010000)
  115. #define LCDC_PCR_ACDSEL (0x00008000)
  116. #define LCDC_PCR_ACD(x) (((x)&0x0000007F)<<8)
  117. #define LCDC_PCR_SCLKSEL (0x00000080)
  118. #define LCDC_PCR_SHARP (0x00000040)
  119. #define LCDC_PCR_PCD(x) ((x)&0x0000003F)
  120. /* Bit definitions and macros for LCDC_LHCR */
  121. #define LCDC_HCR_H_WIDTH(x) (((x)&0x0000003F)<<26)
  122. #define LCDC_HCR_H_WAIT_1(x) (((x)&0x000000FF)<<8)
  123. #define LCDC_HCR_H_WAIT_2(x) ((x)&0x000000FF)
  124. /* Bit definitions and macros for LCDC_LVCR */
  125. #define LCDC_VCR_V_WIDTH(x) (((x)&0x0000003F)<<26)
  126. #define LCDC_VCR_V_WAIT_1(x) (((x)&0x000000FF)<<8)
  127. #define LCDC_VCR_V_WAIT_2(x) ((x)&0x000000FF)
  128. /* Bit definitions and macros for LCDC_SCR */
  129. #define LCDC_SCR_PS_R_DELAY(x) (((x)&0x0000003F) << 26)
  130. #define LCDC_SCR_CLS_R_DELAY(x) (((x)&0x000000FF) << 16)
  131. #define LCDC_SCR_RTG_DELAY(x) (((x)&0x0000000F) << 8)
  132. #define LCDC_SCR_GRAY2(x) (((x)&0x0000000F) << 4)
  133. #define LCDC_SCR_GRAY1(x) ((x)&&0x0000000F)
  134. /* Bit definitions and macros for LCDC_LPCCR */
  135. #define LCDC_PCCR_CLS_HI_WID(x) (((x)&0x000001FF)<<16)
  136. #define LCDC_PCCR_LDMSK (0x00008000)
  137. #define LCDC_PCCR_SCR(x) (((x)&0x00000003)<<9)
  138. #define LCDC_PCCR_SCR_LCDCLK (0x00000400)
  139. #define LCDC_PCCR_SCR_PIXCLK (0x00000200)
  140. #define LCDC_PCCR_SCR_LNPULSE (0x00000000)
  141. #define LCDC_PCCR_CC_EN (0x00000100)
  142. #define LCDC_PCCR_PW(x) ((x)&0x000000FF)
  143. /* Bit definitions and macros for LCDC_LDCR */
  144. #define LCDC_DCR_BURST (0x80000000)
  145. #define LCDC_DCR_HM(x) (((x)&0x0000001F)<<16)
  146. #define LCDC_DCR_TM(x) ((x)&0x0000001F)
  147. /* Bit definitions and macros for LCDC_LRMCR */
  148. #define LCDC_RMCR_SEL_REF (0x00000001)
  149. /* Bit definitions and macros for LCDC_LICR */
  150. #define LCDC_ICR_GW_INT_CON (0x00000010)
  151. #define LCDC_ICR_INTSYN (0x00000004)
  152. #define LCDC_ICR_INTCON (0x00000001)
  153. /* Bit definitions and macros for LCDC_LIER */
  154. #define LCDC_IER_GW_UDR (0x00000080)
  155. #define LCDC_IER_GW_ERR (0x00000040)
  156. #define LCDC_IER_GW_EOF (0x00000020)
  157. #define LCDC_IER_GW_BOF (0x00000010)
  158. #define LCDC_IER_UDR (0x00000008)
  159. #define LCDC_IER_ERR (0x00000004)
  160. #define LCDC_IER_EOF (0x00000002)
  161. #define LCDC_IER_BOF (0x00000001)
  162. /* Bit definitions and macros for LCDC_LGWSAR */
  163. #define LCDC_GWSAR_GWSA(x) (((x)&0x3FFFFFFF)<<2)
  164. /* Bit definitions and macros for LCDC_LGWSR */
  165. #define LCDC_GWSR_GWW(x) (((x)&0x0000003F)<<20)
  166. #define LCDC_GWSR_GWH(x) ((x)&0x000003FF)
  167. /* Bit definitions and macros for LCDC_LGWVPWR */
  168. #define LCDC_GWVPWR_GWVPW(x) ((x)&0x000003FF)
  169. /* Bit definitions and macros for LCDC_LGWPOR */
  170. #define LCDC_GWPOR_GWPO(x) ((x)&0x0000001F)
  171. /* Bit definitions and macros for LCDC_LGWPR */
  172. #define LCDC_GWPR_GWXP(x) (((x)&0x000003FF)<<16)
  173. #define LCDC_GWPR_GWYP(x) ((x)&0x000003FF)
  174. /* Bit definitions and macros for LCDC_LGWCR */
  175. #define LCDC_GWCR_GWAV(x) (((x)&0x000000FF)<<24)
  176. #define LCDC_GWCR_GWCKE (0x00800000)
  177. #define LCDC_LGWCR_GWE (0x00400000)
  178. #define LCDC_LGWCR_GW_RVS (0x00200000)
  179. #define LCDC_LGWCR_GWCKR(x) (((x)&0x0000003F)<<12)
  180. #define LCDC_LGWCR_GWCKG(x) (((x)&0x0000003F)<<6)
  181. #define LCDC_LGWCR_GWCKB(x) ((x)&0x0000003F)
  182. /* Bit definitions and macros for LCDC_LGWDCR */
  183. #define LCDC_LGWDCR_GWBT (0x80000000)
  184. #define LCDC_LGWDCR_GWHM(x) (((x)&0x0000001F)<<16)
  185. #define LCDC_LGWDCR_GWTM(x) ((x)&0x0000001F)
  186. #endif /* __LCDC_H__ */