armada_hw.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /*
  2. * Copyright (C) 2012 Russell King
  3. * Rewritten from the dovefb driver, and Armada510 manuals.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef ARMADA_HW_H
  10. #define ARMADA_HW_H
  11. /*
  12. * Note: the following registers are written from IRQ context:
  13. * LCD_SPU_V_PORCH, LCD_SPU_ADV_REG, LCD_SPUT_V_H_TOTAL
  14. * LCD_SPU_DMA_START_ADDR_[YUV][01], LCD_SPU_DMA_PITCH_YC,
  15. * LCD_SPU_DMA_PITCH_UV, LCD_SPU_DMA_OVSA_HPXL_VLN,
  16. * LCD_SPU_DMA_HPXL_VLN, LCD_SPU_DZM_HPXL_VLN, LCD_SPU_DMA_CTRL0
  17. */
  18. enum {
  19. LCD_SPU_ADV_REG = 0x0084, /* Armada 510 */
  20. LCD_SPU_DMA_START_ADDR_Y0 = 0x00c0,
  21. LCD_SPU_DMA_START_ADDR_U0 = 0x00c4,
  22. LCD_SPU_DMA_START_ADDR_V0 = 0x00c8,
  23. LCD_CFG_DMA_START_ADDR_0 = 0x00cc,
  24. LCD_SPU_DMA_START_ADDR_Y1 = 0x00d0,
  25. LCD_SPU_DMA_START_ADDR_U1 = 0x00d4,
  26. LCD_SPU_DMA_START_ADDR_V1 = 0x00d8,
  27. LCD_CFG_DMA_START_ADDR_1 = 0x00dc,
  28. LCD_SPU_DMA_PITCH_YC = 0x00e0,
  29. LCD_SPU_DMA_PITCH_UV = 0x00e4,
  30. LCD_SPU_DMA_OVSA_HPXL_VLN = 0x00e8,
  31. LCD_SPU_DMA_HPXL_VLN = 0x00ec,
  32. LCD_SPU_DZM_HPXL_VLN = 0x00f0,
  33. LCD_CFG_GRA_START_ADDR0 = 0x00f4,
  34. LCD_CFG_GRA_START_ADDR1 = 0x00f8,
  35. LCD_CFG_GRA_PITCH = 0x00fc,
  36. LCD_SPU_GRA_OVSA_HPXL_VLN = 0x0100,
  37. LCD_SPU_GRA_HPXL_VLN = 0x0104,
  38. LCD_SPU_GZM_HPXL_VLN = 0x0108,
  39. LCD_SPU_HWC_OVSA_HPXL_VLN = 0x010c,
  40. LCD_SPU_HWC_HPXL_VLN = 0x0110,
  41. LCD_SPUT_V_H_TOTAL = 0x0114,
  42. LCD_SPU_V_H_ACTIVE = 0x0118,
  43. LCD_SPU_H_PORCH = 0x011c,
  44. LCD_SPU_V_PORCH = 0x0120,
  45. LCD_SPU_BLANKCOLOR = 0x0124,
  46. LCD_SPU_ALPHA_COLOR1 = 0x0128,
  47. LCD_SPU_ALPHA_COLOR2 = 0x012c,
  48. LCD_SPU_COLORKEY_Y = 0x0130,
  49. LCD_SPU_COLORKEY_U = 0x0134,
  50. LCD_SPU_COLORKEY_V = 0x0138,
  51. LCD_CFG_RDREG4F = 0x013c, /* Armada 510 */
  52. LCD_SPU_SPI_RXDATA = 0x0140,
  53. LCD_SPU_ISA_RXDATA = 0x0144,
  54. LCD_SPU_HWC_RDDAT = 0x0158,
  55. LCD_SPU_GAMMA_RDDAT = 0x015c,
  56. LCD_SPU_PALETTE_RDDAT = 0x0160,
  57. LCD_SPU_IOPAD_IN = 0x0178,
  58. LCD_CFG_RDREG5F = 0x017c,
  59. LCD_SPU_SPI_CTRL = 0x0180,
  60. LCD_SPU_SPI_TXDATA = 0x0184,
  61. LCD_SPU_SMPN_CTRL = 0x0188,
  62. LCD_SPU_DMA_CTRL0 = 0x0190,
  63. LCD_SPU_DMA_CTRL1 = 0x0194,
  64. LCD_SPU_SRAM_CTRL = 0x0198,
  65. LCD_SPU_SRAM_WRDAT = 0x019c,
  66. LCD_SPU_SRAM_PARA0 = 0x01a0, /* Armada 510 */
  67. LCD_SPU_SRAM_PARA1 = 0x01a4,
  68. LCD_CFG_SCLK_DIV = 0x01a8,
  69. LCD_SPU_CONTRAST = 0x01ac,
  70. LCD_SPU_SATURATION = 0x01b0,
  71. LCD_SPU_CBSH_HUE = 0x01b4,
  72. LCD_SPU_DUMB_CTRL = 0x01b8,
  73. LCD_SPU_IOPAD_CONTROL = 0x01bc,
  74. LCD_SPU_IRQ_ENA = 0x01c0,
  75. LCD_SPU_IRQ_ISR = 0x01c4,
  76. };
  77. /* For LCD_SPU_ADV_REG */
  78. enum {
  79. ADV_VSYNC_L_OFF = 0xfff << 20,
  80. ADV_GRACOLORKEY = 1 << 19,
  81. ADV_VIDCOLORKEY = 1 << 18,
  82. ADV_HWC32BLEND = 1 << 15,
  83. ADV_HWC32ARGB = 1 << 14,
  84. ADV_HWC32ENABLE = 1 << 13,
  85. ADV_VSYNCOFFEN = 1 << 12,
  86. ADV_VSYNC_H_OFF = 0xfff << 0,
  87. };
  88. enum {
  89. CFG_565 = 0,
  90. CFG_1555 = 1,
  91. CFG_888PACK = 2,
  92. CFG_X888 = 3,
  93. CFG_8888 = 4,
  94. CFG_422PACK = 5,
  95. CFG_422 = 6,
  96. CFG_420 = 7,
  97. CFG_PSEUDO4 = 9,
  98. CFG_PSEUDO8 = 10,
  99. CFG_SWAPRB = 1 << 4,
  100. CFG_SWAPUV = 1 << 3,
  101. CFG_SWAPYU = 1 << 2,
  102. CFG_YUV2RGB = 1 << 1,
  103. };
  104. /* For LCD_SPU_DMA_CTRL0 */
  105. enum {
  106. CFG_NOBLENDING = 1 << 31,
  107. CFG_GAMMA_ENA = 1 << 30,
  108. CFG_CBSH_ENA = 1 << 29,
  109. CFG_PALETTE_ENA = 1 << 28,
  110. CFG_ARBFAST_ENA = 1 << 27,
  111. CFG_HWC_1BITMOD = 1 << 26,
  112. CFG_HWC_1BITENA = 1 << 25,
  113. CFG_HWC_ENA = 1 << 24,
  114. CFG_DMAFORMAT = 0xf << 20,
  115. #define CFG_DMA_FMT(x) ((x) << 20)
  116. CFG_GRAFORMAT = 0xf << 16,
  117. #define CFG_GRA_FMT(x) ((x) << 16)
  118. #define CFG_GRA_MOD(x) ((x) << 8)
  119. CFG_GRA_FTOGGLE = 1 << 15,
  120. CFG_GRA_HSMOOTH = 1 << 14,
  121. CFG_GRA_TSTMODE = 1 << 13,
  122. CFG_GRA_ENA = 1 << 8,
  123. #define CFG_DMA_MOD(x) ((x) << 0)
  124. CFG_DMA_FTOGGLE = 1 << 7,
  125. CFG_DMA_HSMOOTH = 1 << 6,
  126. CFG_DMA_TSTMODE = 1 << 5,
  127. CFG_DMA_ENA = 1 << 0,
  128. };
  129. enum {
  130. CKMODE_DISABLE = 0,
  131. CKMODE_Y = 1,
  132. CKMODE_U = 2,
  133. CKMODE_RGB = 3,
  134. CKMODE_V = 4,
  135. CKMODE_R = 5,
  136. CKMODE_G = 6,
  137. CKMODE_B = 7,
  138. };
  139. /* For LCD_SPU_DMA_CTRL1 */
  140. enum {
  141. CFG_FRAME_TRIG = 1 << 31,
  142. CFG_VSYNC_INV = 1 << 27,
  143. CFG_CKMODE_MASK = 0x7 << 24,
  144. #define CFG_CKMODE(x) ((x) << 24)
  145. CFG_CARRY = 1 << 23,
  146. CFG_GATED_CLK = 1 << 21,
  147. CFG_PWRDN_ENA = 1 << 20,
  148. CFG_DSCALE_MASK = 0x3 << 18,
  149. CFG_DSCALE_NONE = 0x0 << 18,
  150. CFG_DSCALE_HALF = 0x1 << 18,
  151. CFG_DSCALE_QUAR = 0x2 << 18,
  152. CFG_ALPHAM_MASK = 0x3 << 16,
  153. CFG_ALPHAM_VIDEO = 0x0 << 16,
  154. CFG_ALPHAM_GRA = 0x1 << 16,
  155. CFG_ALPHAM_CFG = 0x2 << 16,
  156. CFG_ALPHA_MASK = 0xff << 8,
  157. #define CFG_ALPHA(x) ((x) << 8)
  158. CFG_PIXCMD_MASK = 0xff,
  159. };
  160. /* For LCD_SPU_SRAM_CTRL */
  161. enum {
  162. SRAM_READ = 0 << 14,
  163. SRAM_WRITE = 2 << 14,
  164. SRAM_INIT = 3 << 14,
  165. SRAM_HWC32_RAM1 = 0xc << 8,
  166. SRAM_HWC32_RAM2 = 0xd << 8,
  167. SRAM_HWC32_RAMR = SRAM_HWC32_RAM1,
  168. SRAM_HWC32_RAMG = SRAM_HWC32_RAM2,
  169. SRAM_HWC32_RAMB = 0xe << 8,
  170. SRAM_HWC32_TRAN = 0xf << 8,
  171. SRAM_HWC = 0xf << 8,
  172. };
  173. /* For LCD_SPU_SRAM_PARA1 */
  174. enum {
  175. CFG_CSB_256x32 = 1 << 15, /* cursor */
  176. CFG_CSB_256x24 = 1 << 14, /* palette */
  177. CFG_CSB_256x8 = 1 << 13, /* gamma */
  178. CFG_PDWN1920x32 = 1 << 8, /* Armada 510: power down vscale ram */
  179. CFG_PDWN256x32 = 1 << 7, /* power down cursor */
  180. CFG_PDWN256x24 = 1 << 6, /* power down palette */
  181. CFG_PDWN256x8 = 1 << 5, /* power down gamma */
  182. CFG_PDWNHWC = 1 << 4, /* Armada 510: power down all hwc ram */
  183. CFG_PDWN32x32 = 1 << 3, /* power down slave->smart ram */
  184. CFG_PDWN16x66 = 1 << 2, /* power down UV fifo */
  185. CFG_PDWN32x66 = 1 << 1, /* power down Y fifo */
  186. CFG_PDWN64x66 = 1 << 0, /* power down graphic fifo */
  187. };
  188. /* For LCD_CFG_SCLK_DIV */
  189. enum {
  190. /* Armada 510 */
  191. SCLK_510_AXI = 0x0 << 30,
  192. SCLK_510_EXTCLK0 = 0x1 << 30,
  193. SCLK_510_PLL = 0x2 << 30,
  194. SCLK_510_EXTCLK1 = 0x3 << 30,
  195. SCLK_510_DIV_CHANGE = 1 << 29,
  196. SCLK_510_FRAC_DIV_MASK = 0xfff << 16,
  197. SCLK_510_INT_DIV_MASK = 0xffff << 0,
  198. /* Armada 16x */
  199. SCLK_16X_AHB = 0x0 << 28,
  200. SCLK_16X_PCLK = 0x1 << 28,
  201. SCLK_16X_AXI = 0x4 << 28,
  202. SCLK_16X_PLL = 0x8 << 28,
  203. SCLK_16X_FRAC_DIV_MASK = 0xfff << 16,
  204. SCLK_16X_INT_DIV_MASK = 0xffff << 0,
  205. };
  206. /* For LCD_SPU_DUMB_CTRL */
  207. enum {
  208. DUMB16_RGB565_0 = 0x0 << 28,
  209. DUMB16_RGB565_1 = 0x1 << 28,
  210. DUMB18_RGB666_0 = 0x2 << 28,
  211. DUMB18_RGB666_1 = 0x3 << 28,
  212. DUMB12_RGB444_0 = 0x4 << 28,
  213. DUMB12_RGB444_1 = 0x5 << 28,
  214. DUMB24_RGB888_0 = 0x6 << 28,
  215. DUMB_BLANK = 0x7 << 28,
  216. DUMB_MASK = 0xf << 28,
  217. CFG_BIAS_OUT = 1 << 8,
  218. CFG_REV_RGB = 1 << 7,
  219. CFG_INV_CBLANK = 1 << 6,
  220. CFG_INV_CSYNC = 1 << 5, /* Normally active high */
  221. CFG_INV_HENA = 1 << 4,
  222. CFG_INV_VSYNC = 1 << 3, /* Normally active high */
  223. CFG_INV_HSYNC = 1 << 2, /* Normally active high */
  224. CFG_INV_PCLK = 1 << 1,
  225. CFG_DUMB_ENA = 1 << 0,
  226. };
  227. /* For LCD_SPU_IOPAD_CONTROL */
  228. enum {
  229. CFG_VSCALE_LN_EN = 3 << 18,
  230. CFG_GRA_VM_ENA = 1 << 15,
  231. CFG_DMA_VM_ENA = 1 << 13,
  232. CFG_CMD_VM_ENA = 1 << 11,
  233. CFG_CSC_MASK = 3 << 8,
  234. CFG_CSC_YUV_CCIR709 = 1 << 9,
  235. CFG_CSC_YUV_CCIR601 = 0 << 9,
  236. CFG_CSC_RGB_STUDIO = 1 << 8,
  237. CFG_CSC_RGB_COMPUTER = 0 << 8,
  238. CFG_IOPAD_MASK = 0xf << 0,
  239. CFG_IOPAD_DUMB24 = 0x0 << 0,
  240. CFG_IOPAD_DUMB18SPI = 0x1 << 0,
  241. CFG_IOPAD_DUMB18GPIO = 0x2 << 0,
  242. CFG_IOPAD_DUMB16SPI = 0x3 << 0,
  243. CFG_IOPAD_DUMB16GPIO = 0x4 << 0,
  244. CFG_IOPAD_DUMB12GPIO = 0x5 << 0,
  245. CFG_IOPAD_SMART18 = 0x6 << 0,
  246. CFG_IOPAD_SMART16 = 0x7 << 0,
  247. CFG_IOPAD_SMART8 = 0x8 << 0,
  248. };
  249. #define IOPAD_DUMB24 0x0
  250. /* For LCD_SPU_IRQ_ENA */
  251. enum {
  252. DMA_FRAME_IRQ0_ENA = 1 << 31,
  253. DMA_FRAME_IRQ1_ENA = 1 << 30,
  254. DMA_FRAME_IRQ_ENA = DMA_FRAME_IRQ0_ENA | DMA_FRAME_IRQ1_ENA,
  255. DMA_FF_UNDERFLOW_ENA = 1 << 29,
  256. GRA_FRAME_IRQ0_ENA = 1 << 27,
  257. GRA_FRAME_IRQ1_ENA = 1 << 26,
  258. GRA_FRAME_IRQ_ENA = GRA_FRAME_IRQ0_ENA | GRA_FRAME_IRQ1_ENA,
  259. GRA_FF_UNDERFLOW_ENA = 1 << 25,
  260. VSYNC_IRQ_ENA = 1 << 23,
  261. DUMB_FRAMEDONE_ENA = 1 << 22,
  262. TWC_FRAMEDONE_ENA = 1 << 21,
  263. HWC_FRAMEDONE_ENA = 1 << 20,
  264. SLV_IRQ_ENA = 1 << 19,
  265. SPI_IRQ_ENA = 1 << 18,
  266. PWRDN_IRQ_ENA = 1 << 17,
  267. ERR_IRQ_ENA = 1 << 16,
  268. CLEAN_SPU_IRQ_ISR = 0xffff,
  269. };
  270. /* For LCD_SPU_IRQ_ISR */
  271. enum {
  272. DMA_FRAME_IRQ0 = 1 << 31,
  273. DMA_FRAME_IRQ1 = 1 << 30,
  274. DMA_FRAME_IRQ = DMA_FRAME_IRQ0 | DMA_FRAME_IRQ1,
  275. DMA_FF_UNDERFLOW = 1 << 29,
  276. GRA_FRAME_IRQ0 = 1 << 27,
  277. GRA_FRAME_IRQ1 = 1 << 26,
  278. GRA_FRAME_IRQ = GRA_FRAME_IRQ0 | GRA_FRAME_IRQ1,
  279. GRA_FF_UNDERFLOW = 1 << 25,
  280. VSYNC_IRQ = 1 << 23,
  281. DUMB_FRAMEDONE = 1 << 22,
  282. TWC_FRAMEDONE = 1 << 21,
  283. HWC_FRAMEDONE = 1 << 20,
  284. SLV_IRQ = 1 << 19,
  285. SPI_IRQ = 1 << 18,
  286. PWRDN_IRQ = 1 << 17,
  287. ERR_IRQ = 1 << 16,
  288. DMA_FRAME_IRQ0_LEVEL = 1 << 15,
  289. DMA_FRAME_IRQ1_LEVEL = 1 << 14,
  290. DMA_FRAME_CNT_ISR = 3 << 12,
  291. GRA_FRAME_IRQ0_LEVEL = 1 << 11,
  292. GRA_FRAME_IRQ1_LEVEL = 1 << 10,
  293. GRA_FRAME_CNT_ISR = 3 << 8,
  294. VSYNC_IRQ_LEVEL = 1 << 7,
  295. DUMB_FRAMEDONE_LEVEL = 1 << 6,
  296. TWC_FRAMEDONE_LEVEL = 1 << 5,
  297. HWC_FRAMEDONE_LEVEL = 1 << 4,
  298. SLV_FF_EMPTY = 1 << 3,
  299. DMA_FF_ALLEMPTY = 1 << 2,
  300. GRA_FF_ALLEMPTY = 1 << 1,
  301. PWRDN_IRQ_LEVEL = 1 << 0,
  302. };
  303. #endif