cal_regs.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. /*
  2. * TI CAL camera interface driver
  3. *
  4. * Copyright (c) 2015 Texas Instruments Inc.
  5. *
  6. * Benoit Parrot, <[email protected]>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published by
  10. * the Free Software Foundation.
  11. */
  12. #ifndef __TI_CAL_REGS_H
  13. #define __TI_CAL_REGS_H
  14. #define CAL_NUM_CSI2_PORTS 2
  15. /* CAL register offsets */
  16. #define CAL_HL_REVISION 0x0000
  17. #define CAL_HL_HWINFO 0x0004
  18. #define CAL_HL_SYSCONFIG 0x0010
  19. #define CAL_HL_IRQ_EOI 0x001c
  20. #define CAL_HL_IRQSTATUS_RAW(m) (0x20U + ((m-1) * 0x10U))
  21. #define CAL_HL_IRQSTATUS(m) (0x24U + ((m-1) * 0x10U))
  22. #define CAL_HL_IRQENABLE_SET(m) (0x28U + ((m-1) * 0x10U))
  23. #define CAL_HL_IRQENABLE_CLR(m) (0x2cU + ((m-1) * 0x10U))
  24. #define CAL_PIX_PROC(m) (0xc0U + ((m-1) * 0x4U))
  25. #define CAL_CTRL 0x100
  26. #define CAL_CTRL1 0x104
  27. #define CAL_LINE_NUMBER_EVT 0x108
  28. #define CAL_VPORT_CTRL1 0x120
  29. #define CAL_VPORT_CTRL2 0x124
  30. #define CAL_BYS_CTRL1 0x130
  31. #define CAL_BYS_CTRL2 0x134
  32. #define CAL_RD_DMA_CTRL 0x140
  33. #define CAL_RD_DMA_PIX_ADDR 0x144
  34. #define CAL_RD_DMA_PIX_OFST 0x148
  35. #define CAL_RD_DMA_XSIZE 0x14c
  36. #define CAL_RD_DMA_YSIZE 0x150
  37. #define CAL_RD_DMA_INIT_ADDR 0x154
  38. #define CAL_RD_DMA_INIT_OFST 0x168
  39. #define CAL_RD_DMA_CTRL2 0x16c
  40. #define CAL_WR_DMA_CTRL(m) (0x200U + ((m-1) * 0x10U))
  41. #define CAL_WR_DMA_ADDR(m) (0x204U + ((m-1) * 0x10U))
  42. #define CAL_WR_DMA_OFST(m) (0x208U + ((m-1) * 0x10U))
  43. #define CAL_WR_DMA_XSIZE(m) (0x20cU + ((m-1) * 0x10U))
  44. #define CAL_CSI2_PPI_CTRL(m) (0x300U + ((m-1) * 0x80U))
  45. #define CAL_CSI2_COMPLEXIO_CFG(m) (0x304U + ((m-1) * 0x80U))
  46. #define CAL_CSI2_COMPLEXIO_IRQSTATUS(m) (0x308U + ((m-1) * 0x80U))
  47. #define CAL_CSI2_SHORT_PACKET(m) (0x30cU + ((m-1) * 0x80U))
  48. #define CAL_CSI2_COMPLEXIO_IRQENABLE(m) (0x310U + ((m-1) * 0x80U))
  49. #define CAL_CSI2_TIMING(m) (0x314U + ((m-1) * 0x80U))
  50. #define CAL_CSI2_VC_IRQENABLE(m) (0x318U + ((m-1) * 0x80U))
  51. #define CAL_CSI2_VC_IRQSTATUS(m) (0x328U + ((m-1) * 0x80U))
  52. #define CAL_CSI2_CTX0(m) (0x330U + ((m-1) * 0x80U))
  53. #define CAL_CSI2_CTX1(m) (0x334U + ((m-1) * 0x80U))
  54. #define CAL_CSI2_CTX2(m) (0x338U + ((m-1) * 0x80U))
  55. #define CAL_CSI2_CTX3(m) (0x33cU + ((m-1) * 0x80U))
  56. #define CAL_CSI2_CTX4(m) (0x340U + ((m-1) * 0x80U))
  57. #define CAL_CSI2_CTX5(m) (0x344U + ((m-1) * 0x80U))
  58. #define CAL_CSI2_CTX6(m) (0x348U + ((m-1) * 0x80U))
  59. #define CAL_CSI2_CTX7(m) (0x34cU + ((m-1) * 0x80U))
  60. #define CAL_CSI2_STATUS0(m) (0x350U + ((m-1) * 0x80U))
  61. #define CAL_CSI2_STATUS1(m) (0x354U + ((m-1) * 0x80U))
  62. #define CAL_CSI2_STATUS2(m) (0x358U + ((m-1) * 0x80U))
  63. #define CAL_CSI2_STATUS3(m) (0x35cU + ((m-1) * 0x80U))
  64. #define CAL_CSI2_STATUS4(m) (0x360U + ((m-1) * 0x80U))
  65. #define CAL_CSI2_STATUS5(m) (0x364U + ((m-1) * 0x80U))
  66. #define CAL_CSI2_STATUS6(m) (0x368U + ((m-1) * 0x80U))
  67. #define CAL_CSI2_STATUS7(m) (0x36cU + ((m-1) * 0x80U))
  68. /* CAL CSI2 PHY register offsets */
  69. #define CAL_CSI2_PHY_REG0 0x000
  70. #define CAL_CSI2_PHY_REG1 0x004
  71. #define CAL_CSI2_PHY_REG2 0x008
  72. /* CAL Control Module Core Camerrx Control register offsets */
  73. #define CM_CTRL_CORE_CAMERRX_CONTROL 0x000
  74. /*********************************************************************
  75. * Generic value used in various field below
  76. *********************************************************************/
  77. #define CAL_GEN_DISABLE 0
  78. #define CAL_GEN_ENABLE 1
  79. #define CAL_GEN_FALSE 0
  80. #define CAL_GEN_TRUE 1
  81. /*********************************************************************
  82. * Field Definition Macros
  83. *********************************************************************/
  84. #define CAL_HL_REVISION_MINOR_MASK GENMASK(5, 0)
  85. #define CAL_HL_REVISION_CUSTOM_MASK GENMASK(7, 6)
  86. #define CAL_HL_REVISION_MAJOR_MASK GENMASK(10, 8)
  87. #define CAL_HL_REVISION_RTL_MASK GENMASK(15, 11)
  88. #define CAL_HL_REVISION_FUNC_MASK GENMASK(27, 16)
  89. #define CAL_HL_REVISION_SCHEME_MASK GENMASK(31, 30)
  90. #define CAL_HL_REVISION_SCHEME_H08 1
  91. #define CAL_HL_REVISION_SCHEME_LEGACY 0
  92. #define CAL_HL_HWINFO_WFIFO_MASK GENMASK(3, 0)
  93. #define CAL_HL_HWINFO_RFIFO_MASK GENMASK(7, 4)
  94. #define CAL_HL_HWINFO_PCTX_MASK GENMASK(12, 8)
  95. #define CAL_HL_HWINFO_WCTX_MASK GENMASK(18, 13)
  96. #define CAL_HL_HWINFO_VFIFO_MASK GENMASK(22, 19)
  97. #define CAL_HL_HWINFO_NCPORT_MASK GENMASK(27, 23)
  98. #define CAL_HL_HWINFO_NPPI_CTXS0_MASK GENMASK(29, 28)
  99. #define CAL_HL_HWINFO_NPPI_CTXS1_MASK GENMASK(31, 30)
  100. #define CAL_HL_HWINFO_NPPI_CONTEXTS_ZERO 0
  101. #define CAL_HL_HWINFO_NPPI_CONTEXTS_FOUR 1
  102. #define CAL_HL_HWINFO_NPPI_CONTEXTS_EIGHT 2
  103. #define CAL_HL_HWINFO_NPPI_CONTEXTS_RESERVED 3
  104. #define CAL_HL_SYSCONFIG_SOFTRESET_MASK BIT_MASK(0)
  105. #define CAL_HL_SYSCONFIG_SOFTRESET_DONE 0x0
  106. #define CAL_HL_SYSCONFIG_SOFTRESET_PENDING 0x1
  107. #define CAL_HL_SYSCONFIG_SOFTRESET_NOACTION 0x0
  108. #define CAL_HL_SYSCONFIG_SOFTRESET_RESET 0x1
  109. #define CAL_HL_SYSCONFIG_IDLE_MASK GENMASK(3, 2)
  110. #define CAL_HL_SYSCONFIG_IDLEMODE_FORCE 0
  111. #define CAL_HL_SYSCONFIG_IDLEMODE_NO 1
  112. #define CAL_HL_SYSCONFIG_IDLEMODE_SMART1 2
  113. #define CAL_HL_SYSCONFIG_IDLEMODE_SMART2 3
  114. #define CAL_HL_IRQ_EOI_LINE_NUMBER_MASK BIT_MASK(0)
  115. #define CAL_HL_IRQ_EOI_LINE_NUMBER_READ0 0
  116. #define CAL_HL_IRQ_EOI_LINE_NUMBER_EOI0 0
  117. #define CAL_HL_IRQ_MASK(m) BIT_MASK(m-1)
  118. #define CAL_HL_IRQ_NOACTION 0x0
  119. #define CAL_HL_IRQ_ENABLE 0x1
  120. #define CAL_HL_IRQ_CLEAR 0x1
  121. #define CAL_HL_IRQ_DISABLED 0x0
  122. #define CAL_HL_IRQ_ENABLED 0x1
  123. #define CAL_HL_IRQ_PENDING 0x1
  124. #define CAL_PIX_PROC_EN_MASK BIT_MASK(0)
  125. #define CAL_PIX_PROC_EXTRACT_MASK GENMASK(4, 1)
  126. #define CAL_PIX_PROC_EXTRACT_B6 0x0
  127. #define CAL_PIX_PROC_EXTRACT_B7 0x1
  128. #define CAL_PIX_PROC_EXTRACT_B8 0x2
  129. #define CAL_PIX_PROC_EXTRACT_B10 0x3
  130. #define CAL_PIX_PROC_EXTRACT_B10_MIPI 0x4
  131. #define CAL_PIX_PROC_EXTRACT_B12 0x5
  132. #define CAL_PIX_PROC_EXTRACT_B12_MIPI 0x6
  133. #define CAL_PIX_PROC_EXTRACT_B14 0x7
  134. #define CAL_PIX_PROC_EXTRACT_B14_MIPI 0x8
  135. #define CAL_PIX_PROC_EXTRACT_B16_BE 0x9
  136. #define CAL_PIX_PROC_EXTRACT_B16_LE 0xa
  137. #define CAL_PIX_PROC_DPCMD_MASK GENMASK(9, 5)
  138. #define CAL_PIX_PROC_DPCMD_BYPASS 0x0
  139. #define CAL_PIX_PROC_DPCMD_DPCM_10_8_1 0x2
  140. #define CAL_PIX_PROC_DPCMD_DPCM_12_8_1 0x8
  141. #define CAL_PIX_PROC_DPCMD_DPCM_10_7_1 0x4
  142. #define CAL_PIX_PROC_DPCMD_DPCM_10_7_2 0x5
  143. #define CAL_PIX_PROC_DPCMD_DPCM_10_6_1 0x6
  144. #define CAL_PIX_PROC_DPCMD_DPCM_10_6_2 0x7
  145. #define CAL_PIX_PROC_DPCMD_DPCM_12_7_1 0xa
  146. #define CAL_PIX_PROC_DPCMD_DPCM_12_6_1 0xc
  147. #define CAL_PIX_PROC_DPCMD_DPCM_14_10 0xe
  148. #define CAL_PIX_PROC_DPCMD_DPCM_14_8_1 0x10
  149. #define CAL_PIX_PROC_DPCMD_DPCM_16_12_1 0x12
  150. #define CAL_PIX_PROC_DPCMD_DPCM_16_10_1 0x14
  151. #define CAL_PIX_PROC_DPCMD_DPCM_16_8_1 0x16
  152. #define CAL_PIX_PROC_DPCME_MASK GENMASK(15, 11)
  153. #define CAL_PIX_PROC_DPCME_BYPASS 0x0
  154. #define CAL_PIX_PROC_DPCME_DPCM_10_8_1 0x2
  155. #define CAL_PIX_PROC_DPCME_DPCM_12_8_1 0x8
  156. #define CAL_PIX_PROC_DPCME_DPCM_14_10 0xe
  157. #define CAL_PIX_PROC_DPCME_DPCM_14_8_1 0x10
  158. #define CAL_PIX_PROC_DPCME_DPCM_16_12_1 0x12
  159. #define CAL_PIX_PROC_DPCME_DPCM_16_10_1 0x14
  160. #define CAL_PIX_PROC_DPCME_DPCM_16_8_1 0x16
  161. #define CAL_PIX_PROC_PACK_MASK GENMASK(18, 16)
  162. #define CAL_PIX_PROC_PACK_B8 0x0
  163. #define CAL_PIX_PROC_PACK_B10_MIPI 0x2
  164. #define CAL_PIX_PROC_PACK_B12 0x3
  165. #define CAL_PIX_PROC_PACK_B12_MIPI 0x4
  166. #define CAL_PIX_PROC_PACK_B16 0x5
  167. #define CAL_PIX_PROC_PACK_ARGB 0x6
  168. #define CAL_PIX_PROC_CPORT_MASK GENMASK(23, 19)
  169. #define CAL_CTRL_POSTED_WRITES_MASK BIT_MASK(0)
  170. #define CAL_CTRL_POSTED_WRITES_NONPOSTED 0
  171. #define CAL_CTRL_POSTED_WRITES 1
  172. #define CAL_CTRL_TAGCNT_MASK GENMASK(4, 1)
  173. #define CAL_CTRL_BURSTSIZE_MASK GENMASK(6, 5)
  174. #define CAL_CTRL_BURSTSIZE_BURST16 0x0
  175. #define CAL_CTRL_BURSTSIZE_BURST32 0x1
  176. #define CAL_CTRL_BURSTSIZE_BURST64 0x2
  177. #define CAL_CTRL_BURSTSIZE_BURST128 0x3
  178. #define CAL_CTRL_LL_FORCE_STATE_MASK GENMASK(12, 7)
  179. #define CAL_CTRL_MFLAGL_MASK GENMASK(20, 13)
  180. #define CAL_CTRL_PWRSCPCLK_MASK BIT_MASK(21)
  181. #define CAL_CTRL_PWRSCPCLK_AUTO 0
  182. #define CAL_CTRL_PWRSCPCLK_FORCE 1
  183. #define CAL_CTRL_RD_DMA_STALL_MASK BIT_MASK(22)
  184. #define CAL_CTRL_MFLAGH_MASK GENMASK(31, 24)
  185. #define CAL_CTRL1_PPI_GROUPING_MASK GENMASK(1, 0)
  186. #define CAL_CTRL1_PPI_GROUPING_DISABLED 0
  187. #define CAL_CTRL1_PPI_GROUPING_RESERVED 1
  188. #define CAL_CTRL1_PPI_GROUPING_0 2
  189. #define CAL_CTRL1_PPI_GROUPING_1 3
  190. #define CAL_CTRL1_INTERLEAVE01_MASK GENMASK(3, 2)
  191. #define CAL_CTRL1_INTERLEAVE01_DISABLED 0
  192. #define CAL_CTRL1_INTERLEAVE01_PIX1 1
  193. #define CAL_CTRL1_INTERLEAVE01_PIX4 2
  194. #define CAL_CTRL1_INTERLEAVE01_RESERVED 3
  195. #define CAL_CTRL1_INTERLEAVE23_MASK GENMASK(5, 4)
  196. #define CAL_CTRL1_INTERLEAVE23_DISABLED 0
  197. #define CAL_CTRL1_INTERLEAVE23_PIX1 1
  198. #define CAL_CTRL1_INTERLEAVE23_PIX4 2
  199. #define CAL_CTRL1_INTERLEAVE23_RESERVED 3
  200. #define CAL_LINE_NUMBER_EVT_CPORT_MASK GENMASK(4, 0)
  201. #define CAL_LINE_NUMBER_EVT_MASK GENMASK(29, 16)
  202. #define CAL_VPORT_CTRL1_PCLK_MASK GENMASK(16, 0)
  203. #define CAL_VPORT_CTRL1_XBLK_MASK GENMASK(24, 17)
  204. #define CAL_VPORT_CTRL1_YBLK_MASK GENMASK(30, 25)
  205. #define CAL_VPORT_CTRL1_WIDTH_MASK BIT_MASK(31)
  206. #define CAL_VPORT_CTRL1_WIDTH_ONE 0
  207. #define CAL_VPORT_CTRL1_WIDTH_TWO 1
  208. #define CAL_VPORT_CTRL2_CPORT_MASK GENMASK(4, 0)
  209. #define CAL_VPORT_CTRL2_FREERUNNING_MASK BIT_MASK(15)
  210. #define CAL_VPORT_CTRL2_FREERUNNING_GATED 0
  211. #define CAL_VPORT_CTRL2_FREERUNNING_FREE 1
  212. #define CAL_VPORT_CTRL2_FS_RESETS_MASK BIT_MASK(16)
  213. #define CAL_VPORT_CTRL2_FS_RESETS_NO 0
  214. #define CAL_VPORT_CTRL2_FS_RESETS_YES 1
  215. #define CAL_VPORT_CTRL2_FSM_RESET_MASK BIT_MASK(17)
  216. #define CAL_VPORT_CTRL2_FSM_RESET_NOEFFECT 0
  217. #define CAL_VPORT_CTRL2_FSM_RESET 1
  218. #define CAL_VPORT_CTRL2_RDY_THR_MASK GENMASK(31, 18)
  219. #define CAL_BYS_CTRL1_PCLK_MASK GENMASK(16, 0)
  220. #define CAL_BYS_CTRL1_XBLK_MASK GENMASK(24, 17)
  221. #define CAL_BYS_CTRL1_YBLK_MASK GENMASK(30, 25)
  222. #define CAL_BYS_CTRL1_BYSINEN_MASK BIT_MASK(31)
  223. #define CAL_BYS_CTRL2_CPORTIN_MASK GENMASK(4, 0)
  224. #define CAL_BYS_CTRL2_CPORTOUT_MASK GENMASK(9, 5)
  225. #define CAL_BYS_CTRL2_DUPLICATEDDATA_MASK BIT_MASK(10)
  226. #define CAL_BYS_CTRL2_DUPLICATEDDATA_NO 0
  227. #define CAL_BYS_CTRL2_DUPLICATEDDATA_YES 1
  228. #define CAL_BYS_CTRL2_FREERUNNING_MASK BIT_MASK(11)
  229. #define CAL_BYS_CTRL2_FREERUNNING_NO 0
  230. #define CAL_BYS_CTRL2_FREERUNNING_YES 1
  231. #define CAL_RD_DMA_CTRL_GO_MASK BIT_MASK(0)
  232. #define CAL_RD_DMA_CTRL_GO_DIS 0
  233. #define CAL_RD_DMA_CTRL_GO_EN 1
  234. #define CAL_RD_DMA_CTRL_GO_IDLE 0
  235. #define CAL_RD_DMA_CTRL_GO_BUSY 1
  236. #define CAL_RD_DMA_CTRL_INIT_MASK BIT_MASK(1)
  237. #define CAL_RD_DMA_CTRL_BW_LIMITER_MASK GENMASK(10, 2)
  238. #define CAL_RD_DMA_CTRL_OCP_TAG_CNT_MASK GENMASK(14, 11)
  239. #define CAL_RD_DMA_CTRL_PCLK_MASK GENMASK(31, 15)
  240. #define CAL_RD_DMA_PIX_ADDR_MASK GENMASK(31, 3)
  241. #define CAL_RD_DMA_PIX_OFST_MASK GENMASK(31, 4)
  242. #define CAL_RD_DMA_XSIZE_MASK GENMASK(31, 19)
  243. #define CAL_RD_DMA_YSIZE_MASK GENMASK(29, 16)
  244. #define CAL_RD_DMA_INIT_ADDR_MASK GENMASK(31, 3)
  245. #define CAL_RD_DMA_INIT_OFST_MASK GENMASK(31, 3)
  246. #define CAL_RD_DMA_CTRL2_CIRC_MODE_MASK GENMASK(2, 0)
  247. #define CAL_RD_DMA_CTRL2_CIRC_MODE_DIS 0
  248. #define CAL_RD_DMA_CTRL2_CIRC_MODE_ONE 1
  249. #define CAL_RD_DMA_CTRL2_CIRC_MODE_FOUR 2
  250. #define CAL_RD_DMA_CTRL2_CIRC_MODE_SIXTEEN 3
  251. #define CAL_RD_DMA_CTRL2_CIRC_MODE_SIXTYFOUR 4
  252. #define CAL_RD_DMA_CTRL2_CIRC_MODE_RESERVED 5
  253. #define CAL_RD_DMA_CTRL2_ICM_CSTART_MASK BIT_MASK(3)
  254. #define CAL_RD_DMA_CTRL2_PATTERN_MASK GENMASK(5, 4)
  255. #define CAL_RD_DMA_CTRL2_PATTERN_LINEAR 0
  256. #define CAL_RD_DMA_CTRL2_PATTERN_YUV420 1
  257. #define CAL_RD_DMA_CTRL2_PATTERN_RD2SKIP2 2
  258. #define CAL_RD_DMA_CTRL2_PATTERN_RD2SKIP4 3
  259. #define CAL_RD_DMA_CTRL2_BYSOUT_LE_WAIT_MASK BIT_MASK(6)
  260. #define CAL_RD_DMA_CTRL2_BYSOUT_LE_WAIT_FREERUNNING 0
  261. #define CAL_RD_DMA_CTRL2_BYSOUT_LE_WAIT_WAITFORBYSOUT 1
  262. #define CAL_RD_DMA_CTRL2_CIRC_SIZE_MASK GENMASK(29, 16)
  263. #define CAL_WR_DMA_CTRL_MODE_MASK GENMASK(2, 0)
  264. #define CAL_WR_DMA_CTRL_MODE_DIS 0
  265. #define CAL_WR_DMA_CTRL_MODE_SHD 1
  266. #define CAL_WR_DMA_CTRL_MODE_CNT 2
  267. #define CAL_WR_DMA_CTRL_MODE_CNT_INIT 3
  268. #define CAL_WR_DMA_CTRL_MODE_CONST 4
  269. #define CAL_WR_DMA_CTRL_MODE_RESERVED 5
  270. #define CAL_WR_DMA_CTRL_PATTERN_MASK GENMASK(4, 3)
  271. #define CAL_WR_DMA_CTRL_PATTERN_LINEAR 0
  272. #define CAL_WR_DMA_CTRL_PATTERN_WR2SKIP2 2
  273. #define CAL_WR_DMA_CTRL_PATTERN_WR2SKIP4 3
  274. #define CAL_WR_DMA_CTRL_PATTERN_RESERVED 1
  275. #define CAL_WR_DMA_CTRL_ICM_PSTART_MASK BIT_MASK(5)
  276. #define CAL_WR_DMA_CTRL_DTAG_MASK GENMASK(8, 6)
  277. #define CAL_WR_DMA_CTRL_DTAG_ATT_HDR 0
  278. #define CAL_WR_DMA_CTRL_DTAG_ATT_DAT 1
  279. #define CAL_WR_DMA_CTRL_DTAG 2
  280. #define CAL_WR_DMA_CTRL_DTAG_PIX_HDR 3
  281. #define CAL_WR_DMA_CTRL_DTAG_PIX_DAT 4
  282. #define CAL_WR_DMA_CTRL_DTAG_D5 5
  283. #define CAL_WR_DMA_CTRL_DTAG_D6 6
  284. #define CAL_WR_DMA_CTRL_DTAG_D7 7
  285. #define CAL_WR_DMA_CTRL_CPORT_MASK GENMASK(13, 9)
  286. #define CAL_WR_DMA_CTRL_STALL_RD_MASK BIT_MASK(14)
  287. #define CAL_WR_DMA_CTRL_YSIZE_MASK GENMASK(31, 18)
  288. #define CAL_WR_DMA_ADDR_MASK GENMASK(31, 4)
  289. #define CAL_WR_DMA_OFST_MASK GENMASK(18, 4)
  290. #define CAL_WR_DMA_OFST_CIRC_MODE_MASK GENMASK(23, 22)
  291. #define CAL_WR_DMA_OFST_CIRC_MODE_ONE 1
  292. #define CAL_WR_DMA_OFST_CIRC_MODE_FOUR 2
  293. #define CAL_WR_DMA_OFST_CIRC_MODE_SIXTYFOUR 3
  294. #define CAL_WR_DMA_OFST_CIRC_MODE_DISABLED 0
  295. #define CAL_WR_DMA_OFST_CIRC_SIZE_MASK GENMASK(31, 24)
  296. #define CAL_WR_DMA_XSIZE_XSKIP_MASK GENMASK(15, 3)
  297. #define CAL_WR_DMA_XSIZE_MASK GENMASK(31, 19)
  298. #define CAL_CSI2_PPI_CTRL_IF_EN_MASK BIT_MASK(0)
  299. #define CAL_CSI2_PPI_CTRL_ECC_EN_MASK BIT_MASK(2)
  300. #define CAL_CSI2_PPI_CTRL_FRAME_MASK BIT_MASK(3)
  301. #define CAL_CSI2_PPI_CTRL_FRAME_IMMEDIATE 0
  302. #define CAL_CSI2_PPI_CTRL_FRAME 1
  303. #define CAL_CSI2_COMPLEXIO_CFG_CLOCK_POSITION_MASK GENMASK(2, 0)
  304. #define CAL_CSI2_COMPLEXIO_CFG_POSITION_5 5
  305. #define CAL_CSI2_COMPLEXIO_CFG_POSITION_4 4
  306. #define CAL_CSI2_COMPLEXIO_CFG_POSITION_3 3
  307. #define CAL_CSI2_COMPLEXIO_CFG_POSITION_2 2
  308. #define CAL_CSI2_COMPLEXIO_CFG_POSITION_1 1
  309. #define CAL_CSI2_COMPLEXIO_CFG_POSITION_NOT_USED 0
  310. #define CAL_CSI2_COMPLEXIO_CFG_CLOCK_POL_MASK BIT_MASK(3)
  311. #define CAL_CSI2_COMPLEXIO_CFG_POL_PLUSMINUS 0
  312. #define CAL_CSI2_COMPLEXIO_CFG_POL_MINUSPLUS 1
  313. #define CAL_CSI2_COMPLEXIO_CFG_DATA1_POSITION_MASK GENMASK(6, 4)
  314. #define CAL_CSI2_COMPLEXIO_CFG_DATA1_POL_MASK BIT_MASK(7)
  315. #define CAL_CSI2_COMPLEXIO_CFG_DATA2_POSITION_MASK GENMASK(10, 8)
  316. #define CAL_CSI2_COMPLEXIO_CFG_DATA2_POL_MASK BIT_MASK(11)
  317. #define CAL_CSI2_COMPLEXIO_CFG_DATA3_POSITION_MASK GENMASK(14, 12)
  318. #define CAL_CSI2_COMPLEXIO_CFG_DATA3_POL_MASK BIT_MASK(15)
  319. #define CAL_CSI2_COMPLEXIO_CFG_DATA4_POSITION_MASK GENMASK(18, 16)
  320. #define CAL_CSI2_COMPLEXIO_CFG_DATA4_POL_MASK BIT_MASK(19)
  321. #define CAL_CSI2_COMPLEXIO_CFG_PWR_AUTO_MASK BIT_MASK(24)
  322. #define CAL_CSI2_COMPLEXIO_CFG_PWR_STATUS_MASK GENMASK(26, 25)
  323. #define CAL_CSI2_COMPLEXIO_CFG_PWR_STATUS_STATE_OFF 0
  324. #define CAL_CSI2_COMPLEXIO_CFG_PWR_STATUS_STATE_ON 1
  325. #define CAL_CSI2_COMPLEXIO_CFG_PWR_STATUS_STATE_ULP 2
  326. #define CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_MASK GENMASK(28, 27)
  327. #define CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_OFF 0
  328. #define CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_ON 1
  329. #define CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_ULP 2
  330. #define CAL_CSI2_COMPLEXIO_CFG_RESET_DONE_MASK BIT_MASK(29)
  331. #define CAL_CSI2_COMPLEXIO_CFG_RESET_DONE_RESETCOMPLETED 1
  332. #define CAL_CSI2_COMPLEXIO_CFG_RESET_DONE_RESETONGOING 0
  333. #define CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_MASK BIT_MASK(30)
  334. #define CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL 0
  335. #define CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_OPERATIONAL 1
  336. #define CAL_CSI2_SHORT_PACKET_MASK GENMASK(23, 0)
  337. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTHS1_MASK BIT_MASK(0)
  338. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTHS2_MASK BIT_MASK(1)
  339. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTHS3_MASK BIT_MASK(2)
  340. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTHS4_MASK BIT_MASK(3)
  341. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTHS5_MASK BIT_MASK(4)
  342. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS1_MASK BIT_MASK(5)
  343. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS2_MASK BIT_MASK(6)
  344. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS3_MASK BIT_MASK(7)
  345. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS4_MASK BIT_MASK(8)
  346. #define CAL_CSI2_COMPLEXIO_IRQ_ERRSOTSYNCHS5_MASK BIT_MASK(9)
  347. #define CAL_CSI2_COMPLEXIO_IRQ_ERRESC1_MASK BIT_MASK(10)
  348. #define CAL_CSI2_COMPLEXIO_IRQ_ERRESC2_MASK BIT_MASK(11)
  349. #define CAL_CSI2_COMPLEXIO_IRQ_ERRESC3_MASK BIT_MASK(12)
  350. #define CAL_CSI2_COMPLEXIO_IRQ_ERRESC4_MASK BIT_MASK(13)
  351. #define CAL_CSI2_COMPLEXIO_IRQ_ERRESC5_MASK BIT_MASK(14)
  352. #define CAL_CSI2_COMPLEXIO_IRQ_ERRCONTROL1_MASK BIT_MASK(15)
  353. #define CAL_CSI2_COMPLEXIO_IRQ_ERRCONTROL2_MASK BIT_MASK(16)
  354. #define CAL_CSI2_COMPLEXIO_IRQ_ERRCONTROL3_MASK BIT_MASK(17)
  355. #define CAL_CSI2_COMPLEXIO_IRQ_ERRCONTROL4_MASK BIT_MASK(18)
  356. #define CAL_CSI2_COMPLEXIO_IRQ_ERRCONTROL5_MASK BIT_MASK(19)
  357. #define CAL_CSI2_COMPLEXIO_IRQ_STATEULPM1_MASK BIT_MASK(20)
  358. #define CAL_CSI2_COMPLEXIO_IRQ_STATEULPM2_MASK BIT_MASK(21)
  359. #define CAL_CSI2_COMPLEXIO_IRQ_STATEULPM3_MASK BIT_MASK(22)
  360. #define CAL_CSI2_COMPLEXIO_IRQ_STATEULPM4_MASK BIT_MASK(23)
  361. #define CAL_CSI2_COMPLEXIO_IRQ_STATEULPM5_MASK BIT_MASK(24)
  362. #define CAL_CSI2_COMPLEXIO_IRQ_STATEALLULPMENTER_MASK BIT_MASK(25)
  363. #define CAL_CSI2_COMPLEXIO_IRQ_STATEALLULPMEXIT_MASK BIT_MASK(26)
  364. #define CAL_CSI2_COMPLEXIO_IRQ_FIFO_OVR_MASK BIT_MASK(27)
  365. #define CAL_CSI2_COMPLEXIO_IRQ_SHORT_PACKET_MASK BIT_MASK(28)
  366. #define CAL_CSI2_COMPLEXIO_IRQ_ECC_NO_CORRECTION_MASK BIT_MASK(30)
  367. #define CAL_CSI2_TIMING_STOP_STATE_COUNTER_IO1_MASK GENMASK(12, 0)
  368. #define CAL_CSI2_TIMING_STOP_STATE_X4_IO1_MASK BIT_MASK(13)
  369. #define CAL_CSI2_TIMING_STOP_STATE_X16_IO1_MASK BIT_MASK(14)
  370. #define CAL_CSI2_TIMING_FORCE_RX_MODE_IO1_MASK BIT_MASK(15)
  371. #define CAL_CSI2_VC_IRQ_FS_IRQ_0_MASK BIT_MASK(0)
  372. #define CAL_CSI2_VC_IRQ_FE_IRQ_0_MASK BIT_MASK(1)
  373. #define CAL_CSI2_VC_IRQ_LS_IRQ_0_MASK BIT_MASK(2)
  374. #define CAL_CSI2_VC_IRQ_LE_IRQ_0_MASK BIT_MASK(3)
  375. #define CAL_CSI2_VC_IRQ_CS_IRQ_0_MASK BIT_MASK(4)
  376. #define CAL_CSI2_VC_IRQ_ECC_CORRECTION0_IRQ_0_MASK BIT_MASK(5)
  377. #define CAL_CSI2_VC_IRQ_FS_IRQ_1_MASK BIT_MASK(8)
  378. #define CAL_CSI2_VC_IRQ_FE_IRQ_1_MASK BIT_MASK(9)
  379. #define CAL_CSI2_VC_IRQ_LS_IRQ_1_MASK BIT_MASK(10)
  380. #define CAL_CSI2_VC_IRQ_LE_IRQ_1_MASK BIT_MASK(11)
  381. #define CAL_CSI2_VC_IRQ_CS_IRQ_1_MASK BIT_MASK(12)
  382. #define CAL_CSI2_VC_IRQ_ECC_CORRECTION0_IRQ_1_MASK BIT_MASK(13)
  383. #define CAL_CSI2_VC_IRQ_FS_IRQ_2_MASK BIT_MASK(16)
  384. #define CAL_CSI2_VC_IRQ_FE_IRQ_2_MASK BIT_MASK(17)
  385. #define CAL_CSI2_VC_IRQ_LS_IRQ_2_MASK BIT_MASK(18)
  386. #define CAL_CSI2_VC_IRQ_LE_IRQ_2_MASK BIT_MASK(19)
  387. #define CAL_CSI2_VC_IRQ_CS_IRQ_2_MASK BIT_MASK(20)
  388. #define CAL_CSI2_VC_IRQ_ECC_CORRECTION0_IRQ_2_MASK BIT_MASK(21)
  389. #define CAL_CSI2_VC_IRQ_FS_IRQ_3_MASK BIT_MASK(24)
  390. #define CAL_CSI2_VC_IRQ_FE_IRQ_3_MASK BIT_MASK(25)
  391. #define CAL_CSI2_VC_IRQ_LS_IRQ_3_MASK BIT_MASK(26)
  392. #define CAL_CSI2_VC_IRQ_LE_IRQ_3_MASK BIT_MASK(27)
  393. #define CAL_CSI2_VC_IRQ_CS_IRQ_3_MASK BIT_MASK(28)
  394. #define CAL_CSI2_VC_IRQ_ECC_CORRECTION0_IRQ_3_MASK BIT_MASK(29)
  395. #define CAL_CSI2_CTX_DT_MASK GENMASK(5, 0)
  396. #define CAL_CSI2_CTX_VC_MASK GENMASK(7, 6)
  397. #define CAL_CSI2_CTX_CPORT_MASK GENMASK(12, 8)
  398. #define CAL_CSI2_CTX_ATT_MASK BIT_MASK(13)
  399. #define CAL_CSI2_CTX_ATT_PIX 0
  400. #define CAL_CSI2_CTX_ATT 1
  401. #define CAL_CSI2_CTX_PACK_MODE_MASK BIT_MASK(14)
  402. #define CAL_CSI2_CTX_PACK_MODE_LINE 0
  403. #define CAL_CSI2_CTX_PACK_MODE_FRAME 1
  404. #define CAL_CSI2_CTX_LINES_MASK GENMASK(29, 16)
  405. #define CAL_CSI2_STATUS_FRAME_MASK GENMASK(15, 0)
  406. #define CAL_CSI2_PHY_REG0_THS_SETTLE_MASK GENMASK(7, 0)
  407. #define CAL_CSI2_PHY_REG0_THS_TERM_MASK GENMASK(15, 8)
  408. #define CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_MASK BIT_MASK(24)
  409. #define CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_DISABLE 1
  410. #define CAL_CSI2_PHY_REG0_HSCLOCKCONFIG_ENABLE 0
  411. #define CAL_CSI2_PHY_REG1_TCLK_SETTLE_MASK GENMASK(7, 0)
  412. #define CAL_CSI2_PHY_REG1_CTRLCLK_DIV_FACTOR_MASK GENMASK(9, 8)
  413. #define CAL_CSI2_PHY_REG1_DPHY_HS_SYNC_PATTERN_MASK GENMASK(17, 10)
  414. #define CAL_CSI2_PHY_REG1_TCLK_TERM_MASK GENMASK(24, 18)
  415. #define CAL_CSI2_PHY_REG1_CLOCK_MISS_DETECTOR_STATUS_MASK BIT_MASK(25)
  416. #define CAL_CSI2_PHY_REG1_CLOCK_MISS_DETECTOR_STATUS_ERROR 1
  417. #define CAL_CSI2_PHY_REG1_CLOCK_MISS_DETECTOR_STATUS_SUCCESS 0
  418. #define CAL_CSI2_PHY_REG1_RESET_DONE_STATUS_MASK GENMASK(29, 28)
  419. #define CAL_CSI2_PHY_REG2_CCP2_SYNC_PATTERN_MASK GENMASK(23, 0)
  420. #define CAL_CSI2_PHY_REG2_TRIGGER_CMD_RXTRIGESC3_MASK GENMASK(25, 24)
  421. #define CAL_CSI2_PHY_REG2_TRIGGER_CMD_RXTRIGESC2_MASK GENMASK(27, 26)
  422. #define CAL_CSI2_PHY_REG2_TRIGGER_CMD_RXTRIGESC1_MASK GENMASK(29, 28)
  423. #define CAL_CSI2_PHY_REG2_TRIGGER_CMD_RXTRIGESC0_MASK GENMASK(31, 30)
  424. #define CM_CAMERRX_CTRL_CSI1_CTRLCLKEN_MASK BIT_MASK(0)
  425. #define CM_CAMERRX_CTRL_CSI1_CAMMODE_MASK GENMASK(2, 1)
  426. #define CM_CAMERRX_CTRL_CSI1_LANEENABLE_MASK GENMASK(4, 3)
  427. #define CM_CAMERRX_CTRL_CSI1_MODE_MASK BIT_MASK(5)
  428. #define CM_CAMERRX_CTRL_CSI0_CTRLCLKEN_MASK BIT_MASK(10)
  429. #define CM_CAMERRX_CTRL_CSI0_CAMMODE_MASK GENMASK(12, 11)
  430. #define CM_CAMERRX_CTRL_CSI0_LANEENABLE_MASK GENMASK(16, 13)
  431. #define CM_CAMERRX_CTRL_CSI0_MODE_MASK BIT_MASK(17)
  432. #endif