intc.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. #ifndef __ASM_MACH_INTC_H
  2. #define __ASM_MACH_INTC_H
  3. #include <linux/sh_intc.h>
  4. #define INTC_IRQ_PINS_ENUM_16L(p) \
  5. p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
  6. p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7, \
  7. p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
  8. p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15
  9. #define INTC_IRQ_PINS_ENUM_16H(p) \
  10. p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
  11. p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23, \
  12. p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
  13. p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31
  14. #define INTC_IRQ_PINS_VECT_16L(p, vect) \
  15. vect(p ## _IRQ0, 0x0200), vect(p ## _IRQ1, 0x0220), \
  16. vect(p ## _IRQ2, 0x0240), vect(p ## _IRQ3, 0x0260), \
  17. vect(p ## _IRQ4, 0x0280), vect(p ## _IRQ5, 0x02a0), \
  18. vect(p ## _IRQ6, 0x02c0), vect(p ## _IRQ7, 0x02e0), \
  19. vect(p ## _IRQ8, 0x0300), vect(p ## _IRQ9, 0x0320), \
  20. vect(p ## _IRQ10, 0x0340), vect(p ## _IRQ11, 0x0360), \
  21. vect(p ## _IRQ12, 0x0380), vect(p ## _IRQ13, 0x03a0), \
  22. vect(p ## _IRQ14, 0x03c0), vect(p ## _IRQ15, 0x03e0)
  23. #define INTC_IRQ_PINS_VECT_16H(p, vect) \
  24. vect(p ## _IRQ16, 0x3200), vect(p ## _IRQ17, 0x3220), \
  25. vect(p ## _IRQ18, 0x3240), vect(p ## _IRQ19, 0x3260), \
  26. vect(p ## _IRQ20, 0x3280), vect(p ## _IRQ21, 0x32a0), \
  27. vect(p ## _IRQ22, 0x32c0), vect(p ## _IRQ23, 0x32e0), \
  28. vect(p ## _IRQ24, 0x3300), vect(p ## _IRQ25, 0x3320), \
  29. vect(p ## _IRQ26, 0x3340), vect(p ## _IRQ27, 0x3360), \
  30. vect(p ## _IRQ28, 0x3380), vect(p ## _IRQ29, 0x33a0), \
  31. vect(p ## _IRQ30, 0x33c0), vect(p ## _IRQ31, 0x33e0)
  32. #define INTC_IRQ_PINS_MASK_16L(p, base) \
  33. { base + 0x40, base + 0x60, 8, /* INTMSK00A / INTMSKCLR00A */ \
  34. { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
  35. p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
  36. { base + 0x44, base + 0x64, 8, /* INTMSK10A / INTMSKCLR10A */ \
  37. { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
  38. p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
  39. #define INTC_IRQ_PINS_MASK_16H(p, base) \
  40. { base + 0x48, base + 0x68, 8, /* INTMSK20A / INTMSKCLR20A */ \
  41. { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
  42. p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
  43. { base + 0x4c, base + 0x6c, 8, /* INTMSK30A / INTMSKCLR30A */ \
  44. { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
  45. p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
  46. #define INTC_IRQ_PINS_PRIO_16L(p, base) \
  47. { base + 0x10, 0, 32, 4, /* INTPRI00A */ \
  48. { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
  49. p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
  50. { base + 0x14, 0, 32, 4, /* INTPRI10A */ \
  51. { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
  52. p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
  53. #define INTC_IRQ_PINS_PRIO_16H(p, base) \
  54. { base + 0x18, 0, 32, 4, /* INTPRI20A */ \
  55. { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
  56. p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
  57. { base + 0x1c, 0, 32, 4, /* INTPRI30A */ \
  58. { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
  59. p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
  60. #define INTC_IRQ_PINS_SENSE_16L(p, base) \
  61. { base + 0x00, 32, 4, /* ICR1A */ \
  62. { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
  63. p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
  64. { base + 0x04, 32, 4, /* ICR2A */ \
  65. { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
  66. p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
  67. #define INTC_IRQ_PINS_SENSE_16H(p, base) \
  68. { base + 0x08, 32, 4, /* ICR3A */ \
  69. { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
  70. p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
  71. { base + 0x0c, 32, 4, /* ICR4A */ \
  72. { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
  73. p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
  74. #define INTC_IRQ_PINS_ACK_16L(p, base) \
  75. { base + 0x20, 0, 8, /* INTREQ00A */ \
  76. { p ## _IRQ0, p ## _IRQ1, p ## _IRQ2, p ## _IRQ3, \
  77. p ## _IRQ4, p ## _IRQ5, p ## _IRQ6, p ## _IRQ7 } }, \
  78. { base + 0x24, 0, 8, /* INTREQ10A */ \
  79. { p ## _IRQ8, p ## _IRQ9, p ## _IRQ10, p ## _IRQ11, \
  80. p ## _IRQ12, p ## _IRQ13, p ## _IRQ14, p ## _IRQ15 } }
  81. #define INTC_IRQ_PINS_ACK_16H(p, base) \
  82. { base + 0x28, 0, 8, /* INTREQ20A */ \
  83. { p ## _IRQ16, p ## _IRQ17, p ## _IRQ18, p ## _IRQ19, \
  84. p ## _IRQ20, p ## _IRQ21, p ## _IRQ22, p ## _IRQ23 } }, \
  85. { base + 0x2c, 0, 8, /* INTREQ30A */ \
  86. { p ## _IRQ24, p ## _IRQ25, p ## _IRQ26, p ## _IRQ27, \
  87. p ## _IRQ28, p ## _IRQ29, p ## _IRQ30, p ## _IRQ31 } }
  88. #define INTC_IRQ_PINS_16(p, base, vect, str) \
  89. \
  90. static struct resource p ## _resources[] __initdata = { \
  91. [0] = { \
  92. .start = base, \
  93. .end = base + 0x64, \
  94. .flags = IORESOURCE_MEM, \
  95. }, \
  96. }; \
  97. \
  98. enum { \
  99. p ## _UNUSED = 0, \
  100. INTC_IRQ_PINS_ENUM_16L(p), \
  101. }; \
  102. \
  103. static struct intc_vect p ## _vectors[] __initdata = { \
  104. INTC_IRQ_PINS_VECT_16L(p, vect), \
  105. }; \
  106. \
  107. static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
  108. INTC_IRQ_PINS_MASK_16L(p, base), \
  109. }; \
  110. \
  111. static struct intc_prio_reg p ## _prio_registers[] __initdata = { \
  112. INTC_IRQ_PINS_PRIO_16L(p, base), \
  113. }; \
  114. \
  115. static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
  116. INTC_IRQ_PINS_SENSE_16L(p, base), \
  117. }; \
  118. \
  119. static struct intc_mask_reg p ## _ack_registers[] __initdata = { \
  120. INTC_IRQ_PINS_ACK_16L(p, base), \
  121. }; \
  122. \
  123. static struct intc_desc p ## _desc __initdata = { \
  124. .name = str, \
  125. .resource = p ## _resources, \
  126. .num_resources = ARRAY_SIZE(p ## _resources), \
  127. .hw = INTC_HW_DESC(p ## _vectors, NULL, \
  128. p ## _mask_registers, p ## _prio_registers, \
  129. p ## _sense_registers, p ## _ack_registers) \
  130. }
  131. #define INTC_IRQ_PINS_32(p, base, vect, str) \
  132. \
  133. static struct resource p ## _resources[] __initdata = { \
  134. [0] = { \
  135. .start = base, \
  136. .end = base + 0x6c, \
  137. .flags = IORESOURCE_MEM, \
  138. }, \
  139. }; \
  140. \
  141. enum { \
  142. p ## _UNUSED = 0, \
  143. INTC_IRQ_PINS_ENUM_16L(p), \
  144. INTC_IRQ_PINS_ENUM_16H(p), \
  145. }; \
  146. \
  147. static struct intc_vect p ## _vectors[] __initdata = { \
  148. INTC_IRQ_PINS_VECT_16L(p, vect), \
  149. INTC_IRQ_PINS_VECT_16H(p, vect), \
  150. }; \
  151. \
  152. static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
  153. INTC_IRQ_PINS_MASK_16L(p, base), \
  154. INTC_IRQ_PINS_MASK_16H(p, base), \
  155. }; \
  156. \
  157. static struct intc_prio_reg p ## _prio_registers[] __initdata = { \
  158. INTC_IRQ_PINS_PRIO_16L(p, base), \
  159. INTC_IRQ_PINS_PRIO_16H(p, base), \
  160. }; \
  161. \
  162. static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
  163. INTC_IRQ_PINS_SENSE_16L(p, base), \
  164. INTC_IRQ_PINS_SENSE_16H(p, base), \
  165. }; \
  166. \
  167. static struct intc_mask_reg p ## _ack_registers[] __initdata = { \
  168. INTC_IRQ_PINS_ACK_16L(p, base), \
  169. INTC_IRQ_PINS_ACK_16H(p, base), \
  170. }; \
  171. \
  172. static struct intc_desc p ## _desc __initdata = { \
  173. .name = str, \
  174. .resource = p ## _resources, \
  175. .num_resources = ARRAY_SIZE(p ## _resources), \
  176. .hw = INTC_HW_DESC(p ## _vectors, NULL, \
  177. p ## _mask_registers, p ## _prio_registers, \
  178. p ## _sense_registers, p ## _ack_registers) \
  179. }
  180. #define INTC_PINT_E_EMPTY
  181. #define INTC_PINT_E_NONE 0, 0, 0, 0, 0, 0, 0, 0,
  182. #define INTC_PINT_E(p) \
  183. PINT ## p ## 0, PINT ## p ## 1, PINT ## p ## 2, PINT ## p ## 3, \
  184. PINT ## p ## 4, PINT ## p ## 5, PINT ## p ## 6, PINT ## p ## 7,
  185. #define INTC_PINT_V_NONE
  186. #define INTC_PINT_V(p, vect) \
  187. vect(PINT ## p ## 0, 0), vect(PINT ## p ## 1, 1), \
  188. vect(PINT ## p ## 2, 2), vect(PINT ## p ## 3, 3), \
  189. vect(PINT ## p ## 4, 4), vect(PINT ## p ## 5, 5), \
  190. vect(PINT ## p ## 6, 6), vect(PINT ## p ## 7, 7),
  191. #define INTC_PINT(p, mask_reg, sense_base, str, \
  192. enums_1, enums_2, enums_3, enums_4, \
  193. vect_1, vect_2, vect_3, vect_4, \
  194. mask_a, mask_b, mask_c, mask_d, \
  195. sense_a, sense_b, sense_c, sense_d) \
  196. \
  197. enum { \
  198. PINT ## p ## _UNUSED = 0, \
  199. enums_1 enums_2 enums_3 enums_4 \
  200. }; \
  201. \
  202. static struct intc_vect p ## _vectors[] __initdata = { \
  203. vect_1 vect_2 vect_3 vect_4 \
  204. }; \
  205. \
  206. static struct intc_mask_reg p ## _mask_registers[] __initdata = { \
  207. { mask_reg, 0, 32, /* PINTER */ \
  208. { mask_a mask_b mask_c mask_d } } \
  209. }; \
  210. \
  211. static struct intc_sense_reg p ## _sense_registers[] __initdata = { \
  212. { sense_base + 0x00, 16, 2, /* PINTCR */ \
  213. { sense_a } }, \
  214. { sense_base + 0x04, 16, 2, /* PINTCR */ \
  215. { sense_b } }, \
  216. { sense_base + 0x08, 16, 2, /* PINTCR */ \
  217. { sense_c } }, \
  218. { sense_base + 0x0c, 16, 2, /* PINTCR */ \
  219. { sense_d } }, \
  220. }; \
  221. \
  222. static struct intc_desc p ## _desc __initdata = { \
  223. .name = str, \
  224. .hw = INTC_HW_DESC(p ## _vectors, NULL, \
  225. p ## _mask_registers, NULL, \
  226. p ## _sense_registers, NULL), \
  227. }
  228. #endif /* __ASM_MACH_INTC_H */