ppc4xx-uic.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /*
  2. * Copyright (C) 2002 Scott McNutt <smcnutt@artesyncp.com>
  3. *
  4. * (C) Copyright 2008
  5. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef _PPC4xx_UIC_H_
  26. #define _PPC4xx_UIC_H_
  27. /*
  28. * Define the number of UIC's
  29. */
  30. #if defined(CONFIG_440GX) || defined(CONFIG_440SPE) || \
  31. defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
  32. defined(CONFIG_460SX)
  33. #define UIC_MAX 4
  34. #elif defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
  35. defined(CONFIG_405EX)
  36. #define UIC_MAX 3
  37. #elif defined(CONFIG_440GP) || defined(CONFIG_440SP) || \
  38. defined(CONFIG_440EP) || defined(CONFIG_440GR)
  39. #define UIC_MAX 2
  40. #else
  41. #define UIC_MAX 1
  42. #endif
  43. #define IRQ_MAX UIC_MAX * 32
  44. /*
  45. * UIC register
  46. */
  47. #define UIC_SR 0x0 /* UIC status */
  48. #define UIC_ER 0x2 /* UIC enable */
  49. #define UIC_CR 0x3 /* UIC critical */
  50. #define UIC_PR 0x4 /* UIC polarity */
  51. #define UIC_TR 0x5 /* UIC triggering */
  52. #define UIC_MSR 0x6 /* UIC masked status */
  53. #define UIC_VR 0x7 /* UIC vector */
  54. #define UIC_VCR 0x8 /* UIC vector configuration */
  55. /*
  56. * On 440GX we use the UICB0 as UIC0. Its the root UIC where all other UIC's
  57. * are cascaded on. With this trick we can use the common UIC code for 440GX
  58. * too.
  59. */
  60. #if defined(CONFIG_440GX)
  61. #define UIC0_DCR_BASE 0x200
  62. #define UIC1_DCR_BASE 0xc0
  63. #define UIC2_DCR_BASE 0xd0
  64. #define UIC3_DCR_BASE 0x210
  65. #else
  66. #define UIC0_DCR_BASE 0xc0
  67. #define UIC1_DCR_BASE 0xd0
  68. #define UIC2_DCR_BASE 0xe0
  69. #define UIC3_DCR_BASE 0xf0
  70. #endif
  71. #define uic0sr (UIC0_DCR_BASE+0x0) /* UIC0 status */
  72. #define uic0er (UIC0_DCR_BASE+0x2) /* UIC0 enable */
  73. #define uic0cr (UIC0_DCR_BASE+0x3) /* UIC0 critical */
  74. #define uic0pr (UIC0_DCR_BASE+0x4) /* UIC0 polarity */
  75. #define uic0tr (UIC0_DCR_BASE+0x5) /* UIC0 triggering */
  76. #define uic0msr (UIC0_DCR_BASE+0x6) /* UIC0 masked status */
  77. #define uic0vr (UIC0_DCR_BASE+0x7) /* UIC0 vector */
  78. #define uic0vcr (UIC0_DCR_BASE+0x8) /* UIC0 vector configuration */
  79. #define uic1sr (UIC1_DCR_BASE+0x0) /* UIC1 status */
  80. #define uic1er (UIC1_DCR_BASE+0x2) /* UIC1 enable */
  81. #define uic1cr (UIC1_DCR_BASE+0x3) /* UIC1 critical */
  82. #define uic1pr (UIC1_DCR_BASE+0x4) /* UIC1 polarity */
  83. #define uic1tr (UIC1_DCR_BASE+0x5) /* UIC1 triggering */
  84. #define uic1msr (UIC1_DCR_BASE+0x6) /* UIC1 masked status */
  85. #define uic1vr (UIC1_DCR_BASE+0x7) /* UIC1 vector */
  86. #define uic1vcr (UIC1_DCR_BASE+0x8) /* UIC1 vector configuration */
  87. #define uic2sr (UIC2_DCR_BASE+0x0) /* UIC2 status-Read Clear */
  88. #define uic2srs (UIC2_DCR_BASE+0x1) /* UIC2 status-Read Set */
  89. #define uic2er (UIC2_DCR_BASE+0x2) /* UIC2 enable */
  90. #define uic2cr (UIC2_DCR_BASE+0x3) /* UIC2 critical */
  91. #define uic2pr (UIC2_DCR_BASE+0x4) /* UIC2 polarity */
  92. #define uic2tr (UIC2_DCR_BASE+0x5) /* UIC2 triggering */
  93. #define uic2msr (UIC2_DCR_BASE+0x6) /* UIC2 masked status */
  94. #define uic2vr (UIC2_DCR_BASE+0x7) /* UIC2 vector */
  95. #define uic2vcr (UIC2_DCR_BASE+0x8) /* UIC2 vector configuration */
  96. #define uic3sr (UIC3_DCR_BASE+0x0) /* UIC3 status-Read Clear */
  97. #define uic3srs (UIC3_DCR_BASE+0x1) /* UIC3 status-Read Set */
  98. #define uic3er (UIC3_DCR_BASE+0x2) /* UIC3 enable */
  99. #define uic3cr (UIC3_DCR_BASE+0x3) /* UIC3 critical */
  100. #define uic3pr (UIC3_DCR_BASE+0x4) /* UIC3 polarity */
  101. #define uic3tr (UIC3_DCR_BASE+0x5) /* UIC3 triggering */
  102. #define uic3msr (UIC3_DCR_BASE+0x6) /* UIC3 masked status */
  103. #define uic3vr (UIC3_DCR_BASE+0x7) /* UIC3 vector */
  104. #define uic3vcr (UIC3_DCR_BASE+0x8) /* UIC3 vector configuration */
  105. /* The following is for compatibility with 405 code */
  106. #define uicsr uic0sr
  107. #define uicer uic0er
  108. #define uiccr uic0cr
  109. #define uicpr uic0pr
  110. #define uictr uic0tr
  111. #define uicmsr uic0msr
  112. #define uicvr uic0vr
  113. #define uicvcr uic0vcr
  114. /*
  115. * Now the interrupt vector definitions. They are different for most of
  116. * the 4xx variants, so we need some more #ifdef's here. No mask
  117. * definitions anymore here. For this please use the UIC_MASK macro below.
  118. *
  119. * Note: Please only define the interrupts really used in U-Boot here.
  120. * Those are the cascading and EMAC/MAL related interrupt.
  121. */
  122. #if defined(CONFIG_405EP) || defined(CONFIG_405GP)
  123. #define VECNUM_MAL_SERR 10
  124. #define VECNUM_MAL_TXEOB 11
  125. #define VECNUM_MAL_RXEOB 12
  126. #define VECNUM_MAL_TXDE 13
  127. #define VECNUM_MAL_RXDE 14
  128. #define VECNUM_ETH0 15
  129. #define VECNUM_ETH1_OFFS 2
  130. #define VECNUM_EIRQ6 29
  131. #endif /* defined(CONFIG_405EP) */
  132. #if defined(CONFIG_405EZ)
  133. #define VECNUM_USBDEV 15
  134. #define VECNUM_ETH0 16
  135. #define VECNUM_MAL_SERR 18
  136. #define VECNUM_MAL_TXDE 18
  137. #define VECNUM_MAL_RXDE 18
  138. #define VECNUM_MAL_TXEOB 19
  139. #define VECNUM_MAL_RXEOB 21
  140. #endif /* CONFIG_405EX */
  141. #if defined(CONFIG_405EX)
  142. /* UIC 0 */
  143. #define VECNUM_MAL_TXEOB 10
  144. #define VECNUM_MAL_RXEOB 11
  145. #define VECNUM_ETH0 24
  146. #define VECNUM_ETH1_OFFS 1
  147. #define VECNUM_UIC2NCI 28
  148. #define VECNUM_UIC2CI 29
  149. #define VECNUM_UIC1NCI 30
  150. #define VECNUM_UIC1CI 31
  151. /* UIC 1 */
  152. #define VECNUM_MAL_SERR (32 + 0)
  153. #define VECNUM_MAL_TXDE (32 + 1)
  154. #define VECNUM_MAL_RXDE (32 + 2)
  155. #endif /* CONFIG_405EX */
  156. #if defined(CONFIG_440GP) || \
  157. defined(CONFIG_440EP) || defined(CONFIG_440GR)
  158. /* UIC 0 */
  159. #define VECNUM_MAL_TXEOB 10
  160. #define VECNUM_MAL_RXEOB 11
  161. #define VECNUM_UIC1NCI 30
  162. #define VECNUM_UIC1CI 31
  163. /* UIC 1 */
  164. #define VECNUM_MAL_SERR (32 + 0)
  165. #define VECNUM_MAL_TXDE (32 + 1)
  166. #define VECNUM_MAL_RXDE (32 + 2)
  167. #define VECNUM_USBDEV (32 + 23)
  168. #define VECNUM_ETH0 (32 + 28)
  169. #define VECNUM_ETH1_OFFS 2
  170. #endif /* CONFIG_440GP */
  171. #if defined(CONFIG_440GX)
  172. /* UICB 0 (440GX only) */
  173. /*
  174. * All those defines below are off-by-one, so that the common UIC code
  175. * can be used. So VECNUM_UIC1CI refers to VECNUM_UIC0CI etc.
  176. */
  177. #define VECNUM_UIC1CI 0
  178. #define VECNUM_UIC1NCI 1
  179. #define VECNUM_UIC2CI 2
  180. #define VECNUM_UIC2NCI 3
  181. #define VECNUM_UIC3CI 4
  182. #define VECNUM_UIC3NCI 5
  183. /* UIC 0, used as UIC1 on 440GX because of UICB0 */
  184. #define VECNUM_MAL_TXEOB (32 + 10)
  185. #define VECNUM_MAL_RXEOB (32 + 11)
  186. /* UIC 1, used as UIC2 on 440GX because of UICB0 */
  187. #define VECNUM_MAL_SERR (64 + 0)
  188. #define VECNUM_MAL_TXDE (64 + 1)
  189. #define VECNUM_MAL_RXDE (64 + 2)
  190. #define VECNUM_ETH0 (64 + 28)
  191. #define VECNUM_ETH1_OFFS 2
  192. #endif /* CONFIG_440GX */
  193. #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
  194. /* UIC 0 */
  195. #define VECNUM_MAL_TXEOB 10
  196. #define VECNUM_MAL_RXEOB 11
  197. #define VECNUM_USBDEV 20
  198. #define VECNUM_ETH0 24
  199. #define VECNUM_ETH1_OFFS 1
  200. #define VECNUM_UIC2NCI 28
  201. #define VECNUM_UIC2CI 29
  202. #define VECNUM_UIC1NCI 30
  203. #define VECNUM_UIC1CI 31
  204. /* UIC 1 */
  205. #define VECNUM_MAL_SERR (32 + 0)
  206. #define VECNUM_MAL_TXDE (32 + 1)
  207. #define VECNUM_MAL_RXDE (32 + 2)
  208. /* UIC 2 */
  209. #define VECNUM_EIRQ2 (64 + 3)
  210. #endif /* CONFIG_440EPX */
  211. #if defined(CONFIG_440SP)
  212. /* UIC 0 */
  213. #define VECNUM_UIC1NCI 30
  214. #define VECNUM_UIC1CI 31
  215. /* UIC 1 */
  216. #define VECNUM_MAL_SERR (32 + 1)
  217. #define VECNUM_MAL_TXDE (32 + 2)
  218. #define VECNUM_MAL_RXDE (32 + 3)
  219. #define VECNUM_MAL_TXEOB (32 + 6)
  220. #define VECNUM_MAL_RXEOB (32 + 7)
  221. #define VECNUM_ETH0 (32 + 28)
  222. #endif /* CONFIG_440SP */
  223. #if defined(CONFIG_440SPE)
  224. /* UIC 0 */
  225. #define VECNUM_UIC2NCI 10
  226. #define VECNUM_UIC2CI 11
  227. #define VECNUM_UIC3NCI 16
  228. #define VECNUM_UIC3CI 17
  229. #define VECNUM_UIC1NCI 30
  230. #define VECNUM_UIC1CI 31
  231. /* UIC 1 */
  232. #define VECNUM_MAL_SERR (32 + 1)
  233. #define VECNUM_MAL_TXDE (32 + 2)
  234. #define VECNUM_MAL_RXDE (32 + 3)
  235. #define VECNUM_MAL_TXEOB (32 + 6)
  236. #define VECNUM_MAL_RXEOB (32 + 7)
  237. #define VECNUM_ETH0 (32 + 28)
  238. #endif /* CONFIG_440SPE */
  239. #if defined(CONFIG_460EX) || defined(CONFIG_460GT)
  240. /* UIC 0 */
  241. #define VECNUM_UIC2NCI 10
  242. #define VECNUM_UIC2CI 11
  243. #define VECNUM_UIC3NCI 16
  244. #define VECNUM_UIC3CI 17
  245. #define VECNUM_UIC1NCI 30
  246. #define VECNUM_UIC1CI 31
  247. /* UIC 2 */
  248. #define VECNUM_MAL_SERR (64 + 3)
  249. #define VECNUM_MAL_TXDE (64 + 4)
  250. #define VECNUM_MAL_RXDE (64 + 5)
  251. #define VECNUM_MAL_TXEOB (64 + 6)
  252. #define VECNUM_MAL_RXEOB (64 + 7)
  253. #define VECNUM_ETH0 (64 + 16)
  254. #define VECNUM_ETH1_OFFS 1
  255. #endif /* CONFIG_460EX */
  256. #if defined(CONFIG_460SX)
  257. /* UIC 0 */
  258. #define VECNUM_UIC2NCI 10
  259. #define VECNUM_UIC2CI 11
  260. #define VECNUM_UIC3NCI 16
  261. #define VECNUM_UIC3CI 17
  262. #define VECNUM_ETH0 19
  263. #define VECNUM_ETH1_OFFS 1
  264. #define VECNUM_UIC1NCI 30
  265. #define VECNUM_UIC1CI 31
  266. /* UIC 1 */
  267. #define VECNUM_MAL_SERR (32 + 1)
  268. #define VECNUM_MAL_TXDE (32 + 2)
  269. #define VECNUM_MAL_RXDE (32 + 3)
  270. #define VECNUM_MAL_TXEOB (32 + 6)
  271. #define VECNUM_MAL_RXEOB (32 + 7)
  272. #endif /* CONFIG_460EX */
  273. #if !defined(VECNUM_ETH1_OFFS)
  274. #define VECNUM_ETH1_OFFS 1
  275. #endif
  276. /*
  277. * Mask definitions (used for example in 4xx_enet.c)
  278. */
  279. #define UIC_MASK(vec) (0x80000000 >> ((vec) & 0x1f))
  280. /* UIC_NR won't work for 440GX because of its specific UIC DCR addresses */
  281. #define UIC_NR(vec) ((vec) >> 5)
  282. #endif /* _PPC4xx_UIC_H_ */