iop13xx.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. #ifndef _IOP13XX_HW_H_
  2. #define _IOP13XX_HW_H_
  3. #ifndef __ASSEMBLY__
  4. /* The ATU offsets can change based on the strapping */
  5. extern u32 iop13xx_atux_pmmr_offset;
  6. extern u32 iop13xx_atue_pmmr_offset;
  7. void iop13xx_init_early(void);
  8. void iop13xx_init_irq(void);
  9. void iop13xx_map_io(void);
  10. void iop13xx_platform_init(void);
  11. void iop13xx_add_tpmi_devices(void);
  12. void iop13xx_init_irq(void);
  13. void iop13xx_restart(char, const char *);
  14. /* CPUID CP6 R0 Page 0 */
  15. static inline int iop13xx_cpu_id(void)
  16. {
  17. int id;
  18. asm volatile("mrc p6, 0, %0, c0, c0, 0":"=r" (id));
  19. return id;
  20. }
  21. /* WDTCR CP6 R7 Page 9 */
  22. static inline u32 read_wdtcr(void)
  23. {
  24. u32 val;
  25. asm volatile("mrc p6, 0, %0, c7, c9, 0":"=r" (val));
  26. return val;
  27. }
  28. static inline void write_wdtcr(u32 val)
  29. {
  30. asm volatile("mcr p6, 0, %0, c7, c9, 0"::"r" (val));
  31. }
  32. /* WDTSR CP6 R8 Page 9 */
  33. static inline u32 read_wdtsr(void)
  34. {
  35. u32 val;
  36. asm volatile("mrc p6, 0, %0, c8, c9, 0":"=r" (val));
  37. return val;
  38. }
  39. static inline void write_wdtsr(u32 val)
  40. {
  41. asm volatile("mcr p6, 0, %0, c8, c9, 0"::"r" (val));
  42. }
  43. /* RCSR - Reset Cause Status Register */
  44. static inline u32 read_rcsr(void)
  45. {
  46. u32 val;
  47. asm volatile("mrc p6, 0, %0, c0, c1, 0":"=r" (val));
  48. return val;
  49. }
  50. extern unsigned long get_iop_tick_rate(void);
  51. #endif
  52. /*
  53. * IOP13XX I/O and Mem space regions for PCI autoconfiguration
  54. */
  55. #define IOP13XX_MAX_RAM_SIZE 0x80000000UL /* 2GB */
  56. #define IOP13XX_PCI_OFFSET IOP13XX_MAX_RAM_SIZE
  57. /* PCI MAP
  58. * bus range cpu phys cpu virt note
  59. * 0x0000.0000 + 2GB (n/a) (n/a) inbound, 1:1 mapping with Physical RAM
  60. * 0x8000.0000 + 928M 0x1.8000.0000 (ioremap) PCIX outbound memory window
  61. * 0x8000.0000 + 928M 0x2.8000.0000 (ioremap) PCIE outbound memory window
  62. *
  63. * IO MAP
  64. * 0x1000 + 64K 0x0.fffb.1000 0xfec6.1000 PCIX outbound i/o window
  65. * 0x1000 + 64K 0x0.fffd.1000 0xfed7.1000 PCIE outbound i/o window
  66. */
  67. #define IOP13XX_PCIX_IO_WINDOW_SIZE 0x10000UL
  68. #define IOP13XX_PCIX_LOWER_IO_PA 0xfffb0000UL
  69. #define IOP13XX_PCIX_LOWER_IO_VA 0xfec60000UL
  70. #define IOP13XX_PCIX_LOWER_IO_BA 0x0UL /* OIOTVR */
  71. #define IOP13XX_PCIX_IO_BUS_OFFSET 0x1000UL
  72. #define IOP13XX_PCIX_UPPER_IO_PA (IOP13XX_PCIX_LOWER_IO_PA +\
  73. IOP13XX_PCIX_IO_WINDOW_SIZE - 1)
  74. #define IOP13XX_PCIX_UPPER_IO_VA (IOP13XX_PCIX_LOWER_IO_VA +\
  75. IOP13XX_PCIX_IO_WINDOW_SIZE - 1)
  76. #define IOP13XX_PCIX_IO_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
  77. (IOP13XX_PCIX_LOWER_IO_PA\
  78. - IOP13XX_PCIX_LOWER_IO_VA))
  79. #define IOP13XX_PCIX_MEM_PHYS_OFFSET 0x100000000ULL
  80. #define IOP13XX_PCIX_MEM_WINDOW_SIZE 0x3a000000UL
  81. #define IOP13XX_PCIX_LOWER_MEM_BA (PHYS_OFFSET + IOP13XX_PCI_OFFSET)
  82. #define IOP13XX_PCIX_LOWER_MEM_PA (IOP13XX_PCIX_MEM_PHYS_OFFSET +\
  83. IOP13XX_PCIX_LOWER_MEM_BA)
  84. #define IOP13XX_PCIX_UPPER_MEM_PA (IOP13XX_PCIX_LOWER_MEM_PA +\
  85. IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
  86. #define IOP13XX_PCIX_UPPER_MEM_BA (IOP13XX_PCIX_LOWER_MEM_BA +\
  87. IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
  88. #define IOP13XX_PCIX_MEM_COOKIE 0x80000000UL
  89. #define IOP13XX_PCIX_LOWER_MEM_RA IOP13XX_PCIX_MEM_COOKIE
  90. #define IOP13XX_PCIX_UPPER_MEM_RA (IOP13XX_PCIX_LOWER_MEM_RA +\
  91. IOP13XX_PCIX_MEM_WINDOW_SIZE - 1)
  92. #define IOP13XX_PCIX_MEM_OFFSET (IOP13XX_PCIX_MEM_COOKIE -\
  93. IOP13XX_PCIX_LOWER_MEM_BA)
  94. /* PCI-E ranges */
  95. #define IOP13XX_PCIE_IO_WINDOW_SIZE 0x10000UL
  96. #define IOP13XX_PCIE_LOWER_IO_PA 0xfffd0000UL
  97. #define IOP13XX_PCIE_LOWER_IO_VA 0xfed70000UL
  98. #define IOP13XX_PCIE_LOWER_IO_BA 0x0UL /* OIOTVR */
  99. #define IOP13XX_PCIE_IO_BUS_OFFSET 0x1000UL
  100. #define IOP13XX_PCIE_UPPER_IO_PA (IOP13XX_PCIE_LOWER_IO_PA +\
  101. IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
  102. #define IOP13XX_PCIE_UPPER_IO_VA (IOP13XX_PCIE_LOWER_IO_VA +\
  103. IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
  104. #define IOP13XX_PCIE_UPPER_IO_BA (IOP13XX_PCIE_LOWER_IO_BA +\
  105. IOP13XX_PCIE_IO_WINDOW_SIZE - 1)
  106. #define IOP13XX_PCIE_IO_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
  107. (IOP13XX_PCIE_LOWER_IO_PA\
  108. - IOP13XX_PCIE_LOWER_IO_VA))
  109. #define IOP13XX_PCIE_MEM_PHYS_OFFSET 0x200000000ULL
  110. #define IOP13XX_PCIE_MEM_WINDOW_SIZE 0x3a000000UL
  111. #define IOP13XX_PCIE_LOWER_MEM_BA (PHYS_OFFSET + IOP13XX_PCI_OFFSET)
  112. #define IOP13XX_PCIE_LOWER_MEM_PA (IOP13XX_PCIE_MEM_PHYS_OFFSET +\
  113. IOP13XX_PCIE_LOWER_MEM_BA)
  114. #define IOP13XX_PCIE_UPPER_MEM_PA (IOP13XX_PCIE_LOWER_MEM_PA +\
  115. IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
  116. #define IOP13XX_PCIE_UPPER_MEM_BA (IOP13XX_PCIE_LOWER_MEM_BA +\
  117. IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
  118. /* All 0xc000.0000 - 0xfdff.ffff addresses belong to PCIe */
  119. #define IOP13XX_PCIE_MEM_COOKIE 0xc0000000UL
  120. #define IOP13XX_PCIE_LOWER_MEM_RA IOP13XX_PCIE_MEM_COOKIE
  121. #define IOP13XX_PCIE_UPPER_MEM_RA (IOP13XX_PCIE_LOWER_MEM_RA +\
  122. IOP13XX_PCIE_MEM_WINDOW_SIZE - 1)
  123. #define IOP13XX_PCIE_MEM_OFFSET (IOP13XX_PCIE_MEM_COOKIE -\
  124. IOP13XX_PCIE_LOWER_MEM_BA)
  125. /* PBI Ranges */
  126. #define IOP13XX_PBI_LOWER_MEM_PA 0xf0000000UL
  127. #define IOP13XX_PBI_MEM_WINDOW_SIZE 0x04000000UL
  128. #define IOP13XX_PBI_MEM_COOKIE 0xfa000000UL
  129. #define IOP13XX_PBI_LOWER_MEM_RA IOP13XX_PBI_MEM_COOKIE
  130. #define IOP13XX_PBI_UPPER_MEM_RA (IOP13XX_PBI_LOWER_MEM_RA +\
  131. IOP13XX_PBI_MEM_WINDOW_SIZE - 1)
  132. /*
  133. * IOP13XX chipset registers
  134. */
  135. #define IOP13XX_PMMR_PHYS_MEM_BASE 0xffd80000UL /* PMMR phys. address */
  136. #define IOP13XX_PMMR_VIRT_MEM_BASE 0xfee80000UL /* PMMR phys. address */
  137. #define IOP13XX_PMMR_MEM_WINDOW_SIZE 0x80000
  138. #define IOP13XX_PMMR_UPPER_MEM_VA (IOP13XX_PMMR_VIRT_MEM_BASE +\
  139. IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
  140. #define IOP13XX_PMMR_UPPER_MEM_PA (IOP13XX_PMMR_PHYS_MEM_BASE +\
  141. IOP13XX_PMMR_MEM_WINDOW_SIZE - 1)
  142. #define IOP13XX_PMMR_VIRT_TO_PHYS(addr) (u32) ((u32) addr +\
  143. (IOP13XX_PMMR_PHYS_MEM_BASE\
  144. - IOP13XX_PMMR_VIRT_MEM_BASE))
  145. #define IOP13XX_PMMR_PHYS_TO_VIRT(addr) (u32) ((u32) addr -\
  146. (IOP13XX_PMMR_PHYS_MEM_BASE\
  147. - IOP13XX_PMMR_VIRT_MEM_BASE))
  148. #define IOP13XX_REG_ADDR32(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
  149. #define IOP13XX_REG_ADDR16(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
  150. #define IOP13XX_REG_ADDR8(reg) (IOP13XX_PMMR_VIRT_MEM_BASE + (reg))
  151. #define IOP13XX_REG_ADDR32_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
  152. #define IOP13XX_REG_ADDR16_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
  153. #define IOP13XX_REG_ADDR8_PHYS(reg) (IOP13XX_PMMR_PHYS_MEM_BASE + (reg))
  154. #define IOP13XX_PMMR_SIZE 0x00080000
  155. /*=================== Defines for Platform Devices =====================*/
  156. #define IOP13XX_UART0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002300)
  157. #define IOP13XX_UART1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002340)
  158. #define IOP13XX_UART0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002300)
  159. #define IOP13XX_UART1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002340)
  160. #define IOP13XX_I2C0_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002500)
  161. #define IOP13XX_I2C1_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002520)
  162. #define IOP13XX_I2C2_PHYS (IOP13XX_PMMR_PHYS_MEM_BASE | 0x00002540)
  163. #define IOP13XX_I2C0_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002500)
  164. #define IOP13XX_I2C1_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002520)
  165. #define IOP13XX_I2C2_VIRT (IOP13XX_PMMR_VIRT_MEM_BASE | 0x00002540)
  166. /* ATU selection flags */
  167. /* IOP13XX_INIT_ATU_DEFAULT = Rely on CONFIG_IOP13XX_ATU* */
  168. #define IOP13XX_INIT_ATU_DEFAULT (0)
  169. #define IOP13XX_INIT_ATU_ATUX (1 << 0)
  170. #define IOP13XX_INIT_ATU_ATUE (1 << 1)
  171. #define IOP13XX_INIT_ATU_NONE (1 << 2)
  172. /* UART selection flags */
  173. /* IOP13XX_INIT_UART_DEFAULT = Rely on CONFIG_IOP13XX_UART* */
  174. #define IOP13XX_INIT_UART_DEFAULT (0)
  175. #define IOP13XX_INIT_UART_0 (1 << 0)
  176. #define IOP13XX_INIT_UART_1 (1 << 1)
  177. /* I2C selection flags */
  178. /* IOP13XX_INIT_I2C_DEFAULT = Rely on CONFIG_IOP13XX_I2C* */
  179. #define IOP13XX_INIT_I2C_DEFAULT (0)
  180. #define IOP13XX_INIT_I2C_0 (1 << 0)
  181. #define IOP13XX_INIT_I2C_1 (1 << 1)
  182. #define IOP13XX_INIT_I2C_2 (1 << 2)
  183. /* ADMA selection flags */
  184. /* INIT_ADMA_DEFAULT = Rely on CONFIG_IOP13XX_ADMA* */
  185. #define IOP13XX_INIT_ADMA_DEFAULT (0)
  186. #define IOP13XX_INIT_ADMA_0 (1 << 0)
  187. #define IOP13XX_INIT_ADMA_1 (1 << 1)
  188. #define IOP13XX_INIT_ADMA_2 (1 << 2)
  189. /* Platform devices */
  190. #define IQ81340_NUM_UART 2
  191. #define IQ81340_NUM_I2C 3
  192. #define IQ81340_NUM_PHYS_MAP_FLASH 1
  193. #define IQ81340_NUM_ADMA 3
  194. #define IQ81340_MAX_PLAT_DEVICES (IQ81340_NUM_UART + \
  195. IQ81340_NUM_I2C + \
  196. IQ81340_NUM_PHYS_MAP_FLASH + \
  197. IQ81340_NUM_ADMA)
  198. /*========================== PMMR offsets for key registers ============*/
  199. #define IOP13XX_ATU0_PMMR_OFFSET 0x00048000
  200. #define IOP13XX_ATU1_PMMR_OFFSET 0x0004c000
  201. #define IOP13XX_ATU2_PMMR_OFFSET 0x0004d000
  202. #define IOP13XX_ADMA0_PMMR_OFFSET 0x00000000
  203. #define IOP13XX_ADMA1_PMMR_OFFSET 0x00000200
  204. #define IOP13XX_ADMA2_PMMR_OFFSET 0x00000400
  205. #define IOP13XX_PBI_PMMR_OFFSET 0x00001580
  206. #define IOP13XX_MU_PMMR_OFFSET 0x00004000
  207. #define IOP13XX_ESSR0_PMMR_OFFSET 0x00002188
  208. #define IOP13XX_ESSR0 IOP13XX_REG_ADDR32(0x00002188)
  209. #define IOP13XX_ESSR0_IFACE_MASK 0x00004000 /* Interface PCI-X / PCI-E */
  210. #define IOP13XX_CONTROLLER_ONLY (1 << 14)
  211. #define IOP13XX_INTERFACE_SEL_PCIX (1 << 15)
  212. #define IOP13XX_PMON_PMMR_OFFSET 0x0001A000
  213. #define IOP13XX_PMON_BASE (IOP13XX_PMMR_VIRT_MEM_BASE +\
  214. IOP13XX_PMON_PMMR_OFFSET)
  215. #define IOP13XX_PMON_PHYSBASE (IOP13XX_PMMR_PHYS_MEM_BASE +\
  216. IOP13XX_PMON_PMMR_OFFSET)
  217. #define IOP13XX_PMON_CMD0 (IOP13XX_PMON_BASE + 0x0)
  218. #define IOP13XX_PMON_EVR0 (IOP13XX_PMON_BASE + 0x4)
  219. #define IOP13XX_PMON_STS0 (IOP13XX_PMON_BASE + 0x8)
  220. #define IOP13XX_PMON_DATA0 (IOP13XX_PMON_BASE + 0xC)
  221. #define IOP13XX_PMON_CMD3 (IOP13XX_PMON_BASE + 0x30)
  222. #define IOP13XX_PMON_EVR3 (IOP13XX_PMON_BASE + 0x34)
  223. #define IOP13XX_PMON_STS3 (IOP13XX_PMON_BASE + 0x38)
  224. #define IOP13XX_PMON_DATA3 (IOP13XX_PMON_BASE + 0x3C)
  225. #define IOP13XX_PMON_CMD7 (IOP13XX_PMON_BASE + 0x70)
  226. #define IOP13XX_PMON_EVR7 (IOP13XX_PMON_BASE + 0x74)
  227. #define IOP13XX_PMON_STS7 (IOP13XX_PMON_BASE + 0x78)
  228. #define IOP13XX_PMON_DATA7 (IOP13XX_PMON_BASE + 0x7C)
  229. #define IOP13XX_PMONEN (IOP13XX_PMMR_VIRT_MEM_BASE + 0x4E040)
  230. #define IOP13XX_PMONSTAT (IOP13XX_PMMR_VIRT_MEM_BASE + 0x4E044)
  231. /*================================ATU===================================*/
  232. #define IOP13XX_ATUX_OFFSET(ofs) IOP13XX_REG_ADDR32(\
  233. iop13xx_atux_pmmr_offset + (ofs))
  234. #define IOP13XX_ATUX_DID IOP13XX_REG_ADDR16(\
  235. iop13xx_atux_pmmr_offset + 0x2)
  236. #define IOP13XX_ATUX_ATUCMD IOP13XX_REG_ADDR16(\
  237. iop13xx_atux_pmmr_offset + 0x4)
  238. #define IOP13XX_ATUX_ATUSR IOP13XX_REG_ADDR16(\
  239. iop13xx_atux_pmmr_offset + 0x6)
  240. #define IOP13XX_ATUX_IABAR0 IOP13XX_ATUX_OFFSET(0x10)
  241. #define IOP13XX_ATUX_IAUBAR0 IOP13XX_ATUX_OFFSET(0x14)
  242. #define IOP13XX_ATUX_IABAR1 IOP13XX_ATUX_OFFSET(0x18)
  243. #define IOP13XX_ATUX_IAUBAR1 IOP13XX_ATUX_OFFSET(0x1c)
  244. #define IOP13XX_ATUX_IABAR2 IOP13XX_ATUX_OFFSET(0x20)
  245. #define IOP13XX_ATUX_IAUBAR2 IOP13XX_ATUX_OFFSET(0x24)
  246. #define IOP13XX_ATUX_IALR0 IOP13XX_ATUX_OFFSET(0x40)
  247. #define IOP13XX_ATUX_IATVR0 IOP13XX_ATUX_OFFSET(0x44)
  248. #define IOP13XX_ATUX_IAUTVR0 IOP13XX_ATUX_OFFSET(0x48)
  249. #define IOP13XX_ATUX_IALR1 IOP13XX_ATUX_OFFSET(0x4c)
  250. #define IOP13XX_ATUX_IATVR1 IOP13XX_ATUX_OFFSET(0x50)
  251. #define IOP13XX_ATUX_IAUTVR1 IOP13XX_ATUX_OFFSET(0x54)
  252. #define IOP13XX_ATUX_IALR2 IOP13XX_ATUX_OFFSET(0x58)
  253. #define IOP13XX_ATUX_IATVR2 IOP13XX_ATUX_OFFSET(0x5c)
  254. #define IOP13XX_ATUX_IAUTVR2 IOP13XX_ATUX_OFFSET(0x60)
  255. #define IOP13XX_ATUX_ATUCR IOP13XX_ATUX_OFFSET(0x70)
  256. #define IOP13XX_ATUX_PCSR IOP13XX_ATUX_OFFSET(0x74)
  257. #define IOP13XX_ATUX_ATUISR IOP13XX_ATUX_OFFSET(0x78)
  258. #define IOP13XX_ATUX_PCIXSR IOP13XX_ATUX_OFFSET(0xD4)
  259. #define IOP13XX_ATUX_IABAR3 IOP13XX_ATUX_OFFSET(0x200)
  260. #define IOP13XX_ATUX_IAUBAR3 IOP13XX_ATUX_OFFSET(0x204)
  261. #define IOP13XX_ATUX_IALR3 IOP13XX_ATUX_OFFSET(0x208)
  262. #define IOP13XX_ATUX_IATVR3 IOP13XX_ATUX_OFFSET(0x20c)
  263. #define IOP13XX_ATUX_IAUTVR3 IOP13XX_ATUX_OFFSET(0x210)
  264. #define IOP13XX_ATUX_OIOBAR IOP13XX_ATUX_OFFSET(0x300)
  265. #define IOP13XX_ATUX_OIOWTVR IOP13XX_ATUX_OFFSET(0x304)
  266. #define IOP13XX_ATUX_OUMBAR0 IOP13XX_ATUX_OFFSET(0x308)
  267. #define IOP13XX_ATUX_OUMWTVR0 IOP13XX_ATUX_OFFSET(0x30c)
  268. #define IOP13XX_ATUX_OUMBAR1 IOP13XX_ATUX_OFFSET(0x310)
  269. #define IOP13XX_ATUX_OUMWTVR1 IOP13XX_ATUX_OFFSET(0x314)
  270. #define IOP13XX_ATUX_OUMBAR2 IOP13XX_ATUX_OFFSET(0x318)
  271. #define IOP13XX_ATUX_OUMWTVR2 IOP13XX_ATUX_OFFSET(0x31c)
  272. #define IOP13XX_ATUX_OUMBAR3 IOP13XX_ATUX_OFFSET(0x320)
  273. #define IOP13XX_ATUX_OUMWTVR3 IOP13XX_ATUX_OFFSET(0x324)
  274. #define IOP13XX_ATUX_OUDMABAR IOP13XX_ATUX_OFFSET(0x328)
  275. #define IOP13XX_ATUX_OUMSIBAR IOP13XX_ATUX_OFFSET(0x32c)
  276. #define IOP13XX_ATUX_OCCAR IOP13XX_ATUX_OFFSET(0x330)
  277. #define IOP13XX_ATUX_OCCDR IOP13XX_ATUX_OFFSET(0x334)
  278. #define IOP13XX_ATUX_ATUCR_OUT_EN (1 << 1)
  279. #define IOP13XX_ATUX_PCSR_CENTRAL_RES (1 << 25)
  280. #define IOP13XX_ATUX_PCSR_P_RSTOUT (1 << 21)
  281. #define IOP13XX_ATUX_PCSR_OUT_Q_BUSY (1 << 15)
  282. #define IOP13XX_ATUX_PCSR_IN_Q_BUSY (1 << 14)
  283. #define IOP13XX_ATUX_PCSR_FREQ_OFFSET (16)
  284. #define IOP13XX_ATUX_STAT_PCI_IFACE_ERR (1 << 18)
  285. #define IOP13XX_ATUX_STAT_VPD_ADDR (1 << 17)
  286. #define IOP13XX_ATUX_STAT_INT_PAR_ERR (1 << 16)
  287. #define IOP13XX_ATUX_STAT_CFG_WRITE (1 << 15)
  288. #define IOP13XX_ATUX_STAT_ERR_COR (1 << 14)
  289. #define IOP13XX_ATUX_STAT_TX_SCEM (1 << 13)
  290. #define IOP13XX_ATUX_STAT_REC_SCEM (1 << 12)
  291. #define IOP13XX_ATUX_STAT_POWER_TRAN (1 << 11)
  292. #define IOP13XX_ATUX_STAT_TX_SERR (1 << 10)
  293. #define IOP13XX_ATUX_STAT_DET_PAR_ERR (1 << 9 )
  294. #define IOP13XX_ATUX_STAT_BIST (1 << 8 )
  295. #define IOP13XX_ATUX_STAT_INT_REC_MABORT (1 << 7 )
  296. #define IOP13XX_ATUX_STAT_REC_SERR (1 << 4 )
  297. #define IOP13XX_ATUX_STAT_EXT_REC_MABORT (1 << 3 )
  298. #define IOP13XX_ATUX_STAT_EXT_REC_TABORT (1 << 2 )
  299. #define IOP13XX_ATUX_STAT_EXT_SIG_TABORT (1 << 1 )
  300. #define IOP13XX_ATUX_STAT_MASTER_DATA_PAR (1 << 0 )
  301. #define IOP13XX_ATUX_PCIXSR_BUS_NUM (8)
  302. #define IOP13XX_ATUX_PCIXSR_DEV_NUM (3)
  303. #define IOP13XX_ATUX_PCIXSR_FUNC_NUM (0)
  304. #define IOP13XX_ATUX_IALR_DISABLE 0x00000001
  305. #define IOP13XX_ATUX_OUMBAR_ENABLE 0x80000000
  306. #define IOP13XX_ATUE_OFFSET(ofs) IOP13XX_REG_ADDR32(\
  307. iop13xx_atue_pmmr_offset + (ofs))
  308. #define IOP13XX_ATUE_DID IOP13XX_REG_ADDR16(\
  309. iop13xx_atue_pmmr_offset + 0x2)
  310. #define IOP13XX_ATUE_ATUCMD IOP13XX_REG_ADDR16(\
  311. iop13xx_atue_pmmr_offset + 0x4)
  312. #define IOP13XX_ATUE_ATUSR IOP13XX_REG_ADDR16(\
  313. iop13xx_atue_pmmr_offset + 0x6)
  314. #define IOP13XX_ATUE_IABAR0 IOP13XX_ATUE_OFFSET(0x10)
  315. #define IOP13XX_ATUE_IAUBAR0 IOP13XX_ATUE_OFFSET(0x14)
  316. #define IOP13XX_ATUE_IABAR1 IOP13XX_ATUE_OFFSET(0x18)
  317. #define IOP13XX_ATUE_IAUBAR1 IOP13XX_ATUE_OFFSET(0x1c)
  318. #define IOP13XX_ATUE_IABAR2 IOP13XX_ATUE_OFFSET(0x20)
  319. #define IOP13XX_ATUE_IAUBAR2 IOP13XX_ATUE_OFFSET(0x24)
  320. #define IOP13XX_ATUE_IALR0 IOP13XX_ATUE_OFFSET(0x40)
  321. #define IOP13XX_ATUE_IATVR0 IOP13XX_ATUE_OFFSET(0x44)
  322. #define IOP13XX_ATUE_IAUTVR0 IOP13XX_ATUE_OFFSET(0x48)
  323. #define IOP13XX_ATUE_IALR1 IOP13XX_ATUE_OFFSET(0x4c)
  324. #define IOP13XX_ATUE_IATVR1 IOP13XX_ATUE_OFFSET(0x50)
  325. #define IOP13XX_ATUE_IAUTVR1 IOP13XX_ATUE_OFFSET(0x54)
  326. #define IOP13XX_ATUE_IALR2 IOP13XX_ATUE_OFFSET(0x58)
  327. #define IOP13XX_ATUE_IATVR2 IOP13XX_ATUE_OFFSET(0x5c)
  328. #define IOP13XX_ATUE_IAUTVR2 IOP13XX_ATUE_OFFSET(0x60)
  329. #define IOP13XX_ATUE_PE_LSTS IOP13XX_REG_ADDR16(\
  330. iop13xx_atue_pmmr_offset + 0xe2)
  331. #define IOP13XX_ATUE_OIOWTVR IOP13XX_ATUE_OFFSET(0x304)
  332. #define IOP13XX_ATUE_OUMBAR0 IOP13XX_ATUE_OFFSET(0x308)
  333. #define IOP13XX_ATUE_OUMWTVR0 IOP13XX_ATUE_OFFSET(0x30c)
  334. #define IOP13XX_ATUE_OUMBAR1 IOP13XX_ATUE_OFFSET(0x310)
  335. #define IOP13XX_ATUE_OUMWTVR1 IOP13XX_ATUE_OFFSET(0x314)
  336. #define IOP13XX_ATUE_OUMBAR2 IOP13XX_ATUE_OFFSET(0x318)
  337. #define IOP13XX_ATUE_OUMWTVR2 IOP13XX_ATUE_OFFSET(0x31c)
  338. #define IOP13XX_ATUE_OUMBAR3 IOP13XX_ATUE_OFFSET(0x320)
  339. #define IOP13XX_ATUE_OUMWTVR3 IOP13XX_ATUE_OFFSET(0x324)
  340. #define IOP13XX_ATUE_ATUCR IOP13XX_ATUE_OFFSET(0x70)
  341. #define IOP13XX_ATUE_PCSR IOP13XX_ATUE_OFFSET(0x74)
  342. #define IOP13XX_ATUE_ATUISR IOP13XX_ATUE_OFFSET(0x78)
  343. #define IOP13XX_ATUE_OIOBAR IOP13XX_ATUE_OFFSET(0x300)
  344. #define IOP13XX_ATUE_OCCAR IOP13XX_ATUE_OFFSET(0x32c)
  345. #define IOP13XX_ATUE_OCCDR IOP13XX_ATUE_OFFSET(0x330)
  346. #define IOP13XX_ATUE_PIE_STS IOP13XX_ATUE_OFFSET(0x384)
  347. #define IOP13XX_ATUE_PIE_MSK IOP13XX_ATUE_OFFSET(0x388)
  348. #define IOP13XX_ATUE_ATUCR_IVM (1 << 6)
  349. #define IOP13XX_ATUE_ATUCR_OUT_EN (1 << 1)
  350. #define IOP13XX_ATUE_OCCAR_BUS_NUM (24)
  351. #define IOP13XX_ATUE_OCCAR_DEV_NUM (19)
  352. #define IOP13XX_ATUE_OCCAR_FUNC_NUM (16)
  353. #define IOP13XX_ATUE_OCCAR_EXT_REG (8)
  354. #define IOP13XX_ATUE_OCCAR_REG (2)
  355. #define IOP13XX_ATUE_PCSR_BUS_NUM (24)
  356. #define IOP13XX_ATUE_PCSR_DEV_NUM (19)
  357. #define IOP13XX_ATUE_PCSR_FUNC_NUM (16)
  358. #define IOP13XX_ATUE_PCSR_OUT_Q_BUSY (1 << 15)
  359. #define IOP13XX_ATUE_PCSR_IN_Q_BUSY (1 << 14)
  360. #define IOP13XX_ATUE_PCSR_END_POINT (1 << 13)
  361. #define IOP13XX_ATUE_PCSR_LLRB_BUSY (1 << 12)
  362. #define IOP13XX_ATUE_PCSR_BUS_NUM_MASK (0xff)
  363. #define IOP13XX_ATUE_PCSR_DEV_NUM_MASK (0x1f)
  364. #define IOP13XX_ATUE_PCSR_FUNC_NUM_MASK (0x7)
  365. #define IOP13XX_ATUE_PCSR_CORE_RESET (8)
  366. #define IOP13XX_ATUE_PCSR_FUNC_NUM (16)
  367. #define IOP13XX_ATUE_LSTS_TRAINING (1 << 11)
  368. #define IOP13XX_ATUE_STAT_SLOT_PWR_MSG (1 << 28)
  369. #define IOP13XX_ATUE_STAT_PME (1 << 27)
  370. #define IOP13XX_ATUE_STAT_HOT_PLUG_MSG (1 << 26)
  371. #define IOP13XX_ATUE_STAT_IVM (1 << 25)
  372. #define IOP13XX_ATUE_STAT_BIST (1 << 24)
  373. #define IOP13XX_ATUE_STAT_CFG_WRITE (1 << 18)
  374. #define IOP13XX_ATUE_STAT_VPD_ADDR (1 << 17)
  375. #define IOP13XX_ATUE_STAT_POWER_TRAN (1 << 16)
  376. #define IOP13XX_ATUE_STAT_HALT_ON_ERROR (1 << 13)
  377. #define IOP13XX_ATUE_STAT_ROOT_SYS_ERR (1 << 12)
  378. #define IOP13XX_ATUE_STAT_ROOT_ERR_MSG (1 << 11)
  379. #define IOP13XX_ATUE_STAT_PCI_IFACE_ERR (1 << 10)
  380. #define IOP13XX_ATUE_STAT_ERR_COR (1 << 9 )
  381. #define IOP13XX_ATUE_STAT_ERR_UNCOR (1 << 8 )
  382. #define IOP13XX_ATUE_STAT_CRS (1 << 7 )
  383. #define IOP13XX_ATUE_STAT_LNK_DWN (1 << 6 )
  384. #define IOP13XX_ATUE_STAT_INT_REC_MABORT (1 << 5 )
  385. #define IOP13XX_ATUE_STAT_DET_PAR_ERR (1 << 4 )
  386. #define IOP13XX_ATUE_STAT_EXT_REC_MABORT (1 << 3 )
  387. #define IOP13XX_ATUE_STAT_SIG_TABORT (1 << 2 )
  388. #define IOP13XX_ATUE_STAT_EXT_REC_TABORT (1 << 1 )
  389. #define IOP13XX_ATUE_STAT_MASTER_DATA_PAR (1 << 0 )
  390. #define IOP13XX_ATUE_ESTAT_REC_UNSUPPORTED_COMP_REQ (1 << 31)
  391. #define IOP13XX_ATUE_ESTAT_REC_COMPLETER_ABORT (1 << 30)
  392. #define IOP13XX_ATUE_ESTAT_TX_POISONED_TLP (1 << 29)
  393. #define IOP13XX_ATUE_ESTAT_TX_PAR_ERR (1 << 28)
  394. #define IOP13XX_ATUE_ESTAT_REC_UNSUPPORTED_REQ (1 << 20)
  395. #define IOP13XX_ATUE_ESTAT_REC_ECRC_ERR (1 << 19)
  396. #define IOP13XX_ATUE_ESTAT_REC_MALFORMED_TLP (1 << 18)
  397. #define IOP13XX_ATUE_ESTAT_TX_RECEIVER_OVERFLOW (1 << 17)
  398. #define IOP13XX_ATUE_ESTAT_REC_UNEXPECTED_COMP (1 << 16)
  399. #define IOP13XX_ATUE_ESTAT_INT_COMP_ABORT (1 << 15)
  400. #define IOP13XX_ATUE_ESTAT_COMP_TIMEOUT (1 << 14)
  401. #define IOP13XX_ATUE_ESTAT_FLOW_CONTROL_ERR (1 << 13)
  402. #define IOP13XX_ATUE_ESTAT_REC_POISONED_TLP (1 << 12)
  403. #define IOP13XX_ATUE_ESTAT_DATA_LNK_ERR (1 << 4 )
  404. #define IOP13XX_ATUE_ESTAT_TRAINING_ERR (1 << 0 )
  405. #define IOP13XX_ATUE_IALR_DISABLE (0x00000001)
  406. #define IOP13XX_ATUE_OUMBAR_ENABLE (0x80000000)
  407. #define IOP13XX_ATU_OUMBAR_FUNC_NUM (28)
  408. #define IOP13XX_ATU_OUMBAR_FUNC_NUM_MASK (0x7)
  409. /*=======================================================================*/
  410. /*============================MESSAGING UNIT=============================*/
  411. #define IOP13XX_MU_OFFSET(ofs) IOP13XX_REG_ADDR32(IOP13XX_MU_PMMR_OFFSET +\
  412. (ofs))
  413. #define IOP13XX_MU_IMR0 IOP13XX_MU_OFFSET(0x10)
  414. #define IOP13XX_MU_IMR1 IOP13XX_MU_OFFSET(0x14)
  415. #define IOP13XX_MU_OMR0 IOP13XX_MU_OFFSET(0x18)
  416. #define IOP13XX_MU_OMR1 IOP13XX_MU_OFFSET(0x1C)
  417. #define IOP13XX_MU_IDR IOP13XX_MU_OFFSET(0x20)
  418. #define IOP13XX_MU_IISR IOP13XX_MU_OFFSET(0x24)
  419. #define IOP13XX_MU_IIMR IOP13XX_MU_OFFSET(0x28)
  420. #define IOP13XX_MU_ODR IOP13XX_MU_OFFSET(0x2C)
  421. #define IOP13XX_MU_OISR IOP13XX_MU_OFFSET(0x30)
  422. #define IOP13XX_MU_OIMR IOP13XX_MU_OFFSET(0x34)
  423. #define IOP13XX_MU_IRCSR IOP13XX_MU_OFFSET(0x38)
  424. #define IOP13XX_MU_ORCSR IOP13XX_MU_OFFSET(0x3C)
  425. #define IOP13XX_MU_MIMR IOP13XX_MU_OFFSET(0x48)
  426. #define IOP13XX_MU_MUCR IOP13XX_MU_OFFSET(0x50)
  427. #define IOP13XX_MU_QBAR IOP13XX_MU_OFFSET(0x54)
  428. #define IOP13XX_MU_MUBAR IOP13XX_MU_OFFSET(0x84)
  429. #define IOP13XX_MU_WINDOW_SIZE (8 * 1024)
  430. #define IOP13XX_MU_BASE_PHYS (0xff000000)
  431. #define IOP13XX_MU_BASE_PCI (0xff000000)
  432. #define IOP13XX_MU_MIMR_PCI (IOP13XX_MU_BASE_PCI + 0x48)
  433. #define IOP13XX_MU_MIMR_CORE_SELECT (15)
  434. /*=======================================================================*/
  435. /*==============================ADMA UNITS===============================*/
  436. #define IOP13XX_ADMA_PHYS_BASE(chan) IOP13XX_REG_ADDR32_PHYS((chan << 9))
  437. #define IOP13XX_ADMA_UPPER_PA(chan) (IOP13XX_ADMA_PHYS_BASE(chan) + 0xc0)
  438. /*==============================XSI BRIDGE===============================*/
  439. #define IOP13XX_XBG_BECSR IOP13XX_REG_ADDR32(0x178c)
  440. #define IOP13XX_XBG_BERAR IOP13XX_REG_ADDR32(0x1790)
  441. #define IOP13XX_XBG_BERUAR IOP13XX_REG_ADDR32(0x1794)
  442. #define is_atue_occdr_error(x) ((__raw_readl(IOP13XX_XBG_BERAR) == \
  443. IOP13XX_PMMR_VIRT_TO_PHYS(\
  444. IOP13XX_ATUE_OCCDR))\
  445. && (__raw_readl(IOP13XX_XBG_BECSR) & 1))
  446. #define is_atux_occdr_error(x) ((__raw_readl(IOP13XX_XBG_BERAR) == \
  447. IOP13XX_PMMR_VIRT_TO_PHYS(\
  448. IOP13XX_ATUX_OCCDR))\
  449. && (__raw_readl(IOP13XX_XBG_BECSR) & 1))
  450. /*=======================================================================*/
  451. #define IOP13XX_PBI_OFFSET(ofs) IOP13XX_REG_ADDR32(IOP13XX_PBI_PMMR_OFFSET +\
  452. (ofs))
  453. #define IOP13XX_PBI_CR IOP13XX_PBI_OFFSET(0x0)
  454. #define IOP13XX_PBI_SR IOP13XX_PBI_OFFSET(0x4)
  455. #define IOP13XX_PBI_BAR0 IOP13XX_PBI_OFFSET(0x8)
  456. #define IOP13XX_PBI_LR0 IOP13XX_PBI_OFFSET(0xc)
  457. #define IOP13XX_PBI_BAR1 IOP13XX_PBI_OFFSET(0x10)
  458. #define IOP13XX_PBI_LR1 IOP13XX_PBI_OFFSET(0x14)
  459. #define IOP13XX_PROCESSOR_FREQ IOP13XX_REG_ADDR32(0x2180)
  460. /* Watchdog timer definitions */
  461. #define IOP_WDTCR_EN_ARM 0x1e1e1e1e
  462. #define IOP_WDTCR_EN 0xe1e1e1e1
  463. #define IOP_WDTCR_DIS_ARM 0x1f1f1f1f
  464. #define IOP_WDTCR_DIS 0xf1f1f1f1
  465. #define IOP_RCSR_WDT (1 << 5) /* reset caused by watchdog timer */
  466. #define IOP13XX_WDTSR_WRITE_EN (1 << 31) /* used to speed up reset requests */
  467. #define IOP13XX_WDTCR_IB_RESET (1 << 0)
  468. #endif /* _IOP13XX_HW_H_ */