omap_l3_smx.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * OMAP3XXX L3 Interconnect Driver header
  4. *
  5. * Copyright (C) 2011 Texas Corporation
  6. * Felipe Balbi <balbi@ti.com>
  7. * Santosh Shilimkar <santosh.shilimkar@ti.com>
  8. * sricharan <r.sricharan@ti.com>
  9. */
  10. #ifndef __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
  11. #define __ARCH_ARM_MACH_OMAP2_L3_INTERCONNECT_3XXX_H
  12. /* Register definitions. All 64-bit wide */
  13. #define L3_COMPONENT 0x000
  14. #define L3_CORE 0x018
  15. #define L3_AGENT_CONTROL 0x020
  16. #define L3_AGENT_STATUS 0x028
  17. #define L3_ERROR_LOG 0x058
  18. #define L3_ERROR_LOG_MULTI (1 << 31)
  19. #define L3_ERROR_LOG_SECONDARY (1 << 30)
  20. #define L3_ERROR_LOG_ADDR 0x060
  21. /* Register definitions for Sideband Interconnect */
  22. #define L3_SI_CONTROL 0x020
  23. #define L3_SI_FLAG_STATUS_0 0x510
  24. static const u64 shift = 1;
  25. #define L3_STATUS_0_MPUIA_BRST (shift << 0)
  26. #define L3_STATUS_0_MPUIA_RSP (shift << 1)
  27. #define L3_STATUS_0_MPUIA_INBAND (shift << 2)
  28. #define L3_STATUS_0_IVAIA_BRST (shift << 6)
  29. #define L3_STATUS_0_IVAIA_RSP (shift << 7)
  30. #define L3_STATUS_0_IVAIA_INBAND (shift << 8)
  31. #define L3_STATUS_0_SGXIA_BRST (shift << 9)
  32. #define L3_STATUS_0_SGXIA_RSP (shift << 10)
  33. #define L3_STATUS_0_SGXIA_MERROR (shift << 11)
  34. #define L3_STATUS_0_CAMIA_BRST (shift << 12)
  35. #define L3_STATUS_0_CAMIA_RSP (shift << 13)
  36. #define L3_STATUS_0_CAMIA_INBAND (shift << 14)
  37. #define L3_STATUS_0_DISPIA_BRST (shift << 15)
  38. #define L3_STATUS_0_DISPIA_RSP (shift << 16)
  39. #define L3_STATUS_0_DMARDIA_BRST (shift << 18)
  40. #define L3_STATUS_0_DMARDIA_RSP (shift << 19)
  41. #define L3_STATUS_0_DMAWRIA_BRST (shift << 21)
  42. #define L3_STATUS_0_DMAWRIA_RSP (shift << 22)
  43. #define L3_STATUS_0_USBOTGIA_BRST (shift << 24)
  44. #define L3_STATUS_0_USBOTGIA_RSP (shift << 25)
  45. #define L3_STATUS_0_USBOTGIA_INBAND (shift << 26)
  46. #define L3_STATUS_0_USBHOSTIA_BRST (shift << 27)
  47. #define L3_STATUS_0_USBHOSTIA_INBAND (shift << 28)
  48. #define L3_STATUS_0_SMSTA_REQ (shift << 48)
  49. #define L3_STATUS_0_GPMCTA_REQ (shift << 49)
  50. #define L3_STATUS_0_OCMRAMTA_REQ (shift << 50)
  51. #define L3_STATUS_0_OCMROMTA_REQ (shift << 51)
  52. #define L3_STATUS_0_IVATA_REQ (shift << 54)
  53. #define L3_STATUS_0_SGXTA_REQ (shift << 55)
  54. #define L3_STATUS_0_SGXTA_SERROR (shift << 56)
  55. #define L3_STATUS_0_GPMCTA_SERROR (shift << 57)
  56. #define L3_STATUS_0_L4CORETA_REQ (shift << 58)
  57. #define L3_STATUS_0_L4PERTA_REQ (shift << 59)
  58. #define L3_STATUS_0_L4EMUTA_REQ (shift << 60)
  59. #define L3_STATUS_0_MAD2DTA_REQ (shift << 61)
  60. #define L3_STATUS_0_TIMEOUT_MASK (L3_STATUS_0_MPUIA_BRST \
  61. | L3_STATUS_0_MPUIA_RSP \
  62. | L3_STATUS_0_IVAIA_BRST \
  63. | L3_STATUS_0_IVAIA_RSP \
  64. | L3_STATUS_0_SGXIA_BRST \
  65. | L3_STATUS_0_SGXIA_RSP \
  66. | L3_STATUS_0_CAMIA_BRST \
  67. | L3_STATUS_0_CAMIA_RSP \
  68. | L3_STATUS_0_DISPIA_BRST \
  69. | L3_STATUS_0_DISPIA_RSP \
  70. | L3_STATUS_0_DMARDIA_BRST \
  71. | L3_STATUS_0_DMARDIA_RSP \
  72. | L3_STATUS_0_DMAWRIA_BRST \
  73. | L3_STATUS_0_DMAWRIA_RSP \
  74. | L3_STATUS_0_USBOTGIA_BRST \
  75. | L3_STATUS_0_USBOTGIA_RSP \
  76. | L3_STATUS_0_USBHOSTIA_BRST \
  77. | L3_STATUS_0_SMSTA_REQ \
  78. | L3_STATUS_0_GPMCTA_REQ \
  79. | L3_STATUS_0_OCMRAMTA_REQ \
  80. | L3_STATUS_0_OCMROMTA_REQ \
  81. | L3_STATUS_0_IVATA_REQ \
  82. | L3_STATUS_0_SGXTA_REQ \
  83. | L3_STATUS_0_L4CORETA_REQ \
  84. | L3_STATUS_0_L4PERTA_REQ \
  85. | L3_STATUS_0_L4EMUTA_REQ \
  86. | L3_STATUS_0_MAD2DTA_REQ)
  87. #define L3_SI_FLAG_STATUS_1 0x530
  88. #define L3_STATUS_1_MPU_DATAIA (1 << 0)
  89. #define L3_STATUS_1_DAPIA0 (1 << 3)
  90. #define L3_STATUS_1_DAPIA1 (1 << 4)
  91. #define L3_STATUS_1_IVAIA (1 << 6)
  92. #define L3_PM_ERROR_LOG 0x020
  93. #define L3_PM_CONTROL 0x028
  94. #define L3_PM_ERROR_CLEAR_SINGLE 0x030
  95. #define L3_PM_ERROR_CLEAR_MULTI 0x038
  96. #define L3_PM_REQ_INFO_PERMISSION(n) (0x048 + (0x020 * n))
  97. #define L3_PM_READ_PERMISSION(n) (0x050 + (0x020 * n))
  98. #define L3_PM_WRITE_PERMISSION(n) (0x058 + (0x020 * n))
  99. #define L3_PM_ADDR_MATCH(n) (0x060 + (0x020 * n))
  100. /* L3 error log bit fields. Common for IA and TA */
  101. #define L3_ERROR_LOG_CODE 24
  102. #define L3_ERROR_LOG_INITID 8
  103. #define L3_ERROR_LOG_CMD 0
  104. /* L3 agent status bit fields. */
  105. #define L3_AGENT_STATUS_CLEAR_IA 0x10000000
  106. #define L3_AGENT_STATUS_CLEAR_TA 0x01000000
  107. #define OMAP34xx_IRQ_L3_APP 10
  108. #define L3_APPLICATION_ERROR 0x0
  109. #define L3_DEBUG_ERROR 0x1
  110. enum omap3_l3_initiator_id {
  111. /* LCD has 1 ID */
  112. OMAP_L3_LCD = 29,
  113. /* SAD2D has 1 ID */
  114. OMAP_L3_SAD2D = 28,
  115. /* MPU has 5 IDs */
  116. OMAP_L3_IA_MPU_SS_1 = 27,
  117. OMAP_L3_IA_MPU_SS_2 = 26,
  118. OMAP_L3_IA_MPU_SS_3 = 25,
  119. OMAP_L3_IA_MPU_SS_4 = 24,
  120. OMAP_L3_IA_MPU_SS_5 = 23,
  121. /* IVA2.2 SS has 3 IDs*/
  122. OMAP_L3_IA_IVA_SS_1 = 22,
  123. OMAP_L3_IA_IVA_SS_2 = 21,
  124. OMAP_L3_IA_IVA_SS_3 = 20,
  125. /* IVA 2.2 SS DMA has 6 IDS */
  126. OMAP_L3_IA_IVA_SS_DMA_1 = 19,
  127. OMAP_L3_IA_IVA_SS_DMA_2 = 18,
  128. OMAP_L3_IA_IVA_SS_DMA_3 = 17,
  129. OMAP_L3_IA_IVA_SS_DMA_4 = 16,
  130. OMAP_L3_IA_IVA_SS_DMA_5 = 15,
  131. OMAP_L3_IA_IVA_SS_DMA_6 = 14,
  132. /* SGX has 1 ID */
  133. OMAP_L3_IA_SGX = 13,
  134. /* CAM has 3 ID */
  135. OMAP_L3_IA_CAM_1 = 12,
  136. OMAP_L3_IA_CAM_2 = 11,
  137. OMAP_L3_IA_CAM_3 = 10,
  138. /* DAP has 1 ID */
  139. OMAP_L3_IA_DAP = 9,
  140. /* SDMA WR has 2 IDs */
  141. OMAP_L3_SDMA_WR_1 = 8,
  142. OMAP_L3_SDMA_WR_2 = 7,
  143. /* SDMA RD has 4 IDs */
  144. OMAP_L3_SDMA_RD_1 = 6,
  145. OMAP_L3_SDMA_RD_2 = 5,
  146. OMAP_L3_SDMA_RD_3 = 4,
  147. OMAP_L3_SDMA_RD_4 = 3,
  148. /* HSUSB OTG has 1 ID */
  149. OMAP_L3_USBOTG = 2,
  150. /* HSUSB HOST has 1 ID */
  151. OMAP_L3_USBHOST = 1,
  152. };
  153. enum omap3_l3_code {
  154. OMAP_L3_CODE_NOERROR = 0,
  155. OMAP_L3_CODE_UNSUP_CMD = 1,
  156. OMAP_L3_CODE_ADDR_HOLE = 2,
  157. OMAP_L3_CODE_PROTECT_VIOLATION = 3,
  158. OMAP_L3_CODE_IN_BAND_ERR = 4,
  159. /* codes 5 and 6 are reserved */
  160. OMAP_L3_CODE_REQ_TOUT_NOT_ACCEPT = 7,
  161. OMAP_L3_CODE_REQ_TOUT_NO_RESP = 8,
  162. /* codes 9 - 15 are also reserved */
  163. };
  164. struct omap3_l3 {
  165. struct device *dev;
  166. struct clk *ick;
  167. /* memory base*/
  168. void __iomem *rt;
  169. int debug_irq;
  170. int app_irq;
  171. /* true when and inband functional error occurs */
  172. unsigned inband:1;
  173. };
  174. /* offsets for l3 agents in order with the Flag status register */
  175. static unsigned int omap3_l3_app_bases[] = {
  176. /* MPU IA */
  177. 0x1400,
  178. 0x1400,
  179. 0x1400,
  180. /* RESERVED */
  181. 0,
  182. 0,
  183. 0,
  184. /* IVA 2.2 IA */
  185. 0x1800,
  186. 0x1800,
  187. 0x1800,
  188. /* SGX IA */
  189. 0x1c00,
  190. 0x1c00,
  191. /* RESERVED */
  192. 0,
  193. /* CAMERA IA */
  194. 0x5800,
  195. 0x5800,
  196. 0x5800,
  197. /* DISPLAY IA */
  198. 0x5400,
  199. 0x5400,
  200. /* RESERVED */
  201. 0,
  202. /*SDMA RD IA */
  203. 0x4c00,
  204. 0x4c00,
  205. /* RESERVED */
  206. 0,
  207. /* SDMA WR IA */
  208. 0x5000,
  209. 0x5000,
  210. /* RESERVED */
  211. 0,
  212. /* USB OTG IA */
  213. 0x4400,
  214. 0x4400,
  215. 0x4400,
  216. /* USB HOST IA */
  217. 0x4000,
  218. 0x4000,
  219. /* RESERVED */
  220. 0,
  221. 0,
  222. 0,
  223. 0,
  224. /* SAD2D IA */
  225. 0x3000,
  226. 0x3000,
  227. 0x3000,
  228. /* RESERVED */
  229. 0,
  230. 0,
  231. 0,
  232. 0,
  233. 0,
  234. 0,
  235. 0,
  236. 0,
  237. 0,
  238. 0,
  239. 0,
  240. 0,
  241. /* SMA TA */
  242. 0x2000,
  243. /* GPMC TA */
  244. 0x2400,
  245. /* OCM RAM TA */
  246. 0x2800,
  247. /* OCM ROM TA */
  248. 0x2C00,
  249. /* L4 CORE TA */
  250. 0x6800,
  251. /* L4 PER TA */
  252. 0x6c00,
  253. /* IVA 2.2 TA */
  254. 0x6000,
  255. /* SGX TA */
  256. 0x6400,
  257. /* L4 EMU TA */
  258. 0x7000,
  259. /* GPMC TA */
  260. 0x2400,
  261. /* L4 CORE TA */
  262. 0x6800,
  263. /* L4 PER TA */
  264. 0x6c00,
  265. /* L4 EMU TA */
  266. 0x7000,
  267. /* MAD2D TA */
  268. 0x3400,
  269. /* RESERVED */
  270. 0,
  271. 0,
  272. };
  273. static unsigned int omap3_l3_debug_bases[] = {
  274. /* MPU DATA IA */
  275. 0x1400,
  276. /* RESERVED */
  277. 0,
  278. 0,
  279. /* DAP IA */
  280. 0x5c00,
  281. 0x5c00,
  282. /* RESERVED */
  283. 0,
  284. /* IVA 2.2 IA */
  285. 0x1800,
  286. /* REST RESERVED */
  287. };
  288. static u32 *omap3_l3_bases[] = {
  289. omap3_l3_app_bases,
  290. omap3_l3_debug_bases,
  291. };
  292. /*
  293. * REVISIT define __raw_readll/__raw_writell here, but move them to
  294. * <asm/io.h> at some point
  295. */
  296. #define __raw_writell(v, a) (__chk_io_ptr(a), \
  297. *(volatile u64 __force *)(a) = (v))
  298. #define __raw_readll(a) (__chk_io_ptr(a), \
  299. *(volatile u64 __force *)(a))
  300. #endif