malidp_regs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
  4. * Author: Liviu Dudau <Liviu.Dudau@arm.com>
  5. *
  6. * ARM Mali DP500/DP550/DP650 registers definition.
  7. */
  8. #ifndef __MALIDP_REGS_H__
  9. #define __MALIDP_REGS_H__
  10. /*
  11. * abbreviations used:
  12. * - DC - display core (general settings)
  13. * - DE - display engine
  14. * - SE - scaling engine
  15. */
  16. /* interrupt bit masks */
  17. #define MALIDP_DE_IRQ_UNDERRUN (1 << 0)
  18. #define MALIDP500_DE_IRQ_AXI_ERR (1 << 4)
  19. #define MALIDP500_DE_IRQ_VSYNC (1 << 5)
  20. #define MALIDP500_DE_IRQ_PROG_LINE (1 << 6)
  21. #define MALIDP500_DE_IRQ_SATURATION (1 << 7)
  22. #define MALIDP500_DE_IRQ_CONF_VALID (1 << 8)
  23. #define MALIDP500_DE_IRQ_CONF_MODE (1 << 11)
  24. #define MALIDP500_DE_IRQ_CONF_ACTIVE (1 << 17)
  25. #define MALIDP500_DE_IRQ_PM_ACTIVE (1 << 18)
  26. #define MALIDP500_DE_IRQ_TESTMODE_ACTIVE (1 << 19)
  27. #define MALIDP500_DE_IRQ_FORCE_BLNK_ACTIVE (1 << 24)
  28. #define MALIDP500_DE_IRQ_AXI_BUSY (1 << 28)
  29. #define MALIDP500_DE_IRQ_GLOBAL (1 << 31)
  30. #define MALIDP500_SE_IRQ_CONF_MODE (1 << 0)
  31. #define MALIDP500_SE_IRQ_CONF_VALID (1 << 4)
  32. #define MALIDP500_SE_IRQ_INIT_BUSY (1 << 5)
  33. #define MALIDP500_SE_IRQ_AXI_ERROR (1 << 8)
  34. #define MALIDP500_SE_IRQ_OVERRUN (1 << 9)
  35. #define MALIDP500_SE_IRQ_PROG_LINE1 (1 << 12)
  36. #define MALIDP500_SE_IRQ_PROG_LINE2 (1 << 13)
  37. #define MALIDP500_SE_IRQ_CONF_ACTIVE (1 << 17)
  38. #define MALIDP500_SE_IRQ_PM_ACTIVE (1 << 18)
  39. #define MALIDP500_SE_IRQ_AXI_BUSY (1 << 28)
  40. #define MALIDP500_SE_IRQ_GLOBAL (1 << 31)
  41. #define MALIDP550_DE_IRQ_SATURATION (1 << 8)
  42. #define MALIDP550_DE_IRQ_VSYNC (1 << 12)
  43. #define MALIDP550_DE_IRQ_PROG_LINE (1 << 13)
  44. #define MALIDP550_DE_IRQ_AXI_ERR (1 << 16)
  45. #define MALIDP550_SE_IRQ_EOW (1 << 0)
  46. #define MALIDP550_SE_IRQ_AXI_ERR (1 << 16)
  47. #define MALIDP550_SE_IRQ_OVR (1 << 17)
  48. #define MALIDP550_SE_IRQ_IBSY (1 << 18)
  49. #define MALIDP550_DC_IRQ_CONF_VALID (1 << 0)
  50. #define MALIDP550_DC_IRQ_CONF_MODE (1 << 4)
  51. #define MALIDP550_DC_IRQ_CONF_ACTIVE (1 << 16)
  52. #define MALIDP550_DC_IRQ_DE (1 << 20)
  53. #define MALIDP550_DC_IRQ_SE (1 << 24)
  54. #define MALIDP650_DE_IRQ_DRIFT (1 << 4)
  55. #define MALIDP650_DE_IRQ_ACEV1 (1 << 17)
  56. #define MALIDP650_DE_IRQ_ACEV2 (1 << 18)
  57. #define MALIDP650_DE_IRQ_ACEG (1 << 19)
  58. #define MALIDP650_DE_IRQ_AXIEP (1 << 28)
  59. /* bit masks that are common between products */
  60. #define MALIDP_CFG_VALID (1 << 0)
  61. #define MALIDP_DISP_FUNC_GAMMA (1 << 0)
  62. #define MALIDP_DISP_FUNC_CADJ (1 << 4)
  63. #define MALIDP_DISP_FUNC_ILACED (1 << 8)
  64. #define MALIDP_SCALE_ENGINE_EN (1 << 16)
  65. #define MALIDP_SE_MEMWRITE_EN (2 << 5)
  66. /* register offsets for IRQ management */
  67. #define MALIDP_REG_STATUS 0x00000
  68. #define MALIDP_REG_SETIRQ 0x00004
  69. #define MALIDP_REG_MASKIRQ 0x00008
  70. #define MALIDP_REG_CLEARIRQ 0x0000c
  71. /* register offsets */
  72. #define MALIDP_DE_CORE_ID 0x00018
  73. #define MALIDP_DE_DISPLAY_FUNC 0x00020
  74. /* these offsets are relative to MALIDP5x0_TIMINGS_BASE */
  75. #define MALIDP_DE_H_TIMINGS 0x0
  76. #define MALIDP_DE_V_TIMINGS 0x4
  77. #define MALIDP_DE_SYNC_WIDTH 0x8
  78. #define MALIDP_DE_HV_ACTIVE 0xc
  79. /* Stride register offsets relative to Lx_BASE */
  80. #define MALIDP_DE_LG_STRIDE 0x18
  81. #define MALIDP_DE_LV_STRIDE0 0x18
  82. #define MALIDP550_DE_LS_R1_STRIDE 0x28
  83. /* macros to set values into registers */
  84. #define MALIDP_DE_H_FRONTPORCH(x) (((x) & 0xfff) << 0)
  85. #define MALIDP_DE_H_BACKPORCH(x) (((x) & 0x3ff) << 16)
  86. #define MALIDP500_DE_V_FRONTPORCH(x) (((x) & 0xff) << 0)
  87. #define MALIDP550_DE_V_FRONTPORCH(x) (((x) & 0xfff) << 0)
  88. #define MALIDP_DE_V_BACKPORCH(x) (((x) & 0xff) << 16)
  89. #define MALIDP_DE_H_SYNCWIDTH(x) (((x) & 0x3ff) << 0)
  90. #define MALIDP_DE_V_SYNCWIDTH(x) (((x) & 0xff) << 16)
  91. #define MALIDP_DE_H_ACTIVE(x) (((x) & 0x1fff) << 0)
  92. #define MALIDP_DE_V_ACTIVE(x) (((x) & 0x1fff) << 16)
  93. #define MALIDP_PRODUCT_ID(__core_id) ((u32)(__core_id) >> 16)
  94. /* register offsets relative to MALIDP5x0_COEFFS_BASE */
  95. #define MALIDP_COLOR_ADJ_COEF 0x00000
  96. #define MALIDP_COEF_TABLE_ADDR 0x00030
  97. #define MALIDP_COEF_TABLE_DATA 0x00034
  98. /* Scaling engine registers and masks. */
  99. #define MALIDP_SE_SCALING_EN (1 << 0)
  100. #define MALIDP_SE_ALPHA_EN (1 << 1)
  101. #define MALIDP_SE_ENH_MASK 3
  102. #define MALIDP_SE_ENH(x) (((x) & MALIDP_SE_ENH_MASK) << 2)
  103. #define MALIDP_SE_RGBO_IF_EN (1 << 4)
  104. #define MALIDP550_SE_CTL_SEL_MASK 7
  105. #define MALIDP550_SE_CTL_VCSEL(x) \
  106. (((x) & MALIDP550_SE_CTL_SEL_MASK) << 20)
  107. #define MALIDP550_SE_CTL_HCSEL(x) \
  108. (((x) & MALIDP550_SE_CTL_SEL_MASK) << 16)
  109. /* Blocks with offsets from SE_CONTROL register. */
  110. #define MALIDP_SE_LAYER_CONTROL 0x14
  111. #define MALIDP_SE_L0_IN_SIZE 0x00
  112. #define MALIDP_SE_L0_OUT_SIZE 0x04
  113. #define MALIDP_SE_SET_V_SIZE(x) (((x) & 0x1fff) << 16)
  114. #define MALIDP_SE_SET_H_SIZE(x) (((x) & 0x1fff) << 0)
  115. #define MALIDP_SE_SCALING_CONTROL 0x24
  116. #define MALIDP_SE_H_INIT_PH 0x00
  117. #define MALIDP_SE_H_DELTA_PH 0x04
  118. #define MALIDP_SE_V_INIT_PH 0x08
  119. #define MALIDP_SE_V_DELTA_PH 0x0c
  120. #define MALIDP_SE_COEFFTAB_ADDR 0x10
  121. #define MALIDP_SE_COEFFTAB_ADDR_MASK 0x7f
  122. #define MALIDP_SE_V_COEFFTAB (1 << 8)
  123. #define MALIDP_SE_H_COEFFTAB (1 << 9)
  124. #define MALIDP_SE_SET_V_COEFFTAB_ADDR(x) \
  125. (MALIDP_SE_V_COEFFTAB | ((x) & MALIDP_SE_COEFFTAB_ADDR_MASK))
  126. #define MALIDP_SE_SET_H_COEFFTAB_ADDR(x) \
  127. (MALIDP_SE_H_COEFFTAB | ((x) & MALIDP_SE_COEFFTAB_ADDR_MASK))
  128. #define MALIDP_SE_COEFFTAB_DATA 0x14
  129. #define MALIDP_SE_COEFFTAB_DATA_MASK 0x3fff
  130. #define MALIDP_SE_SET_COEFFTAB_DATA(x) \
  131. ((x) & MALIDP_SE_COEFFTAB_DATA_MASK)
  132. /* Enhance coefficients register offset */
  133. #define MALIDP_SE_IMAGE_ENH 0x3C
  134. /* ENH_LIMITS offset 0x0 */
  135. #define MALIDP_SE_ENH_LOW_LEVEL 24
  136. #define MALIDP_SE_ENH_HIGH_LEVEL 63
  137. #define MALIDP_SE_ENH_LIMIT_MASK 0xfff
  138. #define MALIDP_SE_SET_ENH_LIMIT_LOW(x) \
  139. ((x) & MALIDP_SE_ENH_LIMIT_MASK)
  140. #define MALIDP_SE_SET_ENH_LIMIT_HIGH(x) \
  141. (((x) & MALIDP_SE_ENH_LIMIT_MASK) << 16)
  142. #define MALIDP_SE_ENH_COEFF0 0x04
  143. /* register offsets relative to MALIDP5x0_SE_MEMWRITE_BASE */
  144. #define MALIDP_MW_FORMAT 0x00000
  145. #define MALIDP_MW_P1_STRIDE 0x00004
  146. #define MALIDP_MW_P2_STRIDE 0x00008
  147. #define MALIDP_MW_P1_PTR_LOW 0x0000c
  148. #define MALIDP_MW_P1_PTR_HIGH 0x00010
  149. #define MALIDP_MW_P2_PTR_LOW 0x0002c
  150. #define MALIDP_MW_P2_PTR_HIGH 0x00030
  151. /* register offsets and bits specific to DP500 */
  152. #define MALIDP500_ADDR_SPACE_SIZE 0x01000
  153. #define MALIDP500_DC_BASE 0x00000
  154. #define MALIDP500_DC_CONTROL 0x0000c
  155. #define MALIDP500_DC_CONFIG_REQ (1 << 17)
  156. #define MALIDP500_HSYNCPOL (1 << 20)
  157. #define MALIDP500_VSYNCPOL (1 << 21)
  158. #define MALIDP500_DC_CLEAR_MASK 0x300fff
  159. #define MALIDP500_DE_LINE_COUNTER 0x00010
  160. #define MALIDP500_DE_AXI_CONTROL 0x00014
  161. #define MALIDP500_DE_SECURE_CTRL 0x0001c
  162. #define MALIDP500_DE_CHROMA_KEY 0x00024
  163. #define MALIDP500_TIMINGS_BASE 0x00028
  164. #define MALIDP500_CONFIG_3D 0x00038
  165. #define MALIDP500_BGND_COLOR 0x0003c
  166. #define MALIDP500_OUTPUT_DEPTH 0x00044
  167. #define MALIDP500_COEFFS_BASE 0x00078
  168. /*
  169. * The YUV2RGB coefficients on the DP500 are not in the video layer's register
  170. * block. They belong in a separate block above the layer's registers, hence
  171. * the negative offset.
  172. */
  173. #define MALIDP500_LV_YUV2RGB ((s16)(-0xB8))
  174. #define MALIDP500_DE_LV_BASE 0x00100
  175. #define MALIDP500_DE_LV_PTR_BASE 0x00124
  176. #define MALIDP500_DE_LV_AD_CTRL 0x00400
  177. #define MALIDP500_DE_LG1_BASE 0x00200
  178. #define MALIDP500_DE_LG1_PTR_BASE 0x0021c
  179. #define MALIDP500_DE_LG1_AD_CTRL 0x0040c
  180. #define MALIDP500_DE_LG2_BASE 0x00300
  181. #define MALIDP500_DE_LG2_PTR_BASE 0x0031c
  182. #define MALIDP500_DE_LG2_AD_CTRL 0x00418
  183. #define MALIDP500_SE_BASE 0x00c00
  184. #define MALIDP500_SE_CONTROL 0x00c0c
  185. #define MALIDP500_SE_MEMWRITE_OUT_SIZE 0x00c2c
  186. #define MALIDP500_SE_RGB_YUV_COEFFS 0x00C74
  187. #define MALIDP500_SE_MEMWRITE_BASE 0x00e00
  188. #define MALIDP500_DC_IRQ_BASE 0x00f00
  189. #define MALIDP500_CONFIG_VALID 0x00f00
  190. #define MALIDP500_CONFIG_ID 0x00fd4
  191. /*
  192. * The quality of service (QoS) register on the DP500. RQOS register values
  193. * are driven by the ARQOS signal, using AXI transacations, dependent on the
  194. * FIFO input level.
  195. * The RQOS register can also set QoS levels for:
  196. * - RED_ARQOS @ A 4-bit signal value for close to underflow conditions
  197. * - GREEN_ARQOS @ A 4-bit signal value for normal conditions
  198. */
  199. #define MALIDP500_RQOS_QUALITY 0x00500
  200. /* register offsets and bits specific to DP550/DP650 */
  201. #define MALIDP550_ADDR_SPACE_SIZE 0x10000
  202. #define MALIDP550_DE_CONTROL 0x00010
  203. #define MALIDP550_DE_LINE_COUNTER 0x00014
  204. #define MALIDP550_DE_AXI_CONTROL 0x00018
  205. #define MALIDP550_DE_QOS 0x0001c
  206. #define MALIDP550_TIMINGS_BASE 0x00030
  207. #define MALIDP550_HSYNCPOL (1 << 12)
  208. #define MALIDP550_VSYNCPOL (1 << 28)
  209. #define MALIDP550_DE_DISP_SIDEBAND 0x00040
  210. #define MALIDP550_DE_BGND_COLOR 0x00044
  211. #define MALIDP550_DE_OUTPUT_DEPTH 0x0004c
  212. #define MALIDP550_COEFFS_BASE 0x00050
  213. #define MALIDP550_LV_YUV2RGB 0x00084
  214. #define MALIDP550_DE_LV1_BASE 0x00100
  215. #define MALIDP550_DE_LV1_PTR_BASE 0x00124
  216. #define MALIDP550_DE_LV1_AD_CTRL 0x001B8
  217. #define MALIDP550_DE_LV2_BASE 0x00200
  218. #define MALIDP550_DE_LV2_PTR_BASE 0x00224
  219. #define MALIDP550_DE_LV2_AD_CTRL 0x002B8
  220. #define MALIDP550_DE_LG_BASE 0x00300
  221. #define MALIDP550_DE_LG_PTR_BASE 0x0031c
  222. #define MALIDP550_DE_LG_AD_CTRL 0x00330
  223. #define MALIDP550_DE_LS_BASE 0x00400
  224. #define MALIDP550_DE_LS_PTR_BASE 0x0042c
  225. #define MALIDP550_DE_PERF_BASE 0x00500
  226. #define MALIDP550_SE_BASE 0x08000
  227. #define MALIDP550_SE_CONTROL 0x08010
  228. #define MALIDP550_SE_MEMWRITE_ONESHOT (1 << 7)
  229. #define MALIDP550_SE_MEMWRITE_OUT_SIZE 0x08030
  230. #define MALIDP550_SE_RGB_YUV_COEFFS 0x08078
  231. #define MALIDP550_SE_MEMWRITE_BASE 0x08100
  232. #define MALIDP550_DC_BASE 0x0c000
  233. #define MALIDP550_DC_CONTROL 0x0c010
  234. #define MALIDP550_DC_CONFIG_REQ (1 << 16)
  235. #define MALIDP550_CONFIG_VALID 0x0c014
  236. #define MALIDP550_CONFIG_ID 0x0ffd4
  237. /* register offsets specific to DP650 */
  238. #define MALIDP650_DE_LV_MMU_CTRL 0x000D0
  239. #define MALIDP650_DE_LG_MMU_CTRL 0x00048
  240. #define MALIDP650_DE_LS_MMU_CTRL 0x00078
  241. /* bit masks to set the MMU control register */
  242. #define MALIDP_MMU_CTRL_EN (1 << 0)
  243. #define MALIDP_MMU_CTRL_MODE (1 << 4)
  244. #define MALIDP_MMU_CTRL_PX_PS(x) (1 << (8 + (x)))
  245. #define MALIDP_MMU_CTRL_PP_NUM_REQ(x) (((x) & 0x7f) << 12)
  246. /* AFBC register offsets relative to MALIDPXXX_DE_LX_AD_CTRL */
  247. /* The following register offsets are common for DP500, DP550 and DP650 */
  248. #define MALIDP_AD_CROP_H 0x4
  249. #define MALIDP_AD_CROP_V 0x8
  250. #define MALIDP_AD_END_PTR_LOW 0xc
  251. #define MALIDP_AD_END_PTR_HIGH 0x10
  252. /* AFBC decoder Registers */
  253. #define MALIDP_AD_EN BIT(0)
  254. #define MALIDP_AD_YTR BIT(4)
  255. #define MALIDP_AD_BS BIT(8)
  256. #define MALIDP_AD_CROP_RIGHT_OFFSET 16
  257. #define MALIDP_AD_CROP_BOTTOM_OFFSET 16
  258. /*
  259. * Starting with DP550 the register map blocks has been standardised to the
  260. * following layout:
  261. *
  262. * Offset Block registers
  263. * 0x00000 Display Engine
  264. * 0x08000 Scaling Engine
  265. * 0x0c000 Display Core
  266. * 0x10000 Secure control
  267. *
  268. * The old DP500 IP mixes some DC with the DE registers, hence the need
  269. * for a mapping structure.
  270. */
  271. #endif /* __MALIDP_REGS_H__ */