pcie-sh7786.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. /*
  2. * SH7786 PCI-Express controller definitions.
  3. *
  4. * Copyright (C) 2008, 2009 Renesas Technology Corp.
  5. * All rights reserved.
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #ifndef __PCI_SH7786_H
  12. #define __PCI_SH7786_H
  13. /* PCIe bus-0(x4) on SH7786 */ // Rev1.171
  14. #define SH4A_PCIE_SPW_BASE 0xFE000000 /* spw config address for controller 0 */
  15. #define SH4A_PCIE_SPW_BASE1 0xFE200000 /* spw config address for controller 1 (Rev1.14)*/
  16. #define SH4A_PCIE_SPW_BASE2 0xFCC00000 /* spw config address for controller 2 (Rev1.171)*/
  17. #define SH4A_PCIE_SPW_BASE_LEN 0x00080000
  18. #define SH4A_PCI_CNFG_BASE 0xFE040000 /* pci config address for controller 0 */
  19. #define SH4A_PCI_CNFG_BASE1 0xFE240000 /* pci config address for controller 1 (Rev1.14)*/
  20. #define SH4A_PCI_CNFG_BASE2 0xFCC40000 /* pci config address for controller 2 (Rev1.171)*/
  21. #define SH4A_PCI_CNFG_BASE_LEN 0x00040000
  22. #define SH4A_PCIPIO_ADDR_OFFSET 0x000001c0 /* offset to pci config_address */
  23. #define SH4A_PCIPIO_DATA_OFFSET 0x00000220 /* offset to pci config_data */
  24. /*
  25. * for PEX8111(Max Payload Size=128B,PCIIO_SIZE=64K),
  26. * for other(Max Payload Size=4096B,PCIIO_SIZE=8M)
  27. */
  28. /* PCI0: PCI memory target transfer 32-bit address translation value(Rev1.11T)*/
  29. #define SH4A_PCIBMSTR_TRANSLATION 0x20000000
  30. /* SPVCR0 */
  31. #define SH4A_PCIEVCR0 (0x000000) /* R - 0x0000 0000 32 */
  32. #define BITS_TOP_MB (24)
  33. #define MASK_TOP_MB (0xff<<BITS_TOP_MB)
  34. #define BITS_BOT_MB (16)
  35. #define MASK_BOT_MB (0xff<<BITS_BOT_MB)
  36. #define BITS_VC_ID (0)
  37. #define MASK_VC_ID (0xffff<<BITS_VC_ID)
  38. /* SPVCR1 */
  39. #define SH4A_PCIEVCR1 (0x000004) /* R - 0x0000 0000 32*/
  40. #define BITS_BADOPC (5) /* 5 BADOPC 0 R/W */
  41. #define MASK_BADOPC (1<<BITS_BADOPC)
  42. #define BITS_BADDEST (4) /*4 BADDEST 0 R/W */
  43. #define MASK_BADDEST (1<<BITS_BADDEST)
  44. #define BITS_UNSOLRESP (3) /* 3 UNSOLRESP 0 R/W */
  45. #define MASK_UNSOLRESP (1<<BITS_UNSOLRESP)
  46. #define BITS_ERRSNT (1) /* 1 ERRSNT 0 */
  47. #define MASK_ERRSNT (1<<BITS_ERRSNT)
  48. #define BITS_ERRRCV (0) /* 0 ERRRCV 0 */
  49. #define MASK_ERRRCV (1<<BITS_ERRRCV)
  50. /* PCIEENBLR */
  51. #define SH4A_PCIEENBLR (0x000008) /* R/W - 0x0000 0001 32 */
  52. /* PCIEECR */
  53. #define SH4A_PCIEECR (0x00000C) /* R/W - 0x0000 0000 32 */
  54. #define BITS_ENBL (0) /* 0 ENBL 0 R/W */
  55. #define MASK_ENBL (1<<BITS_ENBL)
  56. /* PCIEPAR */
  57. #define SH4A_PCIEPAR (0x000010) /* R/W - 0x0000 0000 32 */
  58. #define BITS_BN (24)
  59. #define MASK_BN (0xff<<BITS_BN)
  60. #define BITS_DN (19)
  61. #define MASK_DN (0x1f<<BITS_DN)
  62. #define BITS_FN (16)
  63. #define MASK_FN (0x7<<BITS_FN)
  64. #define BITS_EREGNO (8)
  65. #define MASK_EREGNO (0xff<<BITS_EREGNO)
  66. #define BITS_REGNO (2)
  67. #define MASK_REGNO (0x3f<<BITS_REGNO)
  68. /* PCIEPCTLR */
  69. #define SH4A_PCIEPCTLR (0x000018) /* R/W - 0x0000 0000 32 */
  70. #define BITS_CCIE (31) /* 31 CCIE */
  71. #define MASK_CCIE (1<<BITS_CCIE)
  72. #define BITS_TYPE (8)
  73. #define MASK_TYPE (1<<BITS_TYPE)
  74. #define BITS_C_VC (0)
  75. #define MASK_C_VC (1<<BITS_C_VC)
  76. /* PCIEPDR */
  77. #define SH4A_PCIEPDR (0x000020) /* R/W - 0x0000 0000 32 */
  78. #define BITS_PDR (0)
  79. #define MASK_PDR (0xffffffff<<BITS_PDR)
  80. /* PCIEMSGALR */
  81. #define SH4A_PCIEMSGALR (0x000030) /* R/W - 0x0000 0000 32 */
  82. #define BITS_MSGADRL (0)
  83. #define MASK_MSGADRL (0xffffffff<<BITS_MSGADRL)
  84. /* PCIEMSGAHR */
  85. #define SH4A_PCIEMSGAHR (0x000034) /* R/W - 0x0000 0000 32 */
  86. #define BITS_MSGADRH (0)
  87. #define MASK_MSGADRH (0xffffffff<<BITS_MSGADRH)
  88. /* PCIEMSGCTLR */
  89. #define SH4A_PCIEMSGCTLR (0x000038) /* R/W - 0x0000 0000 32 */
  90. #define BITS_MSGIE (31)
  91. #define MASK_MSGIE (1<<BITS_MSGIE)
  92. #define BITS_MROUTE (16)
  93. #define MASK_MROUTE (0x7<<BITS_MROUTE)
  94. #define BITS_MCODE (8)
  95. #define MASK_MCODE (0xff<<BITS_MCODE)
  96. #define BITS_M_VC (0)
  97. #define MASK_M_VC (1<<BITS_M_VC)
  98. /* PCIEMSG */
  99. #define SH4A_PCIEMSG (0x000040) /* W - - 32 */
  100. #define BITS_MDATA (0)
  101. #define MASK_MDATA (0xffffffff<<BITS_MDATA)
  102. /* PCIEUNLOCKCR */
  103. #define SH4A_PCIEUNLOCKCR (0x000048) /* R/W - 0x0000 0000 32 */
  104. /* PCIEIDR */
  105. #define SH4A_PCIEIDR (0x000060) /* R/W - 0x0101 1101 32 */
  106. /* PCIEDBGCTLR */
  107. #define SH4A_PCIEDBGCTLR (0x000100) /* R/W - 0x0000 0000 32 */
  108. /* PCIEINTXR */
  109. #define SH4A_PCIEINTXR (0x004000) /* R/W - 0x0000 0000 32 */
  110. /* PCIERMSGR */
  111. #define SH4A_PCIERMSGR (0x004010) /* R/W - 0x0000 0000 32 */
  112. /* PCIERSTR */
  113. #define SH4A_PCIERSTR(x) (0x008000 + ((x) * 0x4)) /* R/W - 0x0000 0000 32 */
  114. /* PCIESRSTR */
  115. #define SH4A_PCIESRSTR (0x008040) /* R/W - 0x0000 0000 32 */
  116. /* PCIEPHYCTLR */
  117. #define SH4A_PCIEPHYCTLR (0x010000) /* R/W - 0x0000 0000 32 */
  118. #define BITS_CKE (0)
  119. #define MASK_CKE (1<<BITS_CKE)
  120. /* PCIERMSGIER */
  121. #define SH4A_PCIERMSGIER (0x004040) /* R/W - 0x0000 0000 32 */
  122. /* PCIEPHYADRR */
  123. #define SH4A_PCIEPHYADRR (0x010004) /* R/W - 0x0000 0000 32 */
  124. #define BITS_ACK (24) // Rev1.171
  125. #define MASK_ACK (1<<BITS_ACK) // Rev1.171
  126. #define BITS_CMD (16) // Rev1.171
  127. #define MASK_CMD (0x03<<BITS_CMD) // Rev1.171
  128. #define BITS_LANE (8)
  129. #define MASK_LANE (0x0f<<BITS_LANE)
  130. #define BITS_ADR (0)
  131. #define MASK_ADR (0xff<<BITS_ADR)
  132. /* PCIEPHYDINR */ // Rev1.171 start.
  133. #define SH4A_PCIEPHYDINR (0x010008) /* R/W - 0x0000 0000 32 */
  134. /* PCIEPHYDOUTR */
  135. #define SH4A_PCIEPHYDOUTR (0x01000C) /* R/W - 0x0000 0000 32 */
  136. /* PCIEPHYSR */
  137. #define SH4A_PCIEPHYSR (0x010010) /* R/W - 0x0000 0000 32 */ // Rev1.171 end.
  138. /* PCIEPHYDATAR */
  139. #define SH4A_PCIEPHYDATAR (0x00008) /* R/W - 0xxxxx xxxx 32 */
  140. #define BITS_DATA (0)
  141. #define MASK_DATA (0xffffffff<<BITS_DATA)
  142. /* PCIETCTLR */
  143. #define SH4A_PCIETCTLR (0x020000) /* R/W R/W 0x0000 0000 32 */
  144. #define BITS_CFINT (0)
  145. #define MASK_CFINT (1<<BITS_CFINT)
  146. /* PCIETSTR */
  147. #define SH4A_PCIETSTR (0x020004) /* R 0x0000 0000 32 */
  148. /* PCIEINTR */
  149. #define SH4A_PCIEINTR (0x020008) /* R/W R/W 0x0000 0000 32 */
  150. #define BITS_INT_RX_ERP (31)
  151. #define MASK_INT_RX_ERP (1<<BITS_INT_RX_ERP)
  152. #define BITS_INT_RX_VCX_Posted (30)
  153. #define MASK_INT_RX_VCX_Posted (1<<BITS_INT_RX_VCX_Posted)
  154. #define BITS_INT_RX_VCX_NonPosted (29)
  155. #define MASK_INT_RX_VCX_NonPosted (1<<BITS_INT_RX_VCX_NonPosted)
  156. #define BITS_INT_RX_VCX_CPL (28)
  157. #define MASK_INT_RX_VCX_CPL (1<<BITS_INT_RX_VCX_CPL)
  158. #define BITS_INT_TX_VCX_Posted (26)
  159. #define MASK_INT_TX_VCX_Posted (1<<BITS_INT_TX_VCX_Posted)
  160. #define BITS_INT_TX_VCX_NonPosted (25)
  161. #define MASK_INT_TX_VCX_NonPosted (1<<BITS_INT_TX_VCX_NonPosted)
  162. #define BITS_INT_TX_VCX_CPL (24)
  163. #define MASK_INT_TX_VCX_CPL (1<<BITS_INT_TX_VCX_CPL)
  164. #define BITS_INT_RX_VC0_Posted (22)
  165. #define MASK_INT_RX_VC0_Posted (1<<BITS_INT_RX_VC0_Posted)
  166. #define BITS_INT_RX_VC0_NonPosted (21)
  167. #define MASK_INT_RX_VC0_NonPosted (1<<BITS_INT_RX_VC0_NonPosted)
  168. #define BITS_INT_RX_VC0_CPL (20)
  169. #define MASK_INT_RX_VC0_CPL (1<<BITS_INT_RX_VC0_CPL)
  170. #define BITS_INT_TX_VC0_Posted (18)
  171. #define MASK_INT_TX_VC0_Posted (1<<BITS_INT_TX_VC0_Posted)
  172. #define BITS_INT_TX_VC0_NonPosted (17)
  173. #define MASK_INT_TX_VC0_NonPosted (1<<BITS_INT_TX_VC0_NonPosted)
  174. #define BITS_INT_TX_VC0_CPL (16)
  175. #define MASK_INT_TX_VC0_CPL (1<<BITS_INT_TX_VC0_CPL)
  176. #define BITS_INT_RX_CTRL (15)
  177. #define MASK_INT_RX_CTRL (1<<BITS_INT_RX_CTRL)
  178. #define BITS_INT_TX_CTRL (14)
  179. #define MASK_INT_TX_CTRL (1<<BITS_INT_TX_CTRL)
  180. #define BITS_INTTL (11)
  181. #define MASK_INTTL (1<<BITS_INTTL)
  182. #define BITS_INTDL (10)
  183. #define MASK_INTDL (1<<BITS_INTDL)
  184. #define BITS_INTMAC (9)
  185. #define MASK_INTMAC (1<<BITS_INTMAC)
  186. #define BITS_INTPM (8)
  187. #define MASK_INTPM (1<<BITS_INTPM)
  188. /* PCIEINTER */
  189. #define SH4A_PCIEINTER (0x02000C) /* R/W R/W 0x0000 0000 32 */
  190. #define BITS_INT_RX_ERP (31)
  191. #define MASK_INT_RX_ERP (1<<BITS_INT_RX_ERP)
  192. #define BITS_INT_RX_VCX_Posted (30)
  193. #define MASK_INT_RX_VCX_Posted (1<<BITS_INT_RX_VCX_Posted)
  194. #define BITS_INT_RX_VCX_NonPosted (29)
  195. #define MASK_INT_RX_VCX_NonPosted (1<<BITS_INT_RX_VCX_NonPosted)
  196. #define BITS_INT_RX_VCX_CPL (28)
  197. #define MASK_INT_RX_VCX_CPL (1<<BITS_INT_RX_VCX_CPL)
  198. #define BITS_INT_TX_VCX_Posted (26)
  199. #define MASK_INT_TX_VCX_Posted (1<<BITS_INT_TX_VCX_Posted)
  200. #define BITS_INT_TX_VCX_NonPosted (25)
  201. #define MASK_INT_TX_VCX_NonPosted (1<<BITS_INT_TX_VCX_NonPosted)
  202. #define BITS_INT_TX_VCX_CPL (24)
  203. #define MASK_INT_TX_VCX_CPL (1<<BITS_INT_TX_VCX_CPL)
  204. #define BITS_INT_RX_VC0_Posted (22)
  205. #define MASK_INT_RX_VC0_Posted (1<<BITS_INT_RX_VC0_Posted)
  206. #define BITS_INT_RX_VC0_NonPosted (21)
  207. #define MASK_INT_RX_VC0_NonPosted (1<<BITS_INT_RX_VC0_NonPosted)
  208. #define BITS_INT_RX_VC0_CPL (20)
  209. #define MASK_INT_RX_VC0_CPL (1<<BITS_INT_RX_VC0_CPL)
  210. #define BITS_INT_TX_VC0_Posted (18)
  211. #define MASK_INT_TX_VC0_Posted (1<<BITS_INT_TX_VC0_Posted)
  212. #define BITS_INT_TX_VC0_NonPosted (17)
  213. #define MASK_INT_TX_VC0_NonPosted (1<<BITS_INT_TX_VC0_NonPosted)
  214. #define BITS_INT_TX_VC0_CPL (16)
  215. #define MASK_INT_TX_VC0_CPL (1<<BITS_INT_TX_VC0_CPL)
  216. #define BITS_INT_RX_CTRL (15)
  217. #define MASK_INT_RX_CTRL (1<<BITS_INT_RX_CTRL)
  218. #define BITS_INT_TX_CTRL (14)
  219. #define MASK_INT_TX_CTRL (1<<BITS_INT_TX_CTRL)
  220. #define BITS_INTTL (11)
  221. #define MASK_INTTL (1<<BITS_INTTL)
  222. #define BITS_INTDL (10)
  223. #define MASK_INTDL (1<<BITS_INTDL)
  224. #define BITS_INTMAC (9)
  225. #define MASK_INTMAC (1<<BITS_INTMAC)
  226. #define BITS_INTPM (8)
  227. #define MASK_INTPM (1<<BITS_INTPM)
  228. /* PCIEEH0R */
  229. #define SH4A_PCIEEHR(x) (0x020010 + ((x) * 0x4)) /* R - 0x0000 0000 32 */
  230. /* PCIEAIR */
  231. #define SH4A_PCIEAIR (SH4A_PCIE_BASE + 0x020010) /* R/W R/W 0xxxxx xxxx 32 */
  232. /* PCIECIR */
  233. #define SH4A_PCIECIR (SH4A_PCIE_BASE) /* R/W R/W 0xxxxx xxxx 32 */
  234. /* PCIEERRFR */ // Rev1.18
  235. #define SH4A_PCIEERRFR (0x020020) /* R/W R/W 0xxxxx xxxx 32 */ // Rev1.18
  236. /* PCIEERRFER */
  237. #define SH4A_PCIEERRFER (0x020024) /* R/W R/W 0x0000 0000 32 */
  238. /* PCIEERRFR2 */
  239. #define SH4A_PCIEERRFR2 (0x020028) /* R/W R/W 0x0000 0000 32 */
  240. /* PCIEMSIR */
  241. #define SH4A_PCIEMSIR (0x020040) /* R/W - 0x0000 0000 32 */
  242. /* PCIEMSIFR */
  243. #define SH4A_PCIEMSIFR (0x020044) /* R/W R/W 0x0000 0000 32 */
  244. /* PCIEPWRCTLR */
  245. #define SH4A_PCIEPWRCTLR (0x020100) /* R/W - 0x0000 0000 32 */
  246. /* PCIEPCCTLR */
  247. #define SH4A_PCIEPCCTLR (0x020180) /* R/W - 0x0000 0000 32 */
  248. // Rev1.18
  249. /* PCIELAR0 */
  250. #define SH4A_PCIELAR0 (0x020200) /* R/W R/W 0x0000 0000 32 */
  251. #define BITS_LARn (20)
  252. #define MASK_LARn (0xfff<<BITS_LARn)
  253. #define SH4A_PCIE_020204 (0x020204) /* R/W R/W 0x0000 0000 32 */
  254. /* PCIELAMR0 */
  255. #define SH4A_PCIELAMR0 (0x020208) /* R/W R/W 0x0000 0000 32 */
  256. #define BITS_LAMRn (20)
  257. #define MASK_LAMRn (0x1ff<<BITS_LAMRn)
  258. #define BITS_LAREn (0)
  259. #define MASK_LAREn (0x1<<BITS_LAREn)
  260. /* PCIECSCR0 */
  261. #define SH4A_PCIECSCR0 (0x020210) /* R/W R/W 0x0000 0000 32 */
  262. #define BITS_RANGE (2)
  263. #define MASK_RANGE (0x7<<BITS_RANGE)
  264. #define BITS_SNPMD (0)
  265. #define MASK_SNPMD (0x3<<BITS_SNPMD)
  266. /* PCIECSAR0 */
  267. #define SH4A_PCIECSAR0 (0x020214) /* R/W R/W 0x0000 0000 32 */
  268. #define BITS_CSADR (0)
  269. #define MASK_CSADR (0xffffffff<<BITS_CSADR)
  270. /* PCIESTCTLR0 */
  271. #define SH4A_PCIESTCTLR0 (0x020218) /* R/W R/W 0x0000 0000 32 */
  272. #define BITS_SHPRI (8)
  273. #define MASK_SHPRI (0x0f<<BITS_SHPRI)
  274. #define SH4A_PCIE_020224 (0x020224) /* R/W R/W 0x0000 0000 32 */
  275. #define SH4A_PCIELAR1 (0x020220) /* R/W R/W 0x0000 0000 32 */
  276. #define SH4A_PCIELAMR1 (0x020228) /* R/W R/W 0x0000 0000 32 */
  277. #define SH4A_PCIECSCR1 (0x020230) /* R/W R/W 0x0000 0000 32 */
  278. #define SH4A_PCIECSAR1 (0x020234) /* R/W R/W 0x0000 0000 32 */
  279. #define SH4A_PCIESTCTLR1 (0x020238) /* R/W R/W 0x0000 0000 32 */
  280. #define SH4A_PCIELAR2 (0x020240) /* R/W R/W 0x0000 0000 32 */
  281. #define SH4A_PCIE_020244 (0x020244) /* R/W R/W 0x0000 0000 32 */
  282. #define SH4A_PCIELAMR2 (0x020248) /* R/W R/W 0x0000 0000 32 */
  283. #define SH4A_PCIECSCR2 (0x020250) /* R/W R/W 0x0000 0000 32 */
  284. #define SH4A_PCIECSAR2 (0x020254) /* R/W R/W 0x0000 0000 32 */
  285. #define SH4A_PCIESTCTLR2 (0x020258) /* R/W R/W 0x0000 0000 32 */
  286. #define SH4A_PCIELAR3 (0x020260) /* R/W R/W 0x0000 0000 32 */
  287. #define SH4A_PCIE_020264 (0x020264) /* R/W R/W 0x0000 0000 32 */
  288. #define SH4A_PCIELAMR3 (0x020268) /* R/W R/W 0x0000 0000 32 */
  289. #define SH4A_PCIECSCR3 (0x020270) /* R/W R/W 0x0000 0000 32 */
  290. #define SH4A_PCIECSAR3 (0x020274) /* R/W R/W 0x0000 0000 32 */
  291. #define SH4A_PCIESTCTLR3 (0x020278) /* R/W R/W 0x0000 0000 32 */
  292. #define SH4A_PCIELAR4 (0x020280) /* R/W R/W 0x0000 0000 32 */
  293. #define SH4A_PCIE_020284 (0x020284) /* R/W R/W 0x0000 0000 32 */
  294. #define SH4A_PCIELAMR4 (0x020288) /* R/W R/W 0x0000 0000 32 */
  295. #define SH4A_PCIECSCR4 (0x020290) /* R/W R/W 0x0000 0000 32 */
  296. #define SH4A_PCIECSAR4 (0x020294) /* R/W R/W 0x0000 0000 32 */
  297. #define SH4A_PCIESTCTLR4 (0x020298) /* R/W R/W 0x0000 0000 32 */
  298. #define SH4A_PCIELAR5 (0x0202A0) /* R/W R/W 0x0000 0000 32 */
  299. #define SH4A_PCIE_0202A4 (0x0202A4) /* R/W R/W 0x0000 0000 32 */
  300. #define SH4A_PCIELAMR5 (0x0202A8) /* R/W R/W 0x0000 0000 32 */
  301. #define SH4A_PCIECSCR5 (0x0202B0) /* R/W R/W 0x0000 0000 32 */
  302. #define SH4A_PCIECSAR5 (0x0202B4) /* R/W R/W 0x0000 0000 32 */
  303. #define SH4A_PCIESTCTLR5 (0x0202B8) /* R/W R/W 0x0000 0000 32 */
  304. /* PCIEPARL */
  305. #define SH4A_PCIEPARL(x) (0x020400 + ((x) * 0x20)) /* R/W R/W 0x0000 0000 32 */
  306. #define BITS_PAL (18)
  307. #define MASK_PAL (0x3fff<<BITS_PAL)
  308. /* PCIEPARH */
  309. #define SH4A_PCIEPARH(x) (0x020404 + ((x) * 0x20)) /* R/W R/W 0x0000 0000 32 */
  310. #define BITS_PAH (0)
  311. #define MASK_PAH (0xffffffff<<BITS_PAH)
  312. /* PCIEPAMR */
  313. #define SH4A_PCIEPAMR(x) (0x020408 + ((x) * 0x20)) /* R/W R/W 0x0000 0000 32 */
  314. #define BITS_PAM (18)
  315. #define MASK_PAM (0x3fff<<BITS_PAM)
  316. /* PCIEPTCTLR */
  317. #define SH4A_PCIEPTCTLR(x) (0x02040C + ((x) * 0x20))
  318. #define BITS_PARE (31)
  319. #define MASK_PARE (0x1<<BITS_PARE)
  320. #define BITS_TC (20)
  321. #define MASK_TC (0x7<<BITS_TC)
  322. #define BITS_T_VC (16)
  323. #define MASK_T_VC (0x1<<BITS_T_VC)
  324. #define BITS_LOCK (12)
  325. #define MASK_LOCK (0x1<<BITS_LOCK)
  326. #define BITS_SPC (8)
  327. #define MASK_SPC (0x1<<BITS_SPC)
  328. #define SH4A_PCIEDMAOR (0x021000) /* R/W R/W 0x0000 0000 32 */
  329. #define SH4A_PCIEDMSAR0 (0x021100) /* R/W R/W 0x0000 0000 32 */
  330. #define SH4A_PCIEDMSAHR0 (0x021104) /* R/W R/W 0x0000 0000 32 */
  331. #define SH4A_PCIEDMDAR0 (0x021108) /* R/W R/W 0x0000 0000 32 */
  332. #define SH4A_PCIEDMDAHR0 (0x02110C) /* R/W R/W 0x0000 0000 32 */
  333. #define SH4A_PCIEDMBCNTR0 (0x021110) /* R/W R/W 0x0000 0000 32 */
  334. #define SH4A_PCIEDMSBCNTR0 (0x021114) /* R/W R/W 0x0000 0000 32 */
  335. #define SH4A_PCIEDMSTRR0 (0x021118) /* R/W R/W 0x0000 0000 32 */
  336. #define SH4A_PCIEDMCCAR0 (0x02111C) /* R/W R/W 0x0000 0000 32 */
  337. #define SH4A_PCIEDMCCR0 (0x021120) /* R/W R/W 0x0000 0000 32 */
  338. #define SH4A_PCIEDMCC2R0 (0x021124) /* R/W R/W 0x0000 0000 - */
  339. #define SH4A_PCIEDMCCCR0 (0x021128) /* R/W R/W 0x0000 0000 32 */
  340. #define SH4A_PCIEDMCHSR0 (0x02112C) /* R/W - 0x0000 0000 32 */
  341. #define SH4A_PCIEDMSAR1 (0x021140) /* R/W R/W 0x0000 0000 32 */
  342. #define SH4A_PCIEDMSAHR1 (0x021144) /* R/W R/W 0x0000 0000 32 */
  343. #define SH4A_PCIEDMDAR1 (0x021148) /* R/W R/W 0x0000 0000 32 */
  344. #define SH4A_PCIEDMDAHR1 (0x02114C) /* R/W R/W 0x0000 0000 32 */
  345. #define SH4A_PCIEDMBCNTR1 (0x021150) /* R/W R/W 0x0000 0000 32 */
  346. #define SH4A_PCIEDMSBCNTR1 (0x021154) /* R/W R/W 0x0000 0000 32 */
  347. #define SH4A_PCIEDMSTRR1 (0x021158) /* R/W R/W 0x0000 0000 32 */
  348. #define SH4A_PCIEDMCCAR1 (0x02115C) /* R/W R/W 0x0000 0000 32 */
  349. #define SH4A_PCIEDMCCR1 (0x021160) /* R/W R/W 0x0000 0000 32 */
  350. #define SH4A_PCIEDMCC2R1 (0x021164) /* R/W R/W 0x0000 0000 - */
  351. #define SH4A_PCIEDMCCCR1 (0x021168) /* R/W R/W 0x0000 0000 32 */
  352. #define SH4A_PCIEDMCHSR1 (0x02116C) /* R/W - 0x0000 0000 32 */
  353. #define SH4A_PCIEDMSAR2 (0x021180) /* R/W R/W 0x0000 0000 32 */
  354. #define SH4A_PCIEDMSAHR2 (0x021184) /* R/W R/W 0x0000 0000 32 */
  355. #define SH4A_PCIEDMDAR2 (0x021188) /* R/W R/W 0x0000 0000 32 */
  356. #define SH4A_PCIEDMDAHR2 (0x02118C) /* R/W R/W 0x0000 0000 32 */
  357. #define SH4A_PCIEDMBCNTR2 (0x021190) /* R/W R/W 0x0000 0000 32 */
  358. #define SH4A_PCIEDMSBCNTR2 (0x021194) /* R/W R/W 0x0000 0000 32 */
  359. #define SH4A_PCIEDMSTRR2 (0x021198) /* R/W R/W 0x0000 0000 32 */
  360. #define SH4A_PCIEDMCCAR2 (0x02119C) /* R/W R/W 0x0000 0000 32 */
  361. #define SH4A_PCIEDMCCR2 (0x0211A0) /* R/W R/W 0x0000 0000 32 */
  362. #define SH4A_PCIEDMCC2R2 (0x0211A4) /* R/W R/W 0x0000 0000 - */
  363. #define SH4A_PCIEDMCCCR2 (0x0211A8) /* R/W R/W 0x0000 0000 32 */
  364. #define SH4A_PCIEDMSAR3 (0x0211C0) /* R/W R/W 0x0000 0000 32 */
  365. #define SH4A_PCIEDMSAHR3 (0x0211C4) /* R/W R/W 0x0000 0000 32 */
  366. #define SH4A_PCIEDMDAR3 (0x0211C8) /* R/W R/W 0x0000 0000 32 */
  367. #define SH4A_PCIEDMDAHR3 (0x0211CC) /* R/W R/W 0x0000 0000 32 */
  368. #define SH4A_PCIEDMBCNTR3 (0x0211D0) /* R/W R/W 0x0000 0000 32 */
  369. #define SH4A_PCIEDMSBCNTR3 (0x0211D4) /* R/W R/W 0x0000 0000 32 */
  370. #define SH4A_PCIEDMSTRR3 (0x0211D8) /* R/W R/W 0x0000 0000 32 */
  371. #define SH4A_PCIEDMCCAR3 (0x0211DC) /* R/W R/W 0x0000 0000 32 */
  372. #define SH4A_PCIEDMCCR3 (0x0211E0) /* R/W R/W 0x0000 0000 32 */
  373. #define SH4A_PCIEDMCC2R3 (0x0211E4) /* R/W R/W 0x0000 0000 - */
  374. #define SH4A_PCIEDMCCCR3 (0x0211E8) /* R/W R/W 0x0000 0000 32 */
  375. #define SH4A_PCIEDMCHSR3 (0x0211EC) /* R/W R/W 0x0000 0000 32 */
  376. #define SH4A_PCIEPCICONF0 (0x040000) /* R R - 8/16/32 */
  377. #define SH4A_PCIEPCICONF1 (0x040004) /* R/W R/W 0x0008 0000 8/16/32 */
  378. #define SH4A_PCIEPCICONF2 (0x040008) /* R/W R/W 0xFF00 0000 8/16/32 */
  379. #define SH4A_PCIEPCICONF3 (0x04000C) /* R/W R/W 0x0000 0000 8/16/32 */
  380. #define SH4A_PCIEPCICONF4 (0x040010) /* - R/W - 8/16/32 */
  381. #define SH4A_PCIEPCICONF5 (0x040014) /* - R/W - 8/16/32 */
  382. #define SH4A_PCIEPCICONF6 (0x040018) /* - R/W - 8/16/32 */
  383. #define SH4A_PCIEPCICONF7 (0x04001C) /* - R/W - 8/16/32 */
  384. #define SH4A_PCIEPCICONF8 (0x040020) /* - R/W - 8/16/32 */
  385. #define SH4A_PCIEPCICONF9 (0x040024) /* - R/W - 8/16/32 */
  386. #define SH4A_PCIEPCICONF10 (0x040028) /* R/W R/W 0x0000 0000 8/16/32 */
  387. #define SH4A_PCIEPCICONF11 (0x04002C) /* R/W R/W 0x0000 0000 8/16/32 */
  388. #define SH4A_PCIEPCICONF12 (0x040030) /* R/W R/W 0x0000 0000 8/16/32 */
  389. #define SH4A_PCIEPCICONF13 (0x040034) /* R/W R/W 0x0000 0040 8/16/32 */
  390. #define SH4A_PCIEPCICONF14 (0x040038) /* R/W R/W 0x0000 0000 8/16/32 */
  391. #define SH4A_PCIEPCICONF15 (0x04003C) /* R/W R/W 0x0000 00FF 8/16/32 */
  392. #define SH4A_PCIEPMCAP0 (0x040040) /* R/W R 0x0003 5001 8/16/32 */
  393. #define SH4A_PCIEPMCAP1 (0x040044) /* R/W R/W 0x0000 0000 8/16/32 */
  394. #define SH4A_PCIEMSICAP0 (0x040050) /* R/W R/W 0x0180 7005 8/16/32 */
  395. #define SH4A_PCIEMSICAP1 (0x040054) /* R/W R/W 0x0000 0000 8/16/32 */
  396. #define SH4A_PCIEMSICAP2 (0x040058) /* R/W R/W 0x0000 0000 8/16/32 */
  397. #define SH4A_PCIEMSICAP3 (0x04005C) /* R/W R/W 0x0000 0000 8/16/32 */
  398. #define SH4A_PCIEMSICAP4 (0x040060) /* R/W R/W 0x0000 0000 8/16/32 */
  399. #define SH4A_PCIEMSICAP5 (0x040064) /* R/W R/W 0x0000 0000 8/16/32 */
  400. #define SH4A_PCIEEXPCAP0 (0x040070) /* R/W R/W 0x0001 0010 8/16/32 */
  401. #define SH4A_PCIEEXPCAP1 (0x040074) /* R/W R 0x0000 0005 8/16/32 */
  402. #define SH4A_PCIEEXPCAP2 (0x040078) /* R/W R/W 0x0000 0801 8/16/32 */
  403. #define SH4A_PCIEEXPCAP3 (0x04007C) /* R/W R 0x0003 F421 8/16/32 */
  404. #define SH4A_PCIEEXPCAP4 (0x040080) /* R/W R/W 0x0041 0000 8/16/32 */
  405. #define SH4A_PCIEEXPCAP5 (0x040084) /* R/W R/W 0x0000 0000 8/16/32 */
  406. #define SH4A_PCIEEXPCAP6 (0x040088) /* R/W R/W 0x0000 03C0 8/16/32 */
  407. #define SH4A_PCIEEXPCAP7 (0x04008C) /* R/W R/W 0x0000 0000 8/16/32 */
  408. #define SH4A_PCIEEXPCAP8 (0x040090) /* R/W R/W 0x0000 0000 8/16/32 */
  409. #define SH4A_PCIEVCCAP0 (0x040100) /* R/W R 0x1B01 0002 8/16/32 */
  410. #define SH4A_PCIEVCCAP1 (0x040104) /* R R 0x0000 0001 8/16/32 */
  411. #define SH4A_PCIEVCCAP2 (0x040108) /* R R 0x0000 0000 8/16/32 */
  412. #define SH4A_PCIEVCCAP3 (0x04010C) /* R R/W 0x0000 0000 8/16/32 */
  413. #define SH4A_PCIEVCCAP4 (0x040110) /* R/W R/W 0x0000 0000 8/16/32 */
  414. #define SH4A_PCIEVCCAP5 (0x040114) /* R/W R/W 0x8000 00FF 8/16/32 */
  415. #define SH4A_PCIEVCCAP6 (0x040118) /* R/W R 0x0002 0000 8/16/32 */
  416. #define SH4A_PCIEVCCAP7 (0x04011C) /* R/W R/W 0x0000 0000 8/16/32 */
  417. #define SH4A_PCIEVCCAP8 (0x040120) /* R/W R/W 0x0000 0000 8/16/32 */
  418. #define SH4A_PCIEVCCAP9 (0x040124) /* R/W R 0x0002 0000 8/16/32 */
  419. #define SH4A_PCIENUMCAP0 (0x0001B0) /* RW R 0x0001 0003 8/16/32 */
  420. #define SH4A_PCIENUMCAP1 (0x0001B4) /* R R 0x0000 0000 8/16/32 */
  421. #define SH4A_PCIENUMCAP2 (0x0001B8) /* R R 0x0000 0000 8/16/32 */
  422. #define SH4A_PCIEIDSETR0 (0x041000) /* R/W R 0x0000 FFFF 16/32 */
  423. #define SH4A_PCIEIDSETR1 (0x041004) /* R/W R 0xFF00 0000 16/32 */
  424. #define SH4A_PCIEBAR0SETR (0x041008) /* R/W R 0x0000 0000 16/32 */
  425. #define SH4A_PCIEBAR1SETR (0x04100C) /* R/W R 0x0000 0000 16/32 */
  426. #define SH4A_PCIEBAR2SETR (0x041010) /* R/W R 0x0000 0000 16/32 */
  427. #define SH4A_PCIEBAR3SETR (0x041014) /* R/W R 0x0000 0000 16/32 */
  428. #define SH4A_PCIEBAR4SETR (0x041018) /* R/W R 0x0000 0000 16/32 */
  429. #define SH4A_PCIEBAR5SETR (0x04101C) /* R/W R 0x0000 0000 16/32 */
  430. #define SH4A_PCIECISSETR (0x041020) /* R/W R 0x0000 0000 16/32 */
  431. #define SH4A_PCIEIDSETR2 (0x041024) /* R/W R 0x0000 0000 16/32 */
  432. #define SH4A_PCIEEROMSETR (0x041028) /* R/W R 0x0000 0000 16/32 */
  433. #define SH4A_PCIEDSERSETR0 (0x04102C) /* R/W R 0x0000 0000 16/32 */
  434. #define SH4A_PCIEDSERSETR1 (0x041030) /* R/W R 0x0000 0000 16/32 */
  435. #define SH4A_PCIECTLR (0x041040) /* R/W R 0x0000 0000 16/32 */
  436. #define SH4A_PCIETLSR (0x041044) /* R/W1C R 0x0000 0000 16/32 */
  437. #define SH4A_PCIETLCTLR (0x041048) /* R/W R 0x0000 0000 16/32 */
  438. #define SH4A_PCIEDLSR (0x04104C) /* R/W1C R 0x4003 0000 16/32 */
  439. #define SH4A_PCIEDLCTLR (0x041050) /* R R 0x0000 0000 16/32 */
  440. #define SH4A_PCIEMACSR (0x041054) /* R/W1C R 0x0041 0000 16/32 */
  441. #define SH4A_PCIEMACCTLR (0x041058) /* R/W R 0x0000 0000 16/32 */
  442. #define PCIEMACCTLR_SCR_DIS (1 << 27) /* scramble disable */
  443. #define SH4A_PCIEPMSTR (0x04105C) /* R/W1C R 0x0000 0000 16/32 */
  444. #define SH4A_PCIEPMCTLR (0x041060) /* R/W R 0x0000 0000 16/32 */
  445. #define SH4A_PCIETLINTENR (0x041064) /* R/W R 0x0000 0000 16/32 */
  446. #define SH4A_PCIEDLINTENR (0x041068) /* R/W R 0x0000 0000 16/32 */
  447. #define PCIEDLINTENR_DLL_ACT_ENABLE (1 << 31) /* DL active irq */
  448. #define SH4A_PCIEMACINTENR (0x04106C) /* R/W R 0x0000 0000 16/32 */
  449. #define SH4A_PCIEPMINTENR (0x041070) /* R/W R 0x0000 0000 16/32 */
  450. #define SH4A_PCIETXDCTLR (0x044000) /* R/W - H'00000000_00000000 32/64 */
  451. #define SH4A_PCIETXCTLR (0x044020) /* R/W - H'00000000_00000000 32/64 */
  452. #define SH4A_PCIETXSR (0x044028) /* R - H'00000000_00000000 32/64 */
  453. #define SH4A_PCIETXVC0DCTLR (0x044100) /* R/W - H'00000000_00000000 32/64 */
  454. #define SH4A_PCIETXVC0SR (0x044108) /* R/W - H'00888000_00000000 32/64 */
  455. #define SH4A_PCIEVC0PDTXR (0x044110) /* W - H'00000000_00000000 32/64 */
  456. #define SH4A_PCIEVC0PHTXR (0x044118) /* W - H'00000000_00000000 32/64 */
  457. #define SH4A_PCIEVC0NPDTXR (0x044120) /* W - H'00000000_00000000 32/64 */
  458. #define SH4A_PCIEVC0NPHTXR (0x044128) /* W - H'00000000_00000000 32/64 */
  459. #define SH4A_PCIEVC0CDTXR (0x044130) /* W - H'00000000_00000000 32/64 */
  460. #define SH4A_PCIEVC0CHTXR (0x044138) /* W - H'00000000_00000000 32/64 */
  461. #define SH4A_PCIETXVCXDCTLR (0x044200) /* R/W - H'00000000_00000000 32/64 */
  462. #define SH4A_PCIETXVCXSR (0x044208) /* R/W - H'00000000_00000000 32/64 */
  463. #define SH4A_PCIEVCXPDTXR (0x044210) /* W - H'00000000_00000000 32/64 */
  464. #define SH4A_PCIEVCXPHTXR (0x044218) /* W - H'00000000_00000000 32/64 */
  465. #define SH4A_PCIEVCXNPDTXR (0x044220) /* W - H'00000000_00000000 32/64 */
  466. #define SH4A_PCIEVCXNPHTXR (0x044228) /* W - H'00000000_00000000 32/64 */
  467. #define SH4A_PCIEVCXCDTXR (0x044230) /* W - H'00000000_00000000 32/64 */
  468. #define SH4A_PCIEVCXCHTXR (0x044238) /* W - H'00000000_00000000 32/64 */
  469. #define SH4A_PCIERDCTLR (0x046000) /* RW - H'00000000_00000000 32/64 */
  470. #define SH4A_PCIEERPCTLR (0x046008) /* RW - H'00000000_00000000 32/64 */
  471. #define SH4A_PCIEERPHR (0x046010) /* R - H'00000000_00000000 32/64 */
  472. #define SH4A_PCIEERPERR (0x046018) /* R - H'00000000_00000000 32/64 */
  473. #define SH4A_PCIERXVC0DCTLR (0x046100) /* RW - H'00000000_00000000 32/64 */
  474. #define SH4A_PCIERXVC0SR (0x046108) /* RW - H'00000000_00000000 32/64 */
  475. #define SH4A_PCIEVC0PDRXR (0x046140) /* R - H'00000000_00000000 32/64 */
  476. #define SH4A_PCIEVC0PHRXR (0x046148) /* R - H'00000000_00000000 32/64 */
  477. #define SH4A_PCIEVC0PERR (0x046150) /* R - H'00000000_00000000 32/64 */
  478. #define SH4A_PCIEVC0NPDRXR (0x046158) /* R - H'00000000_00000000 32/64 */
  479. #define SH4A_PCIEVC0NPHRXR (0x046160) /* R - H'00000000_00000000 32/64 */
  480. #define SH4A_PCIEVC0NPERR (0x046168) /* R - H'00000000_00000000 32/64 */
  481. #define SH4A_PCIEVC0CDRXR (0x046170) /* R - H'00000000_00000000 32/64 */
  482. #define SH4A_PCIEVC0CHRXR (0x046178) /* R - H'00000000_00000000 32/64 */
  483. #define SH4A_PCIEVC0CERR (0x046180) /* R - H'00000000_00000000 32/64 */
  484. #define SH4A_PCIERXVCXDCTLR (0x046200) /* RW - H'00000000_00000000 32/64 */
  485. #define SH4A_PCIERXVCXSR (0x046208) /* RW - H'00000000_00000000 32/64 */
  486. #define SH4A_PCIEVCXPDRXR (0x046240) /* R - H'00000000_00000000 32/64 */
  487. #define SH4A_PCIEVCXPHRXR (0x046248) /* R H'00000000_00000000 32/64 */
  488. #define SH4A_PCIEVCXPERR (0x046250) /* R H'00000000_00000000 32/64 */
  489. #define SH4A_PCIEVCXNPDRXR (0x046258) /* R H'00000000_00000000 32/64 */
  490. #define SH4A_PCIEVCXNPHRXR (0x046260) /* R H'00000000_00000000 32/64 */
  491. #define SH4A_PCIEVCXNPERR (0x046268) /* R H'00000000_00000000 32/64 */
  492. #define SH4A_PCIEVCXCDRXR (0x046270) /* R H'00000000_00000000 32/64 */
  493. #define SH4A_PCIEVCXCHRXR (0x046278) /* R H'00000000_00000000 32/64 */
  494. #define SH4A_PCIEVCXCERR (0x046280) /* R H'00000000_00000000 32/64 */
  495. /* SSI Register Definition for MSI WORK AROUND --hamada */
  496. #define SH4A_PCI_SSI_BASE 0xFFE00000 /* spw config address */
  497. #define SH4A_PCI_SSI_BASE_LEN 0x00100000 /* 1MB */
  498. #define SH4A_SSICR0 (0x000000)
  499. #define SH4A_SSICR1 (0x010000)
  500. #define SH4A_SSICR2 (0x020000)
  501. #define SH4A_SSICR3 (0x030000)
  502. #define PCI_REG(x) ((x) + 0x40000)
  503. static inline void
  504. pci_write_reg(struct pci_channel *chan, unsigned long val, unsigned long reg)
  505. {
  506. __raw_writel(val, chan->reg_base + reg);
  507. }
  508. static inline unsigned long
  509. pci_read_reg(struct pci_channel *chan, unsigned long reg)
  510. {
  511. return __raw_readl(chan->reg_base + reg);
  512. }
  513. #endif /* __PCI_SH7786_H */