pxa168fb.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. #ifndef __PXA168FB_H__
  2. #define __PXA168FB_H__
  3. /* ------------< LCD register >------------ */
  4. /* Video Frame 0&1 start address registers */
  5. #define LCD_SPU_DMA_START_ADDR_Y0 0x00C0
  6. #define LCD_SPU_DMA_START_ADDR_U0 0x00C4
  7. #define LCD_SPU_DMA_START_ADDR_V0 0x00C8
  8. #define LCD_CFG_DMA_START_ADDR_0 0x00CC /* Cmd address */
  9. #define LCD_SPU_DMA_START_ADDR_Y1 0x00D0
  10. #define LCD_SPU_DMA_START_ADDR_U1 0x00D4
  11. #define LCD_SPU_DMA_START_ADDR_V1 0x00D8
  12. #define LCD_CFG_DMA_START_ADDR_1 0x00DC /* Cmd address */
  13. /* YC & UV Pitch */
  14. #define LCD_SPU_DMA_PITCH_YC 0x00E0
  15. #define SPU_DMA_PITCH_C(c) ((c) << 16)
  16. #define SPU_DMA_PITCH_Y(y) (y)
  17. #define LCD_SPU_DMA_PITCH_UV 0x00E4
  18. #define SPU_DMA_PITCH_V(v) ((v) << 16)
  19. #define SPU_DMA_PITCH_U(u) (u)
  20. /* Video Starting Point on Screen Register */
  21. #define LCD_SPUT_DMA_OVSA_HPXL_VLN 0x00E8
  22. #define CFG_DMA_OVSA_VLN(y) ((y) << 16) /* 0~0xfff */
  23. #define CFG_DMA_OVSA_HPXL(x) (x) /* 0~0xfff */
  24. /* Video Size Register */
  25. #define LCD_SPU_DMA_HPXL_VLN 0x00EC
  26. #define CFG_DMA_VLN(y) ((y) << 16)
  27. #define CFG_DMA_HPXL(x) (x)
  28. /* Video Size After zooming Register */
  29. #define LCD_SPU_DZM_HPXL_VLN 0x00F0
  30. #define CFG_DZM_VLN(y) ((y) << 16)
  31. #define CFG_DZM_HPXL(x) (x)
  32. /* Graphic Frame 0&1 Starting Address Register */
  33. #define LCD_CFG_GRA_START_ADDR0 0x00F4
  34. #define LCD_CFG_GRA_START_ADDR1 0x00F8
  35. /* Graphic Frame Pitch */
  36. #define LCD_CFG_GRA_PITCH 0x00FC
  37. /* Graphic Starting Point on Screen Register */
  38. #define LCD_SPU_GRA_OVSA_HPXL_VLN 0x0100
  39. #define CFG_GRA_OVSA_VLN(y) ((y) << 16)
  40. #define CFG_GRA_OVSA_HPXL(x) (x)
  41. /* Graphic Size Register */
  42. #define LCD_SPU_GRA_HPXL_VLN 0x0104
  43. #define CFG_GRA_VLN(y) ((y) << 16)
  44. #define CFG_GRA_HPXL(x) (x)
  45. /* Graphic Size after Zooming Register */
  46. #define LCD_SPU_GZM_HPXL_VLN 0x0108
  47. #define CFG_GZM_VLN(y) ((y) << 16)
  48. #define CFG_GZM_HPXL(x) (x)
  49. /* HW Cursor Starting Point on Screen Register */
  50. #define LCD_SPU_HWC_OVSA_HPXL_VLN 0x010C
  51. #define CFG_HWC_OVSA_VLN(y) ((y) << 16)
  52. #define CFG_HWC_OVSA_HPXL(x) (x)
  53. /* HW Cursor Size */
  54. #define LCD_SPU_HWC_HPXL_VLN 0x0110
  55. #define CFG_HWC_VLN(y) ((y) << 16)
  56. #define CFG_HWC_HPXL(x) (x)
  57. /* Total Screen Size Register */
  58. #define LCD_SPUT_V_H_TOTAL 0x0114
  59. #define CFG_V_TOTAL(y) ((y) << 16)
  60. #define CFG_H_TOTAL(x) (x)
  61. /* Total Screen Active Size Register */
  62. #define LCD_SPU_V_H_ACTIVE 0x0118
  63. #define CFG_V_ACTIVE(y) ((y) << 16)
  64. #define CFG_H_ACTIVE(x) (x)
  65. /* Screen H&V Porch Register */
  66. #define LCD_SPU_H_PORCH 0x011C
  67. #define CFG_H_BACK_PORCH(b) ((b) << 16)
  68. #define CFG_H_FRONT_PORCH(f) (f)
  69. #define LCD_SPU_V_PORCH 0x0120
  70. #define CFG_V_BACK_PORCH(b) ((b) << 16)
  71. #define CFG_V_FRONT_PORCH(f) (f)
  72. /* Screen Blank Color Register */
  73. #define LCD_SPU_BLANKCOLOR 0x0124
  74. #define CFG_BLANKCOLOR_MASK 0x00FFFFFF
  75. #define CFG_BLANKCOLOR_R_MASK 0x000000FF
  76. #define CFG_BLANKCOLOR_G_MASK 0x0000FF00
  77. #define CFG_BLANKCOLOR_B_MASK 0x00FF0000
  78. /* HW Cursor Color 1&2 Register */
  79. #define LCD_SPU_ALPHA_COLOR1 0x0128
  80. #define CFG_HWC_COLOR1 0x00FFFFFF
  81. #define CFG_HWC_COLOR1_R(red) ((red) << 16)
  82. #define CFG_HWC_COLOR1_G(green) ((green) << 8)
  83. #define CFG_HWC_COLOR1_B(blue) (blue)
  84. #define CFG_HWC_COLOR1_R_MASK 0x000000FF
  85. #define CFG_HWC_COLOR1_G_MASK 0x0000FF00
  86. #define CFG_HWC_COLOR1_B_MASK 0x00FF0000
  87. #define LCD_SPU_ALPHA_COLOR2 0x012C
  88. #define CFG_HWC_COLOR2 0x00FFFFFF
  89. #define CFG_HWC_COLOR2_R_MASK 0x000000FF
  90. #define CFG_HWC_COLOR2_G_MASK 0x0000FF00
  91. #define CFG_HWC_COLOR2_B_MASK 0x00FF0000
  92. /* Video YUV Color Key Control */
  93. #define LCD_SPU_COLORKEY_Y 0x0130
  94. #define CFG_CKEY_Y2(y2) ((y2) << 24)
  95. #define CFG_CKEY_Y2_MASK 0xFF000000
  96. #define CFG_CKEY_Y1(y1) ((y1) << 16)
  97. #define CFG_CKEY_Y1_MASK 0x00FF0000
  98. #define CFG_CKEY_Y(y) ((y) << 8)
  99. #define CFG_CKEY_Y_MASK 0x0000FF00
  100. #define CFG_ALPHA_Y(y) (y)
  101. #define CFG_ALPHA_Y_MASK 0x000000FF
  102. #define LCD_SPU_COLORKEY_U 0x0134
  103. #define CFG_CKEY_U2(u2) ((u2) << 24)
  104. #define CFG_CKEY_U2_MASK 0xFF000000
  105. #define CFG_CKEY_U1(u1) ((u1) << 16)
  106. #define CFG_CKEY_U1_MASK 0x00FF0000
  107. #define CFG_CKEY_U(u) ((u) << 8)
  108. #define CFG_CKEY_U_MASK 0x0000FF00
  109. #define CFG_ALPHA_U(u) (u)
  110. #define CFG_ALPHA_U_MASK 0x000000FF
  111. #define LCD_SPU_COLORKEY_V 0x0138
  112. #define CFG_CKEY_V2(v2) ((v2) << 24)
  113. #define CFG_CKEY_V2_MASK 0xFF000000
  114. #define CFG_CKEY_V1(v1) ((v1) << 16)
  115. #define CFG_CKEY_V1_MASK 0x00FF0000
  116. #define CFG_CKEY_V(v) ((v) << 8)
  117. #define CFG_CKEY_V_MASK 0x0000FF00
  118. #define CFG_ALPHA_V(v) (v)
  119. #define CFG_ALPHA_V_MASK 0x000000FF
  120. /* SPI Read Data Register */
  121. #define LCD_SPU_SPI_RXDATA 0x0140
  122. /* Smart Panel Read Data Register */
  123. #define LCD_SPU_ISA_RSDATA 0x0144
  124. #define ISA_RXDATA_16BIT_1_DATA_MASK 0x000000FF
  125. #define ISA_RXDATA_16BIT_2_DATA_MASK 0x0000FF00
  126. #define ISA_RXDATA_16BIT_3_DATA_MASK 0x00FF0000
  127. #define ISA_RXDATA_16BIT_4_DATA_MASK 0xFF000000
  128. #define ISA_RXDATA_32BIT_1_DATA_MASK 0x00FFFFFF
  129. /* HWC SRAM Read Data Register */
  130. #define LCD_SPU_HWC_RDDAT 0x0158
  131. /* Gamma Table SRAM Read Data Register */
  132. #define LCD_SPU_GAMMA_RDDAT 0x015c
  133. #define CFG_GAMMA_RDDAT_MASK 0x000000FF
  134. /* Palette Table SRAM Read Data Register */
  135. #define LCD_SPU_PALETTE_RDDAT 0x0160
  136. #define CFG_PALETTE_RDDAT_MASK 0x00FFFFFF
  137. /* I/O Pads Input Read Only Register */
  138. #define LCD_SPU_IOPAD_IN 0x0178
  139. #define CFG_IOPAD_IN_MASK 0x0FFFFFFF
  140. /* Reserved Read Only Registers */
  141. #define LCD_CFG_RDREG5F 0x017C
  142. #define IRE_FRAME_CNT_MASK 0x000000C0
  143. #define IPE_FRAME_CNT_MASK 0x00000030
  144. #define GRA_FRAME_CNT_MASK 0x0000000C /* Graphic */
  145. #define DMA_FRAME_CNT_MASK 0x00000003 /* Video */
  146. /* SPI Control Register. */
  147. #define LCD_SPU_SPI_CTRL 0x0180
  148. #define CFG_SCLKCNT(div) ((div) << 24) /* 0xFF~0x2 */
  149. #define CFG_SCLKCNT_MASK 0xFF000000
  150. #define CFG_RXBITS(rx) ((rx) << 16) /* 0x1F~0x1 */
  151. #define CFG_RXBITS_MASK 0x00FF0000
  152. #define CFG_TXBITS(tx) ((tx) << 8) /* 0x1F~0x1 */
  153. #define CFG_TXBITS_MASK 0x0000FF00
  154. #define CFG_CLKINV(clk) ((clk) << 7)
  155. #define CFG_CLKINV_MASK 0x00000080
  156. #define CFG_KEEPXFER(transfer) ((transfer) << 6)
  157. #define CFG_KEEPXFER_MASK 0x00000040
  158. #define CFG_RXBITSTO0(rx) ((rx) << 5)
  159. #define CFG_RXBITSTO0_MASK 0x00000020
  160. #define CFG_TXBITSTO0(tx) ((tx) << 4)
  161. #define CFG_TXBITSTO0_MASK 0x00000010
  162. #define CFG_SPI_ENA(spi) ((spi) << 3)
  163. #define CFG_SPI_ENA_MASK 0x00000008
  164. #define CFG_SPI_SEL(spi) ((spi) << 2)
  165. #define CFG_SPI_SEL_MASK 0x00000004
  166. #define CFG_SPI_3W4WB(wire) ((wire) << 1)
  167. #define CFG_SPI_3W4WB_MASK 0x00000002
  168. #define CFG_SPI_START(start) (start)
  169. #define CFG_SPI_START_MASK 0x00000001
  170. /* SPI Tx Data Register */
  171. #define LCD_SPU_SPI_TXDATA 0x0184
  172. /*
  173. 1. Smart Pannel 8-bit Bus Control Register.
  174. 2. AHB Slave Path Data Port Register
  175. */
  176. #define LCD_SPU_SMPN_CTRL 0x0188
  177. /* DMA Control 0 Register */
  178. #define LCD_SPU_DMA_CTRL0 0x0190
  179. #define CFG_NOBLENDING(nb) ((nb) << 31)
  180. #define CFG_NOBLENDING_MASK 0x80000000
  181. #define CFG_GAMMA_ENA(gn) ((gn) << 30)
  182. #define CFG_GAMMA_ENA_MASK 0x40000000
  183. #define CFG_CBSH_ENA(cn) ((cn) << 29)
  184. #define CFG_CBSH_ENA_MASK 0x20000000
  185. #define CFG_PALETTE_ENA(pn) ((pn) << 28)
  186. #define CFG_PALETTE_ENA_MASK 0x10000000
  187. #define CFG_ARBFAST_ENA(an) ((an) << 27)
  188. #define CFG_ARBFAST_ENA_MASK 0x08000000
  189. #define CFG_HWC_1BITMOD(mode) ((mode) << 26)
  190. #define CFG_HWC_1BITMOD_MASK 0x04000000
  191. #define CFG_HWC_1BITENA(mn) ((mn) << 25)
  192. #define CFG_HWC_1BITENA_MASK 0x02000000
  193. #define CFG_HWC_ENA(cn) ((cn) << 24)
  194. #define CFG_HWC_ENA_MASK 0x01000000
  195. #define CFG_DMAFORMAT(dmaformat) ((dmaformat) << 20)
  196. #define CFG_DMAFORMAT_MASK 0x00F00000
  197. #define CFG_GRAFORMAT(graformat) ((graformat) << 16)
  198. #define CFG_GRAFORMAT_MASK 0x000F0000
  199. /* for graphic part */
  200. #define CFG_GRA_FTOGGLE(toggle) ((toggle) << 15)
  201. #define CFG_GRA_FTOGGLE_MASK 0x00008000
  202. #define CFG_GRA_HSMOOTH(smooth) ((smooth) << 14)
  203. #define CFG_GRA_HSMOOTH_MASK 0x00004000
  204. #define CFG_GRA_TSTMODE(test) ((test) << 13)
  205. #define CFG_GRA_TSTMODE_MASK 0x00002000
  206. #define CFG_GRA_SWAPRB(swap) ((swap) << 12)
  207. #define CFG_GRA_SWAPRB_MASK 0x00001000
  208. #define CFG_GRA_SWAPUV(swap) ((swap) << 11)
  209. #define CFG_GRA_SWAPUV_MASK 0x00000800
  210. #define CFG_GRA_SWAPYU(swap) ((swap) << 10)
  211. #define CFG_GRA_SWAPYU_MASK 0x00000400
  212. #define CFG_YUV2RGB_GRA(cvrt) ((cvrt) << 9)
  213. #define CFG_YUV2RGB_GRA_MASK 0x00000200
  214. #define CFG_GRA_ENA(gra) ((gra) << 8)
  215. #define CFG_GRA_ENA_MASK 0x00000100
  216. /* for video part */
  217. #define CFG_DMA_FTOGGLE(toggle) ((toggle) << 7)
  218. #define CFG_DMA_FTOGGLE_MASK 0x00000080
  219. #define CFG_DMA_HSMOOTH(smooth) ((smooth) << 6)
  220. #define CFG_DMA_HSMOOTH_MASK 0x00000040
  221. #define CFG_DMA_TSTMODE(test) ((test) << 5)
  222. #define CFG_DMA_TSTMODE_MASK 0x00000020
  223. #define CFG_DMA_SWAPRB(swap) ((swap) << 4)
  224. #define CFG_DMA_SWAPRB_MASK 0x00000010
  225. #define CFG_DMA_SWAPUV(swap) ((swap) << 3)
  226. #define CFG_DMA_SWAPUV_MASK 0x00000008
  227. #define CFG_DMA_SWAPYU(swap) ((swap) << 2)
  228. #define CFG_DMA_SWAPYU_MASK 0x00000004
  229. #define CFG_DMA_SWAP_MASK 0x0000001C
  230. #define CFG_YUV2RGB_DMA(cvrt) ((cvrt) << 1)
  231. #define CFG_YUV2RGB_DMA_MASK 0x00000002
  232. #define CFG_DMA_ENA(video) (video)
  233. #define CFG_DMA_ENA_MASK 0x00000001
  234. /* DMA Control 1 Register */
  235. #define LCD_SPU_DMA_CTRL1 0x0194
  236. #define CFG_FRAME_TRIG(trig) ((trig) << 31)
  237. #define CFG_FRAME_TRIG_MASK 0x80000000
  238. #define CFG_VSYNC_TRIG(trig) ((trig) << 28)
  239. #define CFG_VSYNC_TRIG_MASK 0x70000000
  240. #define CFG_VSYNC_INV(inv) ((inv) << 27)
  241. #define CFG_VSYNC_INV_MASK 0x08000000
  242. #define CFG_COLOR_KEY_MODE(cmode) ((cmode) << 24)
  243. #define CFG_COLOR_KEY_MASK 0x07000000
  244. #define CFG_CARRY(carry) ((carry) << 23)
  245. #define CFG_CARRY_MASK 0x00800000
  246. #define CFG_LNBUF_ENA(lnbuf) ((lnbuf) << 22)
  247. #define CFG_LNBUF_ENA_MASK 0x00400000
  248. #define CFG_GATED_ENA(gated) ((gated) << 21)
  249. #define CFG_GATED_ENA_MASK 0x00200000
  250. #define CFG_PWRDN_ENA(power) ((power) << 20)
  251. #define CFG_PWRDN_ENA_MASK 0x00100000
  252. #define CFG_DSCALE(dscale) ((dscale) << 18)
  253. #define CFG_DSCALE_MASK 0x000C0000
  254. #define CFG_ALPHA_MODE(amode) ((amode) << 16)
  255. #define CFG_ALPHA_MODE_MASK 0x00030000
  256. #define CFG_ALPHA(alpha) ((alpha) << 8)
  257. #define CFG_ALPHA_MASK 0x0000FF00
  258. #define CFG_PXLCMD(pxlcmd) (pxlcmd)
  259. #define CFG_PXLCMD_MASK 0x000000FF
  260. /* SRAM Control Register */
  261. #define LCD_SPU_SRAM_CTRL 0x0198
  262. #define CFG_SRAM_INIT_WR_RD(mode) ((mode) << 14)
  263. #define CFG_SRAM_INIT_WR_RD_MASK 0x0000C000
  264. #define CFG_SRAM_ADDR_LCDID(id) ((id) << 8)
  265. #define CFG_SRAM_ADDR_LCDID_MASK 0x00000F00
  266. #define CFG_SRAM_ADDR(addr) (addr)
  267. #define CFG_SRAM_ADDR_MASK 0x000000FF
  268. /* SRAM Write Data Register */
  269. #define LCD_SPU_SRAM_WRDAT 0x019C
  270. /* SRAM RTC/WTC Control Register */
  271. #define LCD_SPU_SRAM_PARA0 0x01A0
  272. /* SRAM Power Down Control Register */
  273. #define LCD_SPU_SRAM_PARA1 0x01A4
  274. #define CFG_CSB_256x32(hwc) ((hwc) << 15) /* HWC */
  275. #define CFG_CSB_256x32_MASK 0x00008000
  276. #define CFG_CSB_256x24(palette) ((palette) << 14) /* Palette */
  277. #define CFG_CSB_256x24_MASK 0x00004000
  278. #define CFG_CSB_256x8(gamma) ((gamma) << 13) /* Gamma */
  279. #define CFG_CSB_256x8_MASK 0x00002000
  280. #define CFG_PDWN256x32(pdwn) ((pdwn) << 7) /* HWC */
  281. #define CFG_PDWN256x32_MASK 0x00000080
  282. #define CFG_PDWN256x24(pdwn) ((pdwn) << 6) /* Palette */
  283. #define CFG_PDWN256x24_MASK 0x00000040
  284. #define CFG_PDWN256x8(pdwn) ((pdwn) << 5) /* Gamma */
  285. #define CFG_PDWN256x8_MASK 0x00000020
  286. #define CFG_PDWN32x32(pdwn) ((pdwn) << 3)
  287. #define CFG_PDWN32x32_MASK 0x00000008
  288. #define CFG_PDWN16x66(pdwn) ((pdwn) << 2)
  289. #define CFG_PDWN16x66_MASK 0x00000004
  290. #define CFG_PDWN32x66(pdwn) ((pdwn) << 1)
  291. #define CFG_PDWN32x66_MASK 0x00000002
  292. #define CFG_PDWN64x66(pdwn) (pdwn)
  293. #define CFG_PDWN64x66_MASK 0x00000001
  294. /* Smart or Dumb Panel Clock Divider */
  295. #define LCD_CFG_SCLK_DIV 0x01A8
  296. #define SCLK_SOURCE_SELECT(src) ((src) << 31)
  297. #define SCLK_SOURCE_SELECT_MASK 0x80000000
  298. #define CLK_FRACDIV(frac) ((frac) << 16)
  299. #define CLK_FRACDIV_MASK 0x0FFF0000
  300. #define CLK_INT_DIV(div) (div)
  301. #define CLK_INT_DIV_MASK 0x0000FFFF
  302. /* Video Contrast Register */
  303. #define LCD_SPU_CONTRAST 0x01AC
  304. #define CFG_BRIGHTNESS(bright) ((bright) << 16)
  305. #define CFG_BRIGHTNESS_MASK 0xFFFF0000
  306. #define CFG_CONTRAST(contrast) (contrast)
  307. #define CFG_CONTRAST_MASK 0x0000FFFF
  308. /* Video Saturation Register */
  309. #define LCD_SPU_SATURATION 0x01B0
  310. #define CFG_C_MULTS(mult) ((mult) << 16)
  311. #define CFG_C_MULTS_MASK 0xFFFF0000
  312. #define CFG_SATURATION(sat) (sat)
  313. #define CFG_SATURATION_MASK 0x0000FFFF
  314. /* Video Hue Adjust Register */
  315. #define LCD_SPU_CBSH_HUE 0x01B4
  316. #define CFG_SIN0(sin0) ((sin0) << 16)
  317. #define CFG_SIN0_MASK 0xFFFF0000
  318. #define CFG_COS0(con0) (con0)
  319. #define CFG_COS0_MASK 0x0000FFFF
  320. /* Dump LCD Panel Control Register */
  321. #define LCD_SPU_DUMB_CTRL 0x01B8
  322. #define CFG_DUMBMODE(mode) ((mode) << 28)
  323. #define CFG_DUMBMODE_MASK 0xF0000000
  324. #define CFG_LCDGPIO_O(data) ((data) << 20)
  325. #define CFG_LCDGPIO_O_MASK 0x0FF00000
  326. #define CFG_LCDGPIO_ENA(gpio) ((gpio) << 12)
  327. #define CFG_LCDGPIO_ENA_MASK 0x000FF000
  328. #define CFG_BIAS_OUT(bias) ((bias) << 8)
  329. #define CFG_BIAS_OUT_MASK 0x00000100
  330. #define CFG_REVERSE_RGB(rRGB) ((rRGB) << 7)
  331. #define CFG_REVERSE_RGB_MASK 0x00000080
  332. #define CFG_INV_COMPBLANK(blank) ((blank) << 6)
  333. #define CFG_INV_COMPBLANK_MASK 0x00000040
  334. #define CFG_INV_COMPSYNC(sync) ((sync) << 5)
  335. #define CFG_INV_COMPSYNC_MASK 0x00000020
  336. #define CFG_INV_HENA(hena) ((hena) << 4)
  337. #define CFG_INV_HENA_MASK 0x00000010
  338. #define CFG_INV_VSYNC(vsync) ((vsync) << 3)
  339. #define CFG_INV_VSYNC_MASK 0x00000008
  340. #define CFG_INV_HSYNC(hsync) ((hsync) << 2)
  341. #define CFG_INV_HSYNC_MASK 0x00000004
  342. #define CFG_INV_PCLK(pclk) ((pclk) << 1)
  343. #define CFG_INV_PCLK_MASK 0x00000002
  344. #define CFG_DUMB_ENA(dumb) (dumb)
  345. #define CFG_DUMB_ENA_MASK 0x00000001
  346. /* LCD I/O Pads Control Register */
  347. #define SPU_IOPAD_CONTROL 0x01BC
  348. #define CFG_GRA_VM_ENA(vm) ((vm) << 15) /* gfx */
  349. #define CFG_GRA_VM_ENA_MASK 0x00008000
  350. #define CFG_DMA_VM_ENA(vm) ((vm) << 13) /* video */
  351. #define CFG_DMA_VM_ENA_MASK 0x00002000
  352. #define CFG_CMD_VM_ENA(vm) ((vm) << 13)
  353. #define CFG_CMD_VM_ENA_MASK 0x00000800
  354. #define CFG_CSC(csc) ((csc) << 8) /* csc */
  355. #define CFG_CSC_MASK 0x00000300
  356. #define CFG_AXICTRL(axi) ((axi) << 4)
  357. #define CFG_AXICTRL_MASK 0x000000F0
  358. #define CFG_IOPADMODE(iopad) (iopad)
  359. #define CFG_IOPADMODE_MASK 0x0000000F
  360. /* LCD Interrupt Control Register */
  361. #define SPU_IRQ_ENA 0x01C0
  362. #define DMA_FRAME_IRQ0_ENA(irq) ((irq) << 31)
  363. #define DMA_FRAME_IRQ0_ENA_MASK 0x80000000
  364. #define DMA_FRAME_IRQ1_ENA(irq) ((irq) << 30)
  365. #define DMA_FRAME_IRQ1_ENA_MASK 0x40000000
  366. #define DMA_FF_UNDERFLOW_ENA(ff) ((ff) << 29)
  367. #define DMA_FF_UNDERFLOW_ENA_MASK 0x20000000
  368. #define GRA_FRAME_IRQ0_ENA(irq) ((irq) << 27)
  369. #define GRA_FRAME_IRQ0_ENA_MASK 0x08000000
  370. #define GRA_FRAME_IRQ1_ENA(irq) ((irq) << 26)
  371. #define GRA_FRAME_IRQ1_ENA_MASK 0x04000000
  372. #define GRA_FF_UNDERFLOW_ENA(ff) ((ff) << 25)
  373. #define GRA_FF_UNDERFLOW_ENA_MASK 0x02000000
  374. #define VSYNC_IRQ_ENA(vsync_irq) ((vsync_irq) << 23)
  375. #define VSYNC_IRQ_ENA_MASK 0x00800000
  376. #define DUMB_FRAMEDONE_ENA(fdone) ((fdone) << 22)
  377. #define DUMB_FRAMEDONE_ENA_MASK 0x00400000
  378. #define TWC_FRAMEDONE_ENA(fdone) ((fdone) << 21)
  379. #define TWC_FRAMEDONE_ENA_MASK 0x00200000
  380. #define HWC_FRAMEDONE_ENA(fdone) ((fdone) << 20)
  381. #define HWC_FRAMEDONE_ENA_MASK 0x00100000
  382. #define SLV_IRQ_ENA(irq) ((irq) << 19)
  383. #define SLV_IRQ_ENA_MASK 0x00080000
  384. #define SPI_IRQ_ENA(irq) ((irq) << 18)
  385. #define SPI_IRQ_ENA_MASK 0x00040000
  386. #define PWRDN_IRQ_ENA(irq) ((irq) << 17)
  387. #define PWRDN_IRQ_ENA_MASK 0x00020000
  388. #define ERR_IRQ_ENA(irq) ((irq) << 16)
  389. #define ERR_IRQ_ENA_MASK 0x00010000
  390. #define CLEAN_SPU_IRQ_ISR(irq) (irq)
  391. #define CLEAN_SPU_IRQ_ISR_MASK 0x0000FFFF
  392. /* LCD Interrupt Status Register */
  393. #define SPU_IRQ_ISR 0x01C4
  394. #define DMA_FRAME_IRQ0(irq) ((irq) << 31)
  395. #define DMA_FRAME_IRQ0_MASK 0x80000000
  396. #define DMA_FRAME_IRQ1(irq) ((irq) << 30)
  397. #define DMA_FRAME_IRQ1_MASK 0x40000000
  398. #define DMA_FF_UNDERFLOW(ff) ((ff) << 29)
  399. #define DMA_FF_UNDERFLOW_MASK 0x20000000
  400. #define GRA_FRAME_IRQ0(irq) ((irq) << 27)
  401. #define GRA_FRAME_IRQ0_MASK 0x08000000
  402. #define GRA_FRAME_IRQ1(irq) ((irq) << 26)
  403. #define GRA_FRAME_IRQ1_MASK 0x04000000
  404. #define GRA_FF_UNDERFLOW(ff) ((ff) << 25)
  405. #define GRA_FF_UNDERFLOW_MASK 0x02000000
  406. #define VSYNC_IRQ(vsync_irq) ((vsync_irq) << 23)
  407. #define VSYNC_IRQ_MASK 0x00800000
  408. #define DUMB_FRAMEDONE(fdone) ((fdone) << 22)
  409. #define DUMB_FRAMEDONE_MASK 0x00400000
  410. #define TWC_FRAMEDONE(fdone) ((fdone) << 21)
  411. #define TWC_FRAMEDONE_MASK 0x00200000
  412. #define HWC_FRAMEDONE(fdone) ((fdone) << 20)
  413. #define HWC_FRAMEDONE_MASK 0x00100000
  414. #define SLV_IRQ(irq) ((irq) << 19)
  415. #define SLV_IRQ_MASK 0x00080000
  416. #define SPI_IRQ(irq) ((irq) << 18)
  417. #define SPI_IRQ_MASK 0x00040000
  418. #define PWRDN_IRQ(irq) ((irq) << 17)
  419. #define PWRDN_IRQ_MASK 0x00020000
  420. #define ERR_IRQ(irq) ((irq) << 16)
  421. #define ERR_IRQ_MASK 0x00010000
  422. /* read-only */
  423. #define DMA_FRAME_IRQ0_LEVEL_MASK 0x00008000
  424. #define DMA_FRAME_IRQ1_LEVEL_MASK 0x00004000
  425. #define DMA_FRAME_CNT_ISR_MASK 0x00003000
  426. #define GRA_FRAME_IRQ0_LEVEL_MASK 0x00000800
  427. #define GRA_FRAME_IRQ1_LEVEL_MASK 0x00000400
  428. #define GRA_FRAME_CNT_ISR_MASK 0x00000300
  429. #define VSYNC_IRQ_LEVEL_MASK 0x00000080
  430. #define DUMB_FRAMEDONE_LEVEL_MASK 0x00000040
  431. #define TWC_FRAMEDONE_LEVEL_MASK 0x00000020
  432. #define HWC_FRAMEDONE_LEVEL_MASK 0x00000010
  433. #define SLV_FF_EMPTY_MASK 0x00000008
  434. #define DMA_FF_ALLEMPTY_MASK 0x00000004
  435. #define GRA_FF_ALLEMPTY_MASK 0x00000002
  436. #define PWRDN_IRQ_LEVEL_MASK 0x00000001
  437. /*
  438. * defined Video Memory Color format for DMA control 0 register
  439. * DMA0 bit[23:20]
  440. */
  441. #define VMODE_RGB565 0x0
  442. #define VMODE_RGB1555 0x1
  443. #define VMODE_RGB888PACKED 0x2
  444. #define VMODE_RGB888UNPACKED 0x3
  445. #define VMODE_RGBA888 0x4
  446. #define VMODE_YUV422PACKED 0x5
  447. #define VMODE_YUV422PLANAR 0x6
  448. #define VMODE_YUV420PLANAR 0x7
  449. #define VMODE_SMPNCMD 0x8
  450. #define VMODE_PALETTE4BIT 0x9
  451. #define VMODE_PALETTE8BIT 0xa
  452. #define VMODE_RESERVED 0xb
  453. /*
  454. * defined Graphic Memory Color format for DMA control 0 register
  455. * DMA0 bit[19:16]
  456. */
  457. #define GMODE_RGB565 0x0
  458. #define GMODE_RGB1555 0x1
  459. #define GMODE_RGB888PACKED 0x2
  460. #define GMODE_RGB888UNPACKED 0x3
  461. #define GMODE_RGBA888 0x4
  462. #define GMODE_YUV422PACKED 0x5
  463. #define GMODE_YUV422PLANAR 0x6
  464. #define GMODE_YUV420PLANAR 0x7
  465. #define GMODE_SMPNCMD 0x8
  466. #define GMODE_PALETTE4BIT 0x9
  467. #define GMODE_PALETTE8BIT 0xa
  468. #define GMODE_RESERVED 0xb
  469. /*
  470. * define for DMA control 1 register
  471. */
  472. #define DMA1_FRAME_TRIG 31 /* bit location */
  473. #define DMA1_VSYNC_MODE 28
  474. #define DMA1_VSYNC_INV 27
  475. #define DMA1_CKEY 24
  476. #define DMA1_CARRY 23
  477. #define DMA1_LNBUF_ENA 22
  478. #define DMA1_GATED_ENA 21
  479. #define DMA1_PWRDN_ENA 20
  480. #define DMA1_DSCALE 18
  481. #define DMA1_ALPHA_MODE 16
  482. #define DMA1_ALPHA 08
  483. #define DMA1_PXLCMD 00
  484. /*
  485. * defined for Configure Dumb Mode
  486. * DUMB LCD Panel bit[31:28]
  487. */
  488. #define DUMB16_RGB565_0 0x0
  489. #define DUMB16_RGB565_1 0x1
  490. #define DUMB18_RGB666_0 0x2
  491. #define DUMB18_RGB666_1 0x3
  492. #define DUMB12_RGB444_0 0x4
  493. #define DUMB12_RGB444_1 0x5
  494. #define DUMB24_RGB888_0 0x6
  495. #define DUMB_BLANK 0x7
  496. /*
  497. * defined for Configure I/O Pin Allocation Mode
  498. * LCD LCD I/O Pads control register bit[3:0]
  499. */
  500. #define IOPAD_DUMB24 0x0
  501. #define IOPAD_DUMB18SPI 0x1
  502. #define IOPAD_DUMB18GPIO 0x2
  503. #define IOPAD_DUMB16SPI 0x3
  504. #define IOPAD_DUMB16GPIO 0x4
  505. #define IOPAD_DUMB12 0x5
  506. #define IOPAD_SMART18SPI 0x6
  507. #define IOPAD_SMART16SPI 0x7
  508. #define IOPAD_SMART8BOTH 0x8
  509. #endif /* __PXA168FB_H__ */