vc4_regs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * Copyright © 2014-2015 Broadcom
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef VC4_REGS_H
  9. #define VC4_REGS_H
  10. #include <linux/bitops.h>
  11. #define VC4_MASK(high, low) ((u32)GENMASK(high, low))
  12. /* Using the GNU statement expression extension */
  13. #define VC4_SET_FIELD(value, field) \
  14. ({ \
  15. uint32_t fieldval = (value) << field##_SHIFT; \
  16. WARN_ON((fieldval & ~field##_MASK) != 0); \
  17. fieldval & field##_MASK; \
  18. })
  19. #define VC4_GET_FIELD(word, field) (((word) & field##_MASK) >> \
  20. field##_SHIFT)
  21. #define V3D_IDENT0 0x00000
  22. # define V3D_EXPECTED_IDENT0 \
  23. ((2 << 24) | \
  24. ('V' << 0) | \
  25. ('3' << 8) | \
  26. ('D' << 16))
  27. #define V3D_IDENT1 0x00004
  28. /* Multiples of 1kb */
  29. # define V3D_IDENT1_VPM_SIZE_MASK VC4_MASK(31, 28)
  30. # define V3D_IDENT1_VPM_SIZE_SHIFT 28
  31. # define V3D_IDENT1_NSEM_MASK VC4_MASK(23, 16)
  32. # define V3D_IDENT1_NSEM_SHIFT 16
  33. # define V3D_IDENT1_TUPS_MASK VC4_MASK(15, 12)
  34. # define V3D_IDENT1_TUPS_SHIFT 12
  35. # define V3D_IDENT1_QUPS_MASK VC4_MASK(11, 8)
  36. # define V3D_IDENT1_QUPS_SHIFT 8
  37. # define V3D_IDENT1_NSLC_MASK VC4_MASK(7, 4)
  38. # define V3D_IDENT1_NSLC_SHIFT 4
  39. # define V3D_IDENT1_REV_MASK VC4_MASK(3, 0)
  40. # define V3D_IDENT1_REV_SHIFT 0
  41. #define V3D_IDENT2 0x00008
  42. #define V3D_SCRATCH 0x00010
  43. #define V3D_L2CACTL 0x00020
  44. # define V3D_L2CACTL_L2CCLR BIT(2)
  45. # define V3D_L2CACTL_L2CDIS BIT(1)
  46. # define V3D_L2CACTL_L2CENA BIT(0)
  47. #define V3D_SLCACTL 0x00024
  48. # define V3D_SLCACTL_T1CC_MASK VC4_MASK(27, 24)
  49. # define V3D_SLCACTL_T1CC_SHIFT 24
  50. # define V3D_SLCACTL_T0CC_MASK VC4_MASK(19, 16)
  51. # define V3D_SLCACTL_T0CC_SHIFT 16
  52. # define V3D_SLCACTL_UCC_MASK VC4_MASK(11, 8)
  53. # define V3D_SLCACTL_UCC_SHIFT 8
  54. # define V3D_SLCACTL_ICC_MASK VC4_MASK(3, 0)
  55. # define V3D_SLCACTL_ICC_SHIFT 0
  56. #define V3D_INTCTL 0x00030
  57. #define V3D_INTENA 0x00034
  58. #define V3D_INTDIS 0x00038
  59. # define V3D_INT_SPILLUSE BIT(3)
  60. # define V3D_INT_OUTOMEM BIT(2)
  61. # define V3D_INT_FLDONE BIT(1)
  62. # define V3D_INT_FRDONE BIT(0)
  63. #define V3D_CT0CS 0x00100
  64. #define V3D_CT1CS 0x00104
  65. #define V3D_CTNCS(n) (V3D_CT0CS + 4 * n)
  66. # define V3D_CTRSTA BIT(15)
  67. # define V3D_CTSEMA BIT(12)
  68. # define V3D_CTRTSD BIT(8)
  69. # define V3D_CTRUN BIT(5)
  70. # define V3D_CTSUBS BIT(4)
  71. # define V3D_CTERR BIT(3)
  72. # define V3D_CTMODE BIT(0)
  73. #define V3D_CT0EA 0x00108
  74. #define V3D_CT1EA 0x0010c
  75. #define V3D_CTNEA(n) (V3D_CT0EA + 4 * (n))
  76. #define V3D_CT0CA 0x00110
  77. #define V3D_CT1CA 0x00114
  78. #define V3D_CTNCA(n) (V3D_CT0CA + 4 * (n))
  79. #define V3D_CT00RA0 0x00118
  80. #define V3D_CT01RA0 0x0011c
  81. #define V3D_CTNRA0(n) (V3D_CT00RA0 + 4 * (n))
  82. #define V3D_CT0LC 0x00120
  83. #define V3D_CT1LC 0x00124
  84. #define V3D_CTNLC(n) (V3D_CT0LC + 4 * (n))
  85. #define V3D_CT0PC 0x00128
  86. #define V3D_CT1PC 0x0012c
  87. #define V3D_CTNPC(n) (V3D_CT0PC + 4 * (n))
  88. #define V3D_PCS 0x00130
  89. # define V3D_BMOOM BIT(8)
  90. # define V3D_RMBUSY BIT(3)
  91. # define V3D_RMACTIVE BIT(2)
  92. # define V3D_BMBUSY BIT(1)
  93. # define V3D_BMACTIVE BIT(0)
  94. #define V3D_BFC 0x00134
  95. #define V3D_RFC 0x00138
  96. #define V3D_BPCA 0x00300
  97. #define V3D_BPCS 0x00304
  98. #define V3D_BPOA 0x00308
  99. #define V3D_BPOS 0x0030c
  100. #define V3D_BXCF 0x00310
  101. #define V3D_SQRSV0 0x00410
  102. #define V3D_SQRSV1 0x00414
  103. #define V3D_SQCNTL 0x00418
  104. #define V3D_SRQPC 0x00430
  105. #define V3D_SRQUA 0x00434
  106. #define V3D_SRQUL 0x00438
  107. #define V3D_SRQCS 0x0043c
  108. #define V3D_VPACNTL 0x00500
  109. #define V3D_VPMBASE 0x00504
  110. #define V3D_PCTRC 0x00670
  111. #define V3D_PCTRE 0x00674
  112. #define V3D_PCTR0 0x00680
  113. #define V3D_PCTRS0 0x00684
  114. #define V3D_PCTR1 0x00688
  115. #define V3D_PCTRS1 0x0068c
  116. #define V3D_PCTR2 0x00690
  117. #define V3D_PCTRS2 0x00694
  118. #define V3D_PCTR3 0x00698
  119. #define V3D_PCTRS3 0x0069c
  120. #define V3D_PCTR4 0x006a0
  121. #define V3D_PCTRS4 0x006a4
  122. #define V3D_PCTR5 0x006a8
  123. #define V3D_PCTRS5 0x006ac
  124. #define V3D_PCTR6 0x006b0
  125. #define V3D_PCTRS6 0x006b4
  126. #define V3D_PCTR7 0x006b8
  127. #define V3D_PCTRS7 0x006bc
  128. #define V3D_PCTR8 0x006c0
  129. #define V3D_PCTRS8 0x006c4
  130. #define V3D_PCTR9 0x006c8
  131. #define V3D_PCTRS9 0x006cc
  132. #define V3D_PCTR10 0x006d0
  133. #define V3D_PCTRS10 0x006d4
  134. #define V3D_PCTR11 0x006d8
  135. #define V3D_PCTRS11 0x006dc
  136. #define V3D_PCTR12 0x006e0
  137. #define V3D_PCTRS12 0x006e4
  138. #define V3D_PCTR13 0x006e8
  139. #define V3D_PCTRS13 0x006ec
  140. #define V3D_PCTR14 0x006f0
  141. #define V3D_PCTRS14 0x006f4
  142. #define V3D_PCTR15 0x006f8
  143. #define V3D_PCTRS15 0x006fc
  144. #define V3D_BGE 0x00f00
  145. #define V3D_FDBGO 0x00f04
  146. #define V3D_FDBGB 0x00f08
  147. #define V3D_FDBGR 0x00f0c
  148. #define V3D_FDBGS 0x00f10
  149. #define V3D_ERRSTAT 0x00f20
  150. #define PV_CONTROL 0x00
  151. # define PV_CONTROL_FORMAT_MASK VC4_MASK(23, 21)
  152. # define PV_CONTROL_FORMAT_SHIFT 21
  153. # define PV_CONTROL_FORMAT_24 0
  154. # define PV_CONTROL_FORMAT_DSIV_16 1
  155. # define PV_CONTROL_FORMAT_DSIC_16 2
  156. # define PV_CONTROL_FORMAT_DSIV_18 3
  157. # define PV_CONTROL_FORMAT_DSIV_24 4
  158. # define PV_CONTROL_FIFO_LEVEL_MASK VC4_MASK(20, 15)
  159. # define PV_CONTROL_FIFO_LEVEL_SHIFT 15
  160. # define PV_CONTROL_CLR_AT_START BIT(14)
  161. # define PV_CONTROL_TRIGGER_UNDERFLOW BIT(13)
  162. # define PV_CONTROL_WAIT_HSTART BIT(12)
  163. # define PV_CONTROL_CLK_SELECT_DSI_VEC 0
  164. # define PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI 1
  165. # define PV_CONTROL_CLK_SELECT_MASK VC4_MASK(3, 2)
  166. # define PV_CONTROL_CLK_SELECT_SHIFT 2
  167. # define PV_CONTROL_FIFO_CLR BIT(1)
  168. # define PV_CONTROL_EN BIT(0)
  169. #define PV_V_CONTROL 0x04
  170. # define PV_VCONTROL_INTERLACE BIT(4)
  171. # define PV_VCONTROL_CONTINUOUS BIT(1)
  172. # define PV_VCONTROL_VIDEN BIT(0)
  173. #define PV_VSYNCD 0x08
  174. #define PV_HORZA 0x0c
  175. # define PV_HORZA_HBP_MASK VC4_MASK(31, 16)
  176. # define PV_HORZA_HBP_SHIFT 16
  177. # define PV_HORZA_HSYNC_MASK VC4_MASK(15, 0)
  178. # define PV_HORZA_HSYNC_SHIFT 0
  179. #define PV_HORZB 0x10
  180. # define PV_HORZB_HFP_MASK VC4_MASK(31, 16)
  181. # define PV_HORZB_HFP_SHIFT 16
  182. # define PV_HORZB_HACTIVE_MASK VC4_MASK(15, 0)
  183. # define PV_HORZB_HACTIVE_SHIFT 0
  184. #define PV_VERTA 0x14
  185. # define PV_VERTA_VBP_MASK VC4_MASK(31, 16)
  186. # define PV_VERTA_VBP_SHIFT 16
  187. # define PV_VERTA_VSYNC_MASK VC4_MASK(15, 0)
  188. # define PV_VERTA_VSYNC_SHIFT 0
  189. #define PV_VERTB 0x18
  190. # define PV_VERTB_VFP_MASK VC4_MASK(31, 16)
  191. # define PV_VERTB_VFP_SHIFT 16
  192. # define PV_VERTB_VACTIVE_MASK VC4_MASK(15, 0)
  193. # define PV_VERTB_VACTIVE_SHIFT 0
  194. #define PV_VERTA_EVEN 0x1c
  195. #define PV_VERTB_EVEN 0x20
  196. #define PV_INTEN 0x24
  197. #define PV_INTSTAT 0x28
  198. # define PV_INT_VID_IDLE BIT(9)
  199. # define PV_INT_VFP_END BIT(8)
  200. # define PV_INT_VFP_START BIT(7)
  201. # define PV_INT_VACT_START BIT(6)
  202. # define PV_INT_VBP_START BIT(5)
  203. # define PV_INT_VSYNC_START BIT(4)
  204. # define PV_INT_HFP_START BIT(3)
  205. # define PV_INT_HACT_START BIT(2)
  206. # define PV_INT_HBP_START BIT(1)
  207. # define PV_INT_HSYNC_START BIT(0)
  208. #define PV_STAT 0x2c
  209. #define PV_HACT_ACT 0x30
  210. #define SCALER_DISPCTRL 0x00000000
  211. /* Global register for clock gating the HVS */
  212. # define SCALER_DISPCTRL_ENABLE BIT(31)
  213. # define SCALER_DISPCTRL_DSP2EISLUR BIT(15)
  214. # define SCALER_DISPCTRL_DSP1EISLUR BIT(14)
  215. /* Enables Display 0 short line and underrun contribution to
  216. * SCALER_DISPSTAT_IRQDISP0. Note that short frame contributions are
  217. * always enabled.
  218. */
  219. # define SCALER_DISPCTRL_DSP0EISLUR BIT(13)
  220. # define SCALER_DISPCTRL_DSP2EIEOLN BIT(12)
  221. # define SCALER_DISPCTRL_DSP2EIEOF BIT(11)
  222. # define SCALER_DISPCTRL_DSP1EIEOLN BIT(10)
  223. # define SCALER_DISPCTRL_DSP1EIEOF BIT(9)
  224. /* Enables Display 0 end-of-line-N contribution to
  225. * SCALER_DISPSTAT_IRQDISP0
  226. */
  227. # define SCALER_DISPCTRL_DSP0EIEOLN BIT(8)
  228. /* Enables Display 0 EOF contribution to SCALER_DISPSTAT_IRQDISP0 */
  229. # define SCALER_DISPCTRL_DSP0EIEOF BIT(7)
  230. # define SCALER_DISPCTRL_SLVRDEIRQ BIT(6)
  231. # define SCALER_DISPCTRL_SLVWREIRQ BIT(5)
  232. # define SCALER_DISPCTRL_DMAEIRQ BIT(4)
  233. # define SCALER_DISPCTRL_DISP2EIRQ BIT(3)
  234. # define SCALER_DISPCTRL_DISP1EIRQ BIT(2)
  235. /* Enables interrupt generation on the enabled EOF/EOLN/EISLUR
  236. * bits and short frames..
  237. */
  238. # define SCALER_DISPCTRL_DISP0EIRQ BIT(1)
  239. /* Enables interrupt generation on scaler profiler interrupt. */
  240. # define SCALER_DISPCTRL_SCLEIRQ BIT(0)
  241. #define SCALER_DISPSTAT 0x00000004
  242. # define SCALER_DISPSTAT_COBLOW2 BIT(29)
  243. # define SCALER_DISPSTAT_EOLN2 BIT(28)
  244. # define SCALER_DISPSTAT_ESFRAME2 BIT(27)
  245. # define SCALER_DISPSTAT_ESLINE2 BIT(26)
  246. # define SCALER_DISPSTAT_EUFLOW2 BIT(25)
  247. # define SCALER_DISPSTAT_EOF2 BIT(24)
  248. # define SCALER_DISPSTAT_COBLOW1 BIT(21)
  249. # define SCALER_DISPSTAT_EOLN1 BIT(20)
  250. # define SCALER_DISPSTAT_ESFRAME1 BIT(19)
  251. # define SCALER_DISPSTAT_ESLINE1 BIT(18)
  252. # define SCALER_DISPSTAT_EUFLOW1 BIT(17)
  253. # define SCALER_DISPSTAT_EOF1 BIT(16)
  254. # define SCALER_DISPSTAT_RESP_MASK VC4_MASK(15, 14)
  255. # define SCALER_DISPSTAT_RESP_SHIFT 14
  256. # define SCALER_DISPSTAT_RESP_OKAY 0
  257. # define SCALER_DISPSTAT_RESP_EXOKAY 1
  258. # define SCALER_DISPSTAT_RESP_SLVERR 2
  259. # define SCALER_DISPSTAT_RESP_DECERR 3
  260. # define SCALER_DISPSTAT_COBLOW0 BIT(13)
  261. /* Set when the DISPEOLN line is done compositing. */
  262. # define SCALER_DISPSTAT_EOLN0 BIT(12)
  263. /* Set when VSTART is seen but there are still pixels in the current
  264. * output line.
  265. */
  266. # define SCALER_DISPSTAT_ESFRAME0 BIT(11)
  267. /* Set when HSTART is seen but there are still pixels in the current
  268. * output line.
  269. */
  270. # define SCALER_DISPSTAT_ESLINE0 BIT(10)
  271. /* Set when the the downstream tries to read from the display FIFO
  272. * while it's empty.
  273. */
  274. # define SCALER_DISPSTAT_EUFLOW0 BIT(9)
  275. /* Set when the display mode changes from RUN to EOF */
  276. # define SCALER_DISPSTAT_EOF0 BIT(8)
  277. /* Set on AXI invalid DMA ID error. */
  278. # define SCALER_DISPSTAT_DMA_ERROR BIT(7)
  279. /* Set on AXI slave read decode error */
  280. # define SCALER_DISPSTAT_IRQSLVRD BIT(6)
  281. /* Set on AXI slave write decode error */
  282. # define SCALER_DISPSTAT_IRQSLVWR BIT(5)
  283. /* Set when SCALER_DISPSTAT_DMA_ERROR is set, or
  284. * SCALER_DISPSTAT_RESP_ERROR is not SCALER_DISPSTAT_RESP_OKAY.
  285. */
  286. # define SCALER_DISPSTAT_IRQDMA BIT(4)
  287. # define SCALER_DISPSTAT_IRQDISP2 BIT(3)
  288. # define SCALER_DISPSTAT_IRQDISP1 BIT(2)
  289. /* Set when any of the EOF/EOLN/ESFRAME/ESLINE bits are set and their
  290. * corresponding interrupt bit is enabled in DISPCTRL.
  291. */
  292. # define SCALER_DISPSTAT_IRQDISP0 BIT(1)
  293. /* On read, the profiler interrupt. On write, clear *all* interrupt bits. */
  294. # define SCALER_DISPSTAT_IRQSCL BIT(0)
  295. #define SCALER_DISPID 0x00000008
  296. #define SCALER_DISPECTRL 0x0000000c
  297. #define SCALER_DISPPROF 0x00000010
  298. #define SCALER_DISPDITHER 0x00000014
  299. #define SCALER_DISPEOLN 0x00000018
  300. #define SCALER_DISPLIST0 0x00000020
  301. #define SCALER_DISPLIST1 0x00000024
  302. #define SCALER_DISPLIST2 0x00000028
  303. #define SCALER_DISPLSTAT 0x0000002c
  304. #define SCALER_DISPLISTX(x) (SCALER_DISPLIST0 + \
  305. (x) * (SCALER_DISPLIST1 - \
  306. SCALER_DISPLIST0))
  307. #define SCALER_DISPLACT0 0x00000030
  308. #define SCALER_DISPLACT1 0x00000034
  309. #define SCALER_DISPLACT2 0x00000038
  310. #define SCALER_DISPCTRL0 0x00000040
  311. # define SCALER_DISPCTRLX_ENABLE BIT(31)
  312. # define SCALER_DISPCTRLX_RESET BIT(30)
  313. # define SCALER_DISPCTRLX_WIDTH_MASK VC4_MASK(23, 12)
  314. # define SCALER_DISPCTRLX_WIDTH_SHIFT 12
  315. # define SCALER_DISPCTRLX_HEIGHT_MASK VC4_MASK(11, 0)
  316. # define SCALER_DISPCTRLX_HEIGHT_SHIFT 0
  317. #define SCALER_DISPBKGND0 0x00000044
  318. #define SCALER_DISPSTAT0 0x00000048
  319. #define SCALER_DISPBASE0 0x0000004c
  320. # define SCALER_DISPSTATX_MODE_MASK VC4_MASK(31, 30)
  321. # define SCALER_DISPSTATX_MODE_SHIFT 30
  322. # define SCALER_DISPSTATX_MODE_DISABLED 0
  323. # define SCALER_DISPSTATX_MODE_INIT 1
  324. # define SCALER_DISPSTATX_MODE_RUN 2
  325. # define SCALER_DISPSTATX_MODE_EOF 3
  326. # define SCALER_DISPSTATX_FULL BIT(29)
  327. # define SCALER_DISPSTATX_EMPTY BIT(28)
  328. #define SCALER_DISPCTRL1 0x00000050
  329. #define SCALER_DISPBKGND1 0x00000054
  330. #define SCALER_DISPSTAT1 0x00000058
  331. #define SCALER_DISPSTATX(x) (SCALER_DISPSTAT0 + \
  332. (x) * (SCALER_DISPSTAT1 - \
  333. SCALER_DISPSTAT0))
  334. #define SCALER_DISPBASE1 0x0000005c
  335. #define SCALER_DISPCTRL2 0x00000060
  336. #define SCALER_DISPCTRLX(x) (SCALER_DISPCTRL0 + \
  337. (x) * (SCALER_DISPCTRL1 - \
  338. SCALER_DISPCTRL0))
  339. #define SCALER_DISPBKGND2 0x00000064
  340. #define SCALER_DISPSTAT2 0x00000068
  341. #define SCALER_DISPBASE2 0x0000006c
  342. #define SCALER_DISPALPHA2 0x00000070
  343. #define SCALER_GAMADDR 0x00000078
  344. #define SCALER_GAMDATA 0x000000e0
  345. #define SCALER_DLIST_START 0x00002000
  346. #define SCALER_DLIST_SIZE 0x00004000
  347. #define VC4_HDMI_CORE_REV 0x000
  348. #define VC4_HDMI_SW_RESET_CONTROL 0x004
  349. # define VC4_HDMI_SW_RESET_FORMAT_DETECT BIT(1)
  350. # define VC4_HDMI_SW_RESET_HDMI BIT(0)
  351. #define VC4_HDMI_HOTPLUG_INT 0x008
  352. #define VC4_HDMI_HOTPLUG 0x00c
  353. # define VC4_HDMI_HOTPLUG_CONNECTED BIT(0)
  354. #define VC4_HDMI_RAM_PACKET_CONFIG 0x0a0
  355. # define VC4_HDMI_RAM_PACKET_ENABLE BIT(16)
  356. #define VC4_HDMI_HORZA 0x0c4
  357. # define VC4_HDMI_HORZA_VPOS BIT(14)
  358. # define VC4_HDMI_HORZA_HPOS BIT(13)
  359. /* Horizontal active pixels (hdisplay). */
  360. # define VC4_HDMI_HORZA_HAP_MASK VC4_MASK(12, 0)
  361. # define VC4_HDMI_HORZA_HAP_SHIFT 0
  362. #define VC4_HDMI_HORZB 0x0c8
  363. /* Horizontal pack porch (htotal - hsync_end). */
  364. # define VC4_HDMI_HORZB_HBP_MASK VC4_MASK(29, 20)
  365. # define VC4_HDMI_HORZB_HBP_SHIFT 20
  366. /* Horizontal sync pulse (hsync_end - hsync_start). */
  367. # define VC4_HDMI_HORZB_HSP_MASK VC4_MASK(19, 10)
  368. # define VC4_HDMI_HORZB_HSP_SHIFT 10
  369. /* Horizontal front porch (hsync_start - hdisplay). */
  370. # define VC4_HDMI_HORZB_HFP_MASK VC4_MASK(9, 0)
  371. # define VC4_HDMI_HORZB_HFP_SHIFT 0
  372. #define VC4_HDMI_FIFO_CTL 0x05c
  373. # define VC4_HDMI_FIFO_CTL_RECENTER_DONE BIT(14)
  374. # define VC4_HDMI_FIFO_CTL_USE_EMPTY BIT(13)
  375. # define VC4_HDMI_FIFO_CTL_ON_VB BIT(7)
  376. # define VC4_HDMI_FIFO_CTL_RECENTER BIT(6)
  377. # define VC4_HDMI_FIFO_CTL_FIFO_RESET BIT(5)
  378. # define VC4_HDMI_FIFO_CTL_USE_PLL_LOCK BIT(4)
  379. # define VC4_HDMI_FIFO_CTL_INV_CLK_XFR BIT(3)
  380. # define VC4_HDMI_FIFO_CTL_CAPTURE_PTR BIT(2)
  381. # define VC4_HDMI_FIFO_CTL_USE_FULL BIT(1)
  382. # define VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N BIT(0)
  383. # define VC4_HDMI_FIFO_VALID_WRITE_MASK 0xefff
  384. #define VC4_HDMI_SCHEDULER_CONTROL 0x0c0
  385. # define VC4_HDMI_SCHEDULER_CONTROL_MANUAL_FORMAT BIT(15)
  386. # define VC4_HDMI_SCHEDULER_CONTROL_IGNORE_VSYNC_PREDICTS BIT(5)
  387. # define VC4_HDMI_SCHEDULER_CONTROL_VERT_ALWAYS_KEEPOUT BIT(3)
  388. # define VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE BIT(1)
  389. # define VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI BIT(0)
  390. #define VC4_HDMI_VERTA0 0x0cc
  391. #define VC4_HDMI_VERTA1 0x0d4
  392. /* Vertical sync pulse (vsync_end - vsync_start). */
  393. # define VC4_HDMI_VERTA_VSP_MASK VC4_MASK(24, 20)
  394. # define VC4_HDMI_VERTA_VSP_SHIFT 20
  395. /* Vertical front porch (vsync_start - vdisplay). */
  396. # define VC4_HDMI_VERTA_VFP_MASK VC4_MASK(19, 13)
  397. # define VC4_HDMI_VERTA_VFP_SHIFT 13
  398. /* Vertical active lines (vdisplay). */
  399. # define VC4_HDMI_VERTA_VAL_MASK VC4_MASK(12, 0)
  400. # define VC4_HDMI_VERTA_VAL_SHIFT 0
  401. #define VC4_HDMI_VERTB0 0x0d0
  402. #define VC4_HDMI_VERTB1 0x0d8
  403. /* Vertical sync pulse offset (for interlaced) */
  404. # define VC4_HDMI_VERTB_VSPO_MASK VC4_MASK(21, 9)
  405. # define VC4_HDMI_VERTB_VSPO_SHIFT 9
  406. /* Vertical pack porch (vtotal - vsync_end). */
  407. # define VC4_HDMI_VERTB_VBP_MASK VC4_MASK(8, 0)
  408. # define VC4_HDMI_VERTB_VBP_SHIFT 0
  409. #define VC4_HDMI_TX_PHY_RESET_CTL 0x2c0
  410. #define VC4_HD_M_CTL 0x00c
  411. # define VC4_HD_M_SW_RST BIT(2)
  412. # define VC4_HD_M_ENABLE BIT(0)
  413. #define VC4_HD_MAI_CTL 0x014
  414. #define VC4_HD_VID_CTL 0x038
  415. # define VC4_HD_VID_CTL_ENABLE BIT(31)
  416. # define VC4_HD_VID_CTL_UNDERFLOW_ENABLE BIT(30)
  417. # define VC4_HD_VID_CTL_FRAME_COUNTER_RESET BIT(29)
  418. # define VC4_HD_VID_CTL_VSYNC_LOW BIT(28)
  419. # define VC4_HD_VID_CTL_HSYNC_LOW BIT(27)
  420. #define VC4_HD_CSC_CTL 0x040
  421. # define VC4_HD_CSC_CTL_ORDER_MASK VC4_MASK(7, 5)
  422. # define VC4_HD_CSC_CTL_ORDER_SHIFT 5
  423. # define VC4_HD_CSC_CTL_ORDER_RGB 0
  424. # define VC4_HD_CSC_CTL_ORDER_BGR 1
  425. # define VC4_HD_CSC_CTL_ORDER_BRG 2
  426. # define VC4_HD_CSC_CTL_ORDER_GRB 3
  427. # define VC4_HD_CSC_CTL_ORDER_GBR 4
  428. # define VC4_HD_CSC_CTL_ORDER_RBG 5
  429. # define VC4_HD_CSC_CTL_PADMSB BIT(4)
  430. # define VC4_HD_CSC_CTL_MODE_MASK VC4_MASK(3, 2)
  431. # define VC4_HD_CSC_CTL_MODE_SHIFT 2
  432. # define VC4_HD_CSC_CTL_MODE_RGB_TO_SD_YPRPB 0
  433. # define VC4_HD_CSC_CTL_MODE_RGB_TO_HD_YPRPB 1
  434. # define VC4_HD_CSC_CTL_MODE_CUSTOM 2
  435. # define VC4_HD_CSC_CTL_RGB2YCC BIT(1)
  436. # define VC4_HD_CSC_CTL_ENABLE BIT(0)
  437. #define VC4_HD_FRAME_COUNT 0x068
  438. /* HVS display list information. */
  439. #define HVS_BOOTLOADER_DLIST_END 32
  440. enum hvs_pixel_format {
  441. /* 8bpp */
  442. HVS_PIXEL_FORMAT_RGB332 = 0,
  443. /* 16bpp */
  444. HVS_PIXEL_FORMAT_RGBA4444 = 1,
  445. HVS_PIXEL_FORMAT_RGB555 = 2,
  446. HVS_PIXEL_FORMAT_RGBA5551 = 3,
  447. HVS_PIXEL_FORMAT_RGB565 = 4,
  448. /* 24bpp */
  449. HVS_PIXEL_FORMAT_RGB888 = 5,
  450. HVS_PIXEL_FORMAT_RGBA6666 = 6,
  451. /* 32bpp */
  452. HVS_PIXEL_FORMAT_RGBA8888 = 7
  453. };
  454. /* Note: the LSB is the rightmost character shown. Only valid for
  455. * HVS_PIXEL_FORMAT_RGB8888, not RGB888.
  456. */
  457. #define HVS_PIXEL_ORDER_RGBA 0
  458. #define HVS_PIXEL_ORDER_BGRA 1
  459. #define HVS_PIXEL_ORDER_ARGB 2
  460. #define HVS_PIXEL_ORDER_ABGR 3
  461. #define HVS_PIXEL_ORDER_XBRG 0
  462. #define HVS_PIXEL_ORDER_XRBG 1
  463. #define HVS_PIXEL_ORDER_XRGB 2
  464. #define HVS_PIXEL_ORDER_XBGR 3
  465. #define HVS_PIXEL_ORDER_XYCBCR 0
  466. #define HVS_PIXEL_ORDER_XYCRCB 1
  467. #define HVS_PIXEL_ORDER_YXCBCR 2
  468. #define HVS_PIXEL_ORDER_YXCRCB 3
  469. #define SCALER_CTL0_END BIT(31)
  470. #define SCALER_CTL0_VALID BIT(30)
  471. #define SCALER_CTL0_SIZE_MASK VC4_MASK(29, 24)
  472. #define SCALER_CTL0_SIZE_SHIFT 24
  473. #define SCALER_CTL0_HFLIP BIT(16)
  474. #define SCALER_CTL0_VFLIP BIT(15)
  475. #define SCALER_CTL0_ORDER_MASK VC4_MASK(14, 13)
  476. #define SCALER_CTL0_ORDER_SHIFT 13
  477. /* Set to indicate no scaling. */
  478. #define SCALER_CTL0_UNITY BIT(4)
  479. #define SCALER_CTL0_PIXEL_FORMAT_MASK VC4_MASK(3, 0)
  480. #define SCALER_CTL0_PIXEL_FORMAT_SHIFT 0
  481. #define SCALER_POS0_FIXED_ALPHA_MASK VC4_MASK(31, 24)
  482. #define SCALER_POS0_FIXED_ALPHA_SHIFT 24
  483. #define SCALER_POS0_START_Y_MASK VC4_MASK(23, 12)
  484. #define SCALER_POS0_START_Y_SHIFT 12
  485. #define SCALER_POS0_START_X_MASK VC4_MASK(11, 0)
  486. #define SCALER_POS0_START_X_SHIFT 0
  487. #define SCALER_POS2_ALPHA_MODE_MASK VC4_MASK(31, 30)
  488. #define SCALER_POS2_ALPHA_MODE_SHIFT 30
  489. #define SCALER_POS2_ALPHA_MODE_PIPELINE 0
  490. #define SCALER_POS2_ALPHA_MODE_FIXED 1
  491. #define SCALER_POS2_ALPHA_MODE_FIXED_NONZERO 2
  492. #define SCALER_POS2_ALPHA_MODE_FIXED_OVER_0x07 3
  493. #define SCALER_POS2_HEIGHT_MASK VC4_MASK(27, 16)
  494. #define SCALER_POS2_HEIGHT_SHIFT 16
  495. #define SCALER_POS2_WIDTH_MASK VC4_MASK(11, 0)
  496. #define SCALER_POS2_WIDTH_SHIFT 0
  497. #define SCALER_SRC_PITCH_MASK VC4_MASK(15, 0)
  498. #define SCALER_SRC_PITCH_SHIFT 0
  499. #endif /* VC4_REGS_H */