regs-lcd.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_ARCH_REGS_LCD_H
  3. #define __ASM_ARCH_REGS_LCD_H
  4. #include <mach/bitfield.h>
  5. /*
  6. * LCD Controller Registers and Bits Definitions
  7. */
  8. #define LCCR0 (0x000) /* LCD Controller Control Register 0 */
  9. #define LCCR1 (0x004) /* LCD Controller Control Register 1 */
  10. #define LCCR2 (0x008) /* LCD Controller Control Register 2 */
  11. #define LCCR3 (0x00C) /* LCD Controller Control Register 3 */
  12. #define LCCR4 (0x010) /* LCD Controller Control Register 4 */
  13. #define LCCR5 (0x014) /* LCD Controller Control Register 5 */
  14. #define LCSR (0x038) /* LCD Controller Status Register 0 */
  15. #define LCSR1 (0x034) /* LCD Controller Status Register 1 */
  16. #define LIIDR (0x03C) /* LCD Controller Interrupt ID Register */
  17. #define TMEDRGBR (0x040) /* TMED RGB Seed Register */
  18. #define TMEDCR (0x044) /* TMED Control Register */
  19. #define FBR0 (0x020) /* DMA Channel 0 Frame Branch Register */
  20. #define FBR1 (0x024) /* DMA Channel 1 Frame Branch Register */
  21. #define FBR2 (0x028) /* DMA Channel 2 Frame Branch Register */
  22. #define FBR3 (0x02C) /* DMA Channel 2 Frame Branch Register */
  23. #define FBR4 (0x030) /* DMA Channel 2 Frame Branch Register */
  24. #define FBR5 (0x110) /* DMA Channel 2 Frame Branch Register */
  25. #define FBR6 (0x114) /* DMA Channel 2 Frame Branch Register */
  26. #define OVL1C1 (0x050) /* Overlay 1 Control Register 1 */
  27. #define OVL1C2 (0x060) /* Overlay 1 Control Register 2 */
  28. #define OVL2C1 (0x070) /* Overlay 2 Control Register 1 */
  29. #define OVL2C2 (0x080) /* Overlay 2 Control Register 2 */
  30. #define CMDCR (0x100) /* Command Control Register */
  31. #define PRSR (0x104) /* Panel Read Status Register */
  32. #define LCCR3_BPP(x) ((((x) & 0x7) << 24) | (((x) & 0x8) ? (1 << 29) : 0))
  33. #define LCCR3_PDFOR_0 (0 << 30)
  34. #define LCCR3_PDFOR_1 (1 << 30)
  35. #define LCCR3_PDFOR_2 (2 << 30)
  36. #define LCCR3_PDFOR_3 (3 << 30)
  37. #define LCCR4_PAL_FOR_0 (0 << 15)
  38. #define LCCR4_PAL_FOR_1 (1 << 15)
  39. #define LCCR4_PAL_FOR_2 (2 << 15)
  40. #define LCCR4_PAL_FOR_3 (3 << 15)
  41. #define LCCR4_PAL_FOR_MASK (3 << 15)
  42. #define FDADR0 (0x200) /* DMA Channel 0 Frame Descriptor Address Register */
  43. #define FDADR1 (0x210) /* DMA Channel 1 Frame Descriptor Address Register */
  44. #define FDADR2 (0x220) /* DMA Channel 2 Frame Descriptor Address Register */
  45. #define FDADR3 (0x230) /* DMA Channel 3 Frame Descriptor Address Register */
  46. #define FDADR4 (0x240) /* DMA Channel 4 Frame Descriptor Address Register */
  47. #define FDADR5 (0x250) /* DMA Channel 5 Frame Descriptor Address Register */
  48. #define FDADR6 (0x260) /* DMA Channel 6 Frame Descriptor Address Register */
  49. #define LCCR0_ENB (1 << 0) /* LCD Controller enable */
  50. #define LCCR0_CMS (1 << 1) /* Color/Monochrome Display Select */
  51. #define LCCR0_Color (LCCR0_CMS*0) /* Color display */
  52. #define LCCR0_Mono (LCCR0_CMS*1) /* Monochrome display */
  53. #define LCCR0_SDS (1 << 2) /* Single/Dual Panel Display Select */
  54. #define LCCR0_Sngl (LCCR0_SDS*0) /* Single panel display */
  55. #define LCCR0_Dual (LCCR0_SDS*1) /* Dual panel display */
  56. #define LCCR0_LDM (1 << 3) /* LCD Disable Done Mask */
  57. #define LCCR0_SFM (1 << 4) /* Start of frame mask */
  58. #define LCCR0_IUM (1 << 5) /* Input FIFO underrun mask */
  59. #define LCCR0_EFM (1 << 6) /* End of Frame mask */
  60. #define LCCR0_PAS (1 << 7) /* Passive/Active display Select */
  61. #define LCCR0_Pas (LCCR0_PAS*0) /* Passive display (STN) */
  62. #define LCCR0_Act (LCCR0_PAS*1) /* Active display (TFT) */
  63. #define LCCR0_DPD (1 << 9) /* Double Pixel Data (monochrome) */
  64. #define LCCR0_4PixMono (LCCR0_DPD*0) /* 4-Pixel/clock Monochrome display */
  65. #define LCCR0_8PixMono (LCCR0_DPD*1) /* 8-Pixel/clock Monochrome display */
  66. #define LCCR0_DIS (1 << 10) /* LCD Disable */
  67. #define LCCR0_QDM (1 << 11) /* LCD Quick Disable mask */
  68. #define LCCR0_PDD (0xff << 12) /* Palette DMA request delay */
  69. #define LCCR0_PDD_S 12
  70. #define LCCR0_BM (1 << 20) /* Branch mask */
  71. #define LCCR0_OUM (1 << 21) /* Output FIFO underrun mask */
  72. #define LCCR0_LCDT (1 << 22) /* LCD panel type */
  73. #define LCCR0_RDSTM (1 << 23) /* Read status interrupt mask */
  74. #define LCCR0_CMDIM (1 << 24) /* Command interrupt mask */
  75. #define LCCR0_OUC (1 << 25) /* Overlay Underlay control bit */
  76. #define LCCR0_LDDALT (1 << 26) /* LDD alternate mapping control */
  77. #define LCCR1_PPL Fld (10, 0) /* Pixels Per Line - 1 */
  78. #define LCCR1_DisWdth(Pixel) (((Pixel) - 1) << FShft (LCCR1_PPL))
  79. #define LCCR1_HSW Fld (6, 10) /* Horizontal Synchronization */
  80. #define LCCR1_HorSnchWdth(Tpix) (((Tpix) - 1) << FShft (LCCR1_HSW))
  81. #define LCCR1_ELW Fld (8, 16) /* End-of-Line pixel clock Wait - 1 */
  82. #define LCCR1_EndLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_ELW))
  83. #define LCCR1_BLW Fld (8, 24) /* Beginning-of-Line pixel clock */
  84. #define LCCR1_BegLnDel(Tpix) (((Tpix) - 1) << FShft (LCCR1_BLW))
  85. #define LCCR2_LPP Fld (10, 0) /* Line Per Panel - 1 */
  86. #define LCCR2_DisHght(Line) (((Line) - 1) << FShft (LCCR2_LPP))
  87. #define LCCR2_VSW Fld (6, 10) /* Vertical Synchronization pulse - 1 */
  88. #define LCCR2_VrtSnchWdth(Tln) (((Tln) - 1) << FShft (LCCR2_VSW))
  89. #define LCCR2_EFW Fld (8, 16) /* End-of-Frame line clock Wait */
  90. #define LCCR2_EndFrmDel(Tln) ((Tln) << FShft (LCCR2_EFW))
  91. #define LCCR2_BFW Fld (8, 24) /* Beginning-of-Frame line clock */
  92. #define LCCR2_BegFrmDel(Tln) ((Tln) << FShft (LCCR2_BFW))
  93. #define LCCR3_API (0xf << 16) /* AC Bias pin trasitions per interrupt */
  94. #define LCCR3_API_S 16
  95. #define LCCR3_VSP (1 << 20) /* vertical sync polarity */
  96. #define LCCR3_HSP (1 << 21) /* horizontal sync polarity */
  97. #define LCCR3_PCP (1 << 22) /* Pixel Clock Polarity (L_PCLK) */
  98. #define LCCR3_PixRsEdg (LCCR3_PCP*0) /* Pixel clock Rising-Edge */
  99. #define LCCR3_PixFlEdg (LCCR3_PCP*1) /* Pixel clock Falling-Edge */
  100. #define LCCR3_OEP (1 << 23) /* Output Enable Polarity */
  101. #define LCCR3_OutEnH (LCCR3_OEP*0) /* Output Enable active High */
  102. #define LCCR3_OutEnL (LCCR3_OEP*1) /* Output Enable active Low */
  103. #define LCCR3_DPC (1 << 27) /* double pixel clock mode */
  104. #define LCCR3_PCD Fld (8, 0) /* Pixel Clock Divisor */
  105. #define LCCR3_PixClkDiv(Div) (((Div) << FShft (LCCR3_PCD)))
  106. #define LCCR3_ACB Fld (8, 8) /* AC Bias */
  107. #define LCCR3_Acb(Acb) (((Acb) << FShft (LCCR3_ACB)))
  108. #define LCCR3_HorSnchH (LCCR3_HSP*0) /* HSP Active High */
  109. #define LCCR3_HorSnchL (LCCR3_HSP*1) /* HSP Active Low */
  110. #define LCCR3_VrtSnchH (LCCR3_VSP*0) /* VSP Active High */
  111. #define LCCR3_VrtSnchL (LCCR3_VSP*1) /* VSP Active Low */
  112. #define LCCR5_IUM(x) (1 << ((x) + 23)) /* input underrun mask */
  113. #define LCCR5_BSM(x) (1 << ((x) + 15)) /* branch mask */
  114. #define LCCR5_EOFM(x) (1 << ((x) + 7)) /* end of frame mask */
  115. #define LCCR5_SOFM(x) (1 << ((x) + 0)) /* start of frame mask */
  116. #define LCSR_LDD (1 << 0) /* LCD Disable Done */
  117. #define LCSR_SOF (1 << 1) /* Start of frame */
  118. #define LCSR_BER (1 << 2) /* Bus error */
  119. #define LCSR_ABC (1 << 3) /* AC Bias count */
  120. #define LCSR_IUL (1 << 4) /* input FIFO underrun Lower panel */
  121. #define LCSR_IUU (1 << 5) /* input FIFO underrun Upper panel */
  122. #define LCSR_OU (1 << 6) /* output FIFO underrun */
  123. #define LCSR_QD (1 << 7) /* quick disable */
  124. #define LCSR_EOF (1 << 8) /* end of frame */
  125. #define LCSR_BS (1 << 9) /* branch status */
  126. #define LCSR_SINT (1 << 10) /* subsequent interrupt */
  127. #define LCSR_RD_ST (1 << 11) /* read status */
  128. #define LCSR_CMD_INT (1 << 12) /* command interrupt */
  129. #define LCSR1_IU(x) (1 << ((x) + 23)) /* Input FIFO underrun */
  130. #define LCSR1_BS(x) (1 << ((x) + 15)) /* Branch Status */
  131. #define LCSR1_EOF(x) (1 << ((x) + 7)) /* End of Frame Status */
  132. #define LCSR1_SOF(x) (1 << ((x) - 1)) /* Start of Frame Status */
  133. #define LDCMD_PAL (1 << 26) /* instructs DMA to load palette buffer */
  134. /* overlay control registers */
  135. #define OVLxC1_PPL(x) ((((x) - 1) & 0x3ff) << 0) /* Pixels Per Line */
  136. #define OVLxC1_LPO(x) ((((x) - 1) & 0x3ff) << 10) /* Number of Lines */
  137. #define OVLxC1_BPP(x) (((x) & 0xf) << 20) /* Bits Per Pixel */
  138. #define OVLxC1_OEN (1 << 31) /* Enable bit for Overlay */
  139. #define OVLxC2_XPOS(x) (((x) & 0x3ff) << 0) /* Horizontal Position */
  140. #define OVLxC2_YPOS(x) (((x) & 0x3ff) << 10) /* Vertical Position */
  141. #define OVL2C2_PFOR(x) (((x) & 0x7) << 20) /* Pixel Format */
  142. /* smartpanel related */
  143. #define PRSR_DATA(x) ((x) & 0xff) /* Panel Data */
  144. #define PRSR_A0 (1 << 8) /* Read Data Source */
  145. #define PRSR_ST_OK (1 << 9) /* Status OK */
  146. #define PRSR_CON_NT (1 << 10) /* Continue to Next Command */
  147. #define SMART_CMD_A0 (0x1 << 8)
  148. #define SMART_CMD_READ_STATUS_REG (0x0 << 9)
  149. #define SMART_CMD_READ_FRAME_BUFFER ((0x0 << 9) | SMART_CMD_A0)
  150. #define SMART_CMD_WRITE_COMMAND (0x1 << 9)
  151. #define SMART_CMD_WRITE_DATA ((0x1 << 9) | SMART_CMD_A0)
  152. #define SMART_CMD_WRITE_FRAME ((0x2 << 9) | SMART_CMD_A0)
  153. #define SMART_CMD_WAIT_FOR_VSYNC (0x3 << 9)
  154. #define SMART_CMD_NOOP (0x4 << 9)
  155. #define SMART_CMD_INTERRUPT (0x5 << 9)
  156. #define SMART_CMD(x) (SMART_CMD_WRITE_COMMAND | ((x) & 0xff))
  157. #define SMART_DAT(x) (SMART_CMD_WRITE_DATA | ((x) & 0xff))
  158. /* SMART_DELAY() is introduced for software controlled delay primitive which
  159. * can be inserted between command sequences, unused command 0x6 is used here
  160. * and delay ranges from 0ms ~ 255ms
  161. */
  162. #define SMART_CMD_DELAY (0x6 << 9)
  163. #define SMART_DELAY(ms) (SMART_CMD_DELAY | ((ms) & 0xff))
  164. #endif /* __ASM_ARCH_REGS_LCD_H */