omap_l3_smx.h 8.0 KB

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