at91_lcdc.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * include/asm-arm/arch-at91/at91_lcdc.h
  3. *
  4. * LCD Controller (LCDC).
  5. * Based on AT91SAM9261 datasheet revision E.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. */
  12. #ifndef AT91_LCDC_H
  13. #define AT91_LCDC_H
  14. #define AT91_LCDC_DMABADDR1 0x00 /* DMA Base Address Register 1 */
  15. #define AT91_LCDC_DMABADDR2 0x04 /* DMA Base Address Register 2 */
  16. #define AT91_LCDC_DMAFRMPT1 0x08 /* DMA Frame Pointer Register 1 */
  17. #define AT91_LCDC_DMAFRMPT2 0x0c /* DMA Frame Pointer Register 2 */
  18. #define AT91_LCDC_DMAFRMADD1 0x10 /* DMA Frame Address Register 1 */
  19. #define AT91_LCDC_DMAFRMADD2 0x14 /* DMA Frame Address Register 2 */
  20. #define AT91_LCDC_DMAFRMCFG 0x18 /* DMA Frame Configuration Register */
  21. #define AT91_LCDC_FRSIZE (0x7fffff << 0) /* Frame Size */
  22. #define AT91_LCDC_BLENGTH (0x7f << 24) /* Burst Length */
  23. #define AT91_LCDC_DMACON 0x1c /* DMA Control Register */
  24. #define AT91_LCDC_DMAEN (0x1 << 0) /* DMA Enable */
  25. #define AT91_LCDC_DMARST (0x1 << 1) /* DMA Reset */
  26. #define AT91_LCDC_DMABUSY (0x1 << 2) /* DMA Busy */
  27. #define AT91_LCDC_LCDCON1 0x0800 /* LCD Control Register 1 */
  28. #define AT91_LCDC_BYPASS (1 << 0) /* Bypass lcd_dotck divider */
  29. #define AT91_LCDC_CLKVAL (0x1ff << 12) /* Clock Divider */
  30. #define AT91_LCDC_LINCNT (0x7ff << 21) /* Line Counter */
  31. #define AT91_LCDC_LCDCON2 0x0804 /* LCD Control Register 2 */
  32. #define AT91_LCDC_DISTYPE (3 << 0) /* Display Type */
  33. #define AT91_LCDC_DISTYPE_STNMONO (0 << 0)
  34. #define AT91_LCDC_DISTYPE_STNCOLOR (1 << 0)
  35. #define AT91_LCDC_DISTYPE_TFT (2 << 0)
  36. #define AT91_LCDC_SCANMOD (1 << 2) /* Scan Mode */
  37. #define AT91_LCDC_SCANMOD_SINGLE (0 << 2)
  38. #define AT91_LCDC_SCANMOD_DUAL (1 << 2)
  39. #define AT91_LCDC_IFWIDTH (3 << 3) /*Interface Width */
  40. #define AT91_LCDC_IFWIDTH_4 (0 << 3)
  41. #define AT91_LCDC_IFWIDTH_8 (1 << 3)
  42. #define AT91_LCDC_IFWIDTH_16 (2 << 3)
  43. #define AT91_LCDC_PIXELSIZE (7 << 5) /* Bits per pixel */
  44. #define AT91_LCDC_PIXELSIZE_1 (0 << 5)
  45. #define AT91_LCDC_PIXELSIZE_2 (1 << 5)
  46. #define AT91_LCDC_PIXELSIZE_4 (2 << 5)
  47. #define AT91_LCDC_PIXELSIZE_8 (3 << 5)
  48. #define AT91_LCDC_PIXELSIZE_16 (4 << 5)
  49. #define AT91_LCDC_PIXELSIZE_24 (5 << 5)
  50. #define AT91_LCDC_INVVD (1 << 8) /* LCD Data polarity */
  51. #define AT91_LCDC_INVVD_NORMAL (0 << 8)
  52. #define AT91_LCDC_INVVD_INVERTED (1 << 8)
  53. #define AT91_LCDC_INVFRAME (1 << 9 ) /* LCD VSync polarity */
  54. #define AT91_LCDC_INVFRAME_NORMAL (0 << 9)
  55. #define AT91_LCDC_INVFRAME_INVERTED (1 << 9)
  56. #define AT91_LCDC_INVLINE (1 << 10) /* LCD HSync polarity */
  57. #define AT91_LCDC_INVLINE_NORMAL (0 << 10)
  58. #define AT91_LCDC_INVLINE_INVERTED (1 << 10)
  59. #define AT91_LCDC_INVCLK (1 << 11) /* LCD dotclk polarity */
  60. #define AT91_LCDC_INVCLK_NORMAL (0 << 11)
  61. #define AT91_LCDC_INVCLK_INVERTED (1 << 11)
  62. #define AT91_LCDC_INVDVAL (1 << 12) /* LCD dval polarity */
  63. #define AT91_LCDC_INVDVAL_NORMAL (0 << 12)
  64. #define AT91_LCDC_INVDVAL_INVERTED (1 << 12)
  65. #define AT91_LCDC_CLKMOD (1 << 15) /* LCD dotclk mode */
  66. #define AT91_LCDC_CLKMOD_ACTIVEDISPLAY (0 << 15)
  67. #define AT91_LCDC_CLKMOD_ALWAYSACTIVE (1 << 15)
  68. #define AT91_LCDC_MEMOR (1 << 31) /* Memory Ordering Format */
  69. #define AT91_LCDC_MEMOR_BIG (0 << 31)
  70. #define AT91_LCDC_MEMOR_LITTLE (1 << 31)
  71. #define AT91_LCDC_TIM1 0x0808 /* LCD Timing Register 1 */
  72. #define AT91_LCDC_VFP (0xff << 0) /* Vertical Front Porch */
  73. #define AT91_LCDC_VBP (0xff << 8) /* Vertical Back Porch */
  74. #define AT91_LCDC_VPW (0x3f << 16) /* Vertical Synchronization Pulse Width */
  75. #define AT91_LCDC_VHDLY (0xf << 24) /* Vertical to Horizontal Delay */
  76. #define AT91_LCDC_TIM2 0x080c /* LCD Timing Register 2 */
  77. #define AT91_LCDC_HBP (0xff << 0) /* Horizontal Back Porch */
  78. #define AT91_LCDC_HPW (0x3f << 8) /* Horizontal Synchronization Pulse Width */
  79. #define AT91_LCDC_HFP (0x7ff << 21) /* Horizontal Front Porch */
  80. #define AT91_LCDC_LCDFRMCFG 0x0810 /* LCD Frame Configuration Register */
  81. #define AT91_LCDC_LINEVAL (0x7ff << 0) /* Vertical Size of LCD Module */
  82. #define AT91_LCDC_HOZVAL (0x7ff << 21) /* Horizontal Size of LCD Module */
  83. #define AT91_LCDC_FIFO 0x0814 /* LCD FIFO Register */
  84. #define AT91_LCDC_FIFOTH (0xffff) /* FIFO Threshold */
  85. #define AT91_LCDC_DP1_2 0x081c /* Dithering Pattern DP1_2 Register */
  86. #define AT91_LCDC_DP4_7 0x0820 /* Dithering Pattern DP4_7 Register */
  87. #define AT91_LCDC_DP3_5 0x0824 /* Dithering Pattern DP3_5 Register */
  88. #define AT91_LCDC_DP2_3 0x0828 /* Dithering Pattern DP2_3 Register */
  89. #define AT91_LCDC_DP5_7 0x082c /* Dithering Pattern DP5_7 Register */
  90. #define AT91_LCDC_DP3_4 0x0830 /* Dithering Pattern DP3_4 Register */
  91. #define AT91_LCDC_DP4_5 0x0834 /* Dithering Pattern DP4_5 Register */
  92. #define AT91_LCDC_DP6_7 0x0838 /* Dithering Pattern DP6_7 Register */
  93. #define AT91_LCDC_DP1_2_VAL (0xff)
  94. #define AT91_LCDC_DP4_7_VAL (0xfffffff)
  95. #define AT91_LCDC_DP3_5_VAL (0xfffff)
  96. #define AT91_LCDC_DP2_3_VAL (0xfff)
  97. #define AT91_LCDC_DP5_7_VAL (0xfffffff)
  98. #define AT91_LCDC_DP3_4_VAL (0xffff)
  99. #define AT91_LCDC_DP4_5_VAL (0xfffff)
  100. #define AT91_LCDC_DP6_7_VAL (0xfffffff)
  101. #define AT91_LCDC_PWRCON 0x083c /* Power Control Register */
  102. #define AT91_LCDC_PWR (1 << 0) /* LCD Module Power Control */
  103. #define AT91_LCDC_GUARDT (0x7f << 1) /* Delay in Frame Period */
  104. #define AT91_LCDC_BUSY (1 << 31) /* LCD Busy */
  105. #define AT91_LCDC_CONTRAST_CTR 0x0840 /* Contrast Control Register */
  106. #define AT91_LCDC_PS (3 << 0) /* Contrast Counter Prescaler */
  107. #define AT91_LCDC_PS_DIV1 (0 << 0)
  108. #define AT91_LCDC_PS_DIV2 (1 << 0)
  109. #define AT91_LCDC_PS_DIV4 (2 << 0)
  110. #define AT91_LCDC_PS_DIV8 (3 << 0)
  111. #define AT91_LCDC_POL (1 << 2) /* Polarity of output Pulse */
  112. #define AT91_LCDC_POL_NEGATIVE (0 << 2)
  113. #define AT91_LCDC_POL_POSITIVE (1 << 2)
  114. #define AT91_LCDC_ENA (1 << 3) /* PWM generator Control */
  115. #define AT91_LCDC_ENA_PWMDISABLE (0 << 3)
  116. #define AT91_LCDC_ENA_PWMENABLE (1 << 3)
  117. #define AT91_LCDC_CONTRAST_VAL 0x0844 /* Contrast Value Register */
  118. #define AT91_LCDC_CVAL (0xff) /* PWM compare value */
  119. #define AT91_LCDC_IER 0x0848 /* Interrupt Enable Register */
  120. #define AT91_LCDC_IDR 0x084c /* Interrupt Disable Register */
  121. #define AT91_LCDC_IMR 0x0850 /* Interrupt Mask Register */
  122. #define AT91_LCDC_ISR 0x0854 /* Interrupt Enable Register */
  123. #define AT91_LCDC_ICR 0x0858 /* Interrupt Clear Register */
  124. #define AT91_LCDC_LNI (1 << 0) /* Line Interrupt */
  125. #define AT91_LCDC_LSTLNI (1 << 1) /* Last Line Interrupt */
  126. #define AT91_LCDC_EOFI (1 << 2) /* DMA End Of Frame Interrupt */
  127. #define AT91_LCDC_UFLWI (1 << 4) /* FIFO Underflow Interrupt */
  128. #define AT91_LCDC_OWRI (1 << 5) /* FIFO Overwrite Interrupt */
  129. #define AT91_LCDC_MERI (1 << 6) /* DMA Memory Error Interrupt */
  130. #define AT91_LCDC_LUT_(n) (0x0c00 + ((n)*4)) /* Palette Entry 0..255 */
  131. #endif