irq.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  1. #ifndef __ASM_SH_IRQ_H
  2. #define __ASM_SH_IRQ_H
  3. /*
  4. *
  5. * linux/include/asm-sh/irq.h
  6. *
  7. * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
  8. * Copyright (C) 2000 Kazumoto Kojima
  9. * Copyright (C) 2003 Paul Mundt
  10. *
  11. */
  12. #include <asm/machvec.h>
  13. #include <asm/ptrace.h> /* for pt_regs */
  14. #if defined(CONFIG_SH_HP6XX) || \
  15. defined(CONFIG_SH_RTS7751R2D) || \
  16. defined(CONFIG_SH_HS7751RVOIP) || \
  17. defined(CONFIG_SH_HS7751RVOIP) || \
  18. defined(CONFIG_SH_SH03) || \
  19. defined(CONFIG_SH_R7780RP) || \
  20. defined(CONFIG_SH_LANDISK)
  21. #include <asm/mach/ide.h>
  22. #endif
  23. #ifndef CONFIG_CPU_SUBTYPE_SH7780
  24. #define INTC_DMAC0_MSK 0
  25. #if defined(CONFIG_CPU_SH3)
  26. #define INTC_IPRA 0xfffffee2UL
  27. #define INTC_IPRB 0xfffffee4UL
  28. #elif defined(CONFIG_CPU_SH4)
  29. #define INTC_IPRA 0xffd00004UL
  30. #define INTC_IPRB 0xffd00008UL
  31. #define INTC_IPRC 0xffd0000cUL
  32. #define INTC_IPRD 0xffd00010UL
  33. #endif
  34. #ifdef CONFIG_IDE
  35. # ifndef IRQ_CFCARD
  36. # define IRQ_CFCARD 14
  37. # endif
  38. # ifndef IRQ_PCMCIA
  39. # define IRQ_PCMCIA 15
  40. # endif
  41. #endif
  42. #define TIMER_IRQ 16
  43. #define TIMER_IPR_ADDR INTC_IPRA
  44. #define TIMER_IPR_POS 3
  45. #define TIMER_PRIORITY 2
  46. #define TIMER1_IRQ 17
  47. #define TIMER1_IPR_ADDR INTC_IPRA
  48. #define TIMER1_IPR_POS 2
  49. #define TIMER1_PRIORITY 4
  50. #define RTC_IRQ 22
  51. #define RTC_IPR_ADDR INTC_IPRA
  52. #define RTC_IPR_POS 0
  53. #define RTC_PRIORITY TIMER_PRIORITY
  54. #if defined(CONFIG_CPU_SH3)
  55. #define DMTE0_IRQ 48
  56. #define DMTE1_IRQ 49
  57. #define DMTE2_IRQ 50
  58. #define DMTE3_IRQ 51
  59. #define DMA_IPR_ADDR INTC_IPRE
  60. #define DMA_IPR_POS 3
  61. #define DMA_PRIORITY 7
  62. #if defined(CONFIG_CPU_SUBTYPE_SH7300)
  63. /* TMU2 */
  64. #define TIMER2_IRQ 18
  65. #define TIMER2_IPR_ADDR INTC_IPRA
  66. #define TIMER2_IPR_POS 1
  67. #define TIMER2_PRIORITY 2
  68. /* WDT */
  69. #define WDT_IRQ 27
  70. #define WDT_IPR_ADDR INTC_IPRB
  71. #define WDT_IPR_POS 3
  72. #define WDT_PRIORITY 2
  73. /* SIM (SIM Card Module) */
  74. #define SIM_ERI_IRQ 23
  75. #define SIM_RXI_IRQ 24
  76. #define SIM_TXI_IRQ 25
  77. #define SIM_TEND_IRQ 26
  78. #define SIM_IPR_ADDR INTC_IPRB
  79. #define SIM_IPR_POS 1
  80. #define SIM_PRIORITY 2
  81. /* VIO (Video I/O) */
  82. #define VIO_IRQ 52
  83. #define VIO_IPR_ADDR INTC_IPRE
  84. #define VIO_IPR_POS 2
  85. #define VIO_PRIORITY 2
  86. /* MFI (Multi Functional Interface) */
  87. #define MFI_IRQ 56
  88. #define MFI_IPR_ADDR INTC_IPRE
  89. #define MFI_IPR_POS 1
  90. #define MFI_PRIORITY 2
  91. /* VPU (Video Processing Unit) */
  92. #define VPU_IRQ 60
  93. #define VPU_IPR_ADDR INTC_IPRE
  94. #define VPU_IPR_POS 0
  95. #define VPU_PRIORITY 2
  96. /* KEY (Key Scan Interface) */
  97. #define KEY_IRQ 79
  98. #define KEY_IPR_ADDR INTC_IPRF
  99. #define KEY_IPR_POS 3
  100. #define KEY_PRIORITY 2
  101. /* CMT (Compare Match Timer) */
  102. #define CMT_IRQ 104
  103. #define CMT_IPR_ADDR INTC_IPRF
  104. #define CMT_IPR_POS 0
  105. #define CMT_PRIORITY 2
  106. /* DMAC(1) */
  107. #define DMTE0_IRQ 48
  108. #define DMTE1_IRQ 49
  109. #define DMTE2_IRQ 50
  110. #define DMTE3_IRQ 51
  111. #define DMA1_IPR_ADDR INTC_IPRE
  112. #define DMA1_IPR_POS 3
  113. #define DMA1_PRIORITY 7
  114. /* DMAC(2) */
  115. #define DMTE4_IRQ 76
  116. #define DMTE5_IRQ 77
  117. #define DMA2_IPR_ADDR INTC_IPRF
  118. #define DMA2_IPR_POS 2
  119. #define DMA2_PRIORITY 7
  120. /* SIOF0 */
  121. #define SIOF0_IRQ 84
  122. #define SIOF0_IPR_ADDR INTC_IPRH
  123. #define SIOF0_IPR_POS 3
  124. #define SIOF0_PRIORITY 3
  125. /* FLCTL (Flash Memory Controller) */
  126. #define FLSTE_IRQ 92
  127. #define FLTEND_IRQ 93
  128. #define FLTRQ0_IRQ 94
  129. #define FLTRQ1_IRQ 95
  130. #define FLCTL_IPR_ADDR INTC_IPRH
  131. #define FLCTL_IPR_POS 1
  132. #define FLCTL_PRIORITY 3
  133. /* IIC (IIC Bus Interface) */
  134. #define IIC_ALI_IRQ 96
  135. #define IIC_TACKI_IRQ 97
  136. #define IIC_WAITI_IRQ 98
  137. #define IIC_DTEI_IRQ 99
  138. #define IIC_IPR_ADDR INTC_IPRH
  139. #define IIC_IPR_POS 0
  140. #define IIC_PRIORITY 3
  141. /* SIO0 */
  142. #define SIO0_IRQ 88
  143. #define SIO0_IPR_ADDR INTC_IPRI
  144. #define SIO0_IPR_POS 3
  145. #define SIO0_PRIORITY 3
  146. /* SIU (Sound Interface Unit) */
  147. #define SIU_IRQ 108
  148. #define SIU_IPR_ADDR INTC_IPRJ
  149. #define SIU_IPR_POS 1
  150. #define SIU_PRIORITY 3
  151. #endif
  152. #elif defined(CONFIG_CPU_SH4)
  153. #define DMTE0_IRQ 34
  154. #define DMTE1_IRQ 35
  155. #define DMTE2_IRQ 36
  156. #define DMTE3_IRQ 37
  157. #define DMTE4_IRQ 44 /* 7751R only */
  158. #define DMTE5_IRQ 45 /* 7751R only */
  159. #define DMTE6_IRQ 46 /* 7751R only */
  160. #define DMTE7_IRQ 47 /* 7751R only */
  161. #define DMAE_IRQ 38
  162. #define DMA_IPR_ADDR INTC_IPRC
  163. #define DMA_IPR_POS 2
  164. #define DMA_PRIORITY 7
  165. #endif
  166. #if defined (CONFIG_CPU_SUBTYPE_SH7707) || defined (CONFIG_CPU_SUBTYPE_SH7708) || \
  167. defined (CONFIG_CPU_SUBTYPE_SH7709) || defined (CONFIG_CPU_SUBTYPE_SH7750) || \
  168. defined (CONFIG_CPU_SUBTYPE_SH7751) || defined (CONFIG_CPU_SUBTYPE_SH7706)
  169. #define SCI_ERI_IRQ 23
  170. #define SCI_RXI_IRQ 24
  171. #define SCI_TXI_IRQ 25
  172. #define SCI_IPR_ADDR INTC_IPRB
  173. #define SCI_IPR_POS 1
  174. #define SCI_PRIORITY 3
  175. #endif
  176. #if defined(CONFIG_CPU_SUBTYPE_SH7300)
  177. #define SCIF0_IRQ 80
  178. #define SCIF0_IPR_ADDR INTC_IPRG
  179. #define SCIF0_IPR_POS 3
  180. #define SCIF0_PRIORITY 3
  181. #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
  182. defined(CONFIG_CPU_SUBTYPE_SH7706) || \
  183. defined(CONFIG_CPU_SUBTYPE_SH7707) || \
  184. defined(CONFIG_CPU_SUBTYPE_SH7709)
  185. #define SCIF_ERI_IRQ 56
  186. #define SCIF_RXI_IRQ 57
  187. #define SCIF_BRI_IRQ 58
  188. #define SCIF_TXI_IRQ 59
  189. #define SCIF_IPR_ADDR INTC_IPRE
  190. #define SCIF_IPR_POS 1
  191. #define SCIF_PRIORITY 3
  192. #define IRDA_ERI_IRQ 52
  193. #define IRDA_RXI_IRQ 53
  194. #define IRDA_BRI_IRQ 54
  195. #define IRDA_TXI_IRQ 55
  196. #define IRDA_IPR_ADDR INTC_IPRE
  197. #define IRDA_IPR_POS 2
  198. #define IRDA_PRIORITY 3
  199. #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
  200. defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
  201. #define SCIF_ERI_IRQ 40
  202. #define SCIF_RXI_IRQ 41
  203. #define SCIF_BRI_IRQ 42
  204. #define SCIF_TXI_IRQ 43
  205. #define SCIF_IPR_ADDR INTC_IPRC
  206. #define SCIF_IPR_POS 1
  207. #define SCIF_PRIORITY 3
  208. #if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
  209. #define SCIF1_ERI_IRQ 23
  210. #define SCIF1_RXI_IRQ 24
  211. #define SCIF1_BRI_IRQ 25
  212. #define SCIF1_TXI_IRQ 26
  213. #define SCIF1_IPR_ADDR INTC_IPRB
  214. #define SCIF1_IPR_POS 1
  215. #define SCIF1_PRIORITY 3
  216. #endif /* ST40STB1 */
  217. #endif /* 775x / SH4-202 / ST40STB1 */
  218. #endif /* 7780 */
  219. /* NR_IRQS is made from three components:
  220. * 1. ONCHIP_NR_IRQS - number of IRLS + on-chip peripherial modules
  221. * 2. PINT_NR_IRQS - number of PINT interrupts
  222. * 3. OFFCHIP_NR_IRQS - numbe of IRQs from off-chip peripherial modules
  223. */
  224. /* 1. ONCHIP_NR_IRQS */
  225. #if defined(CONFIG_CPU_SUBTYPE_SH7604)
  226. # define ONCHIP_NR_IRQS 24 // Actually 21
  227. #elif defined(CONFIG_CPU_SUBTYPE_SH7707)
  228. # define ONCHIP_NR_IRQS 64
  229. # define PINT_NR_IRQS 16
  230. #elif defined(CONFIG_CPU_SUBTYPE_SH7708)
  231. # define ONCHIP_NR_IRQS 32
  232. #elif defined(CONFIG_CPU_SUBTYPE_SH7709) || \
  233. defined(CONFIG_CPU_SUBTYPE_SH7706) || \
  234. defined(CONFIG_CPU_SUBTYPE_SH7705)
  235. # define ONCHIP_NR_IRQS 64 // Actually 61
  236. # define PINT_NR_IRQS 16
  237. #elif defined(CONFIG_CPU_SUBTYPE_SH7710)
  238. # define ONCHIP_NR_IRQS 104
  239. #elif defined(CONFIG_CPU_SUBTYPE_SH7750)
  240. # define ONCHIP_NR_IRQS 48 // Actually 44
  241. #elif defined(CONFIG_CPU_SUBTYPE_SH7751)
  242. # define ONCHIP_NR_IRQS 72
  243. #elif defined(CONFIG_CPU_SUBTYPE_SH7760)
  244. # define ONCHIP_NR_IRQS 112 /* XXX */
  245. #elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
  246. # define ONCHIP_NR_IRQS 72
  247. #elif defined(CONFIG_CPU_SUBTYPE_ST40STB1)
  248. # define ONCHIP_NR_IRQS 144
  249. #elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
  250. defined(CONFIG_CPU_SUBTYPE_SH73180) || \
  251. defined(CONFIG_CPU_SUBTYPE_SH7343)
  252. # define ONCHIP_NR_IRQS 109
  253. #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
  254. # define ONCHIP_NR_IRQS 111
  255. #elif defined(CONFIG_SH_UNKNOWN) /* Most be last */
  256. # define ONCHIP_NR_IRQS 144
  257. #endif
  258. /* 2. PINT_NR_IRQS */
  259. #ifdef CONFIG_SH_UNKNOWN
  260. # define PINT_NR_IRQS 16
  261. #else
  262. # ifndef PINT_NR_IRQS
  263. # define PINT_NR_IRQS 0
  264. # endif
  265. #endif
  266. #if PINT_NR_IRQS > 0
  267. # define PINT_IRQ_BASE ONCHIP_NR_IRQS
  268. #endif
  269. /* 3. OFFCHIP_NR_IRQS */
  270. #if defined(CONFIG_HD64461)
  271. # define OFFCHIP_NR_IRQS 18
  272. #elif defined (CONFIG_SH_BIGSUR) /* must be before CONFIG_HD64465 */
  273. # define OFFCHIP_NR_IRQS 48
  274. #elif defined(CONFIG_HD64465)
  275. # define OFFCHIP_NR_IRQS 16
  276. #elif defined (CONFIG_SH_EC3104)
  277. # define OFFCHIP_NR_IRQS 16
  278. #elif defined (CONFIG_SH_DREAMCAST)
  279. # define OFFCHIP_NR_IRQS 96
  280. #elif defined (CONFIG_SH_TITAN)
  281. # define OFFCHIP_NR_IRQS 4
  282. #elif defined(CONFIG_SH_R7780RP)
  283. # define OFFCHIP_NR_IRQS 16
  284. #elif defined(CONFIG_SH_7343_SOLUTION_ENGINE)
  285. # define OFFCHIP_NR_IRQS 12
  286. #elif defined(CONFIG_SH_UNKNOWN)
  287. # define OFFCHIP_NR_IRQS 16 /* Must also be last */
  288. #else
  289. # define OFFCHIP_NR_IRQS 0
  290. #endif
  291. #if OFFCHIP_NR_IRQS > 0
  292. # define OFFCHIP_IRQ_BASE (ONCHIP_NR_IRQS + PINT_NR_IRQS)
  293. #endif
  294. /* NR_IRQS. 1+2+3 */
  295. #define NR_IRQS (ONCHIP_NR_IRQS + PINT_NR_IRQS + OFFCHIP_NR_IRQS)
  296. extern void disable_irq(unsigned int);
  297. extern void disable_irq_nosync(unsigned int);
  298. extern void enable_irq(unsigned int);
  299. /*
  300. * Simple Mask Register Support
  301. */
  302. extern void make_maskreg_irq(unsigned int irq);
  303. extern unsigned short *irq_mask_register;
  304. /*
  305. * PINT IRQs
  306. */
  307. void init_IRQ_pint(void);
  308. /*
  309. * Function for "on chip support modules".
  310. */
  311. extern void make_ipr_irq(unsigned int irq, unsigned int addr,
  312. int pos, int priority);
  313. extern void make_imask_irq(unsigned int irq);
  314. #if defined(CONFIG_CPU_SUBTYPE_SH7300)
  315. #undef INTC_IPRA
  316. #undef INTC_IPRB
  317. #define INTC_IPRA 0xA414FEE2UL
  318. #define INTC_IPRB 0xA414FEE4UL
  319. #define INTC_IPRC 0xA4140016UL
  320. #define INTC_IPRD 0xA4140018UL
  321. #define INTC_IPRE 0xA414001AUL
  322. #define INTC_IPRF 0xA4080000UL
  323. #define INTC_IPRG 0xA4080002UL
  324. #define INTC_IPRH 0xA4080004UL
  325. #define INTC_IPRI 0xA4080006UL
  326. #define INTC_IPRJ 0xA4080008UL
  327. #define INTC_IMR0 0xA4080040UL
  328. #define INTC_IMR1 0xA4080042UL
  329. #define INTC_IMR2 0xA4080044UL
  330. #define INTC_IMR3 0xA4080046UL
  331. #define INTC_IMR4 0xA4080048UL
  332. #define INTC_IMR5 0xA408004AUL
  333. #define INTC_IMR6 0xA408004CUL
  334. #define INTC_IMR7 0xA408004EUL
  335. #define INTC_IMR8 0xA4080050UL
  336. #define INTC_IMR9 0xA4080052UL
  337. #define INTC_IMR10 0xA4080054UL
  338. #define INTC_IMCR0 0xA4080060UL
  339. #define INTC_IMCR1 0xA4080062UL
  340. #define INTC_IMCR2 0xA4080064UL
  341. #define INTC_IMCR3 0xA4080066UL
  342. #define INTC_IMCR4 0xA4080068UL
  343. #define INTC_IMCR5 0xA408006AUL
  344. #define INTC_IMCR6 0xA408006CUL
  345. #define INTC_IMCR7 0xA408006EUL
  346. #define INTC_IMCR8 0xA4080070UL
  347. #define INTC_IMCR9 0xA4080072UL
  348. #define INTC_IMCR10 0xA4080074UL
  349. #define INTC_ICR0 0xA414FEE0UL
  350. #define INTC_ICR1 0xA4140010UL
  351. #define INTC_IRR0 0xA4140004UL
  352. #define PORT_PACR 0xA4050100UL
  353. #define PORT_PBCR 0xA4050102UL
  354. #define PORT_PCCR 0xA4050104UL
  355. #define PORT_PDCR 0xA4050106UL
  356. #define PORT_PECR 0xA4050108UL
  357. #define PORT_PFCR 0xA405010AUL
  358. #define PORT_PGCR 0xA405010CUL
  359. #define PORT_PHCR 0xA405010EUL
  360. #define PORT_PJCR 0xA4050110UL
  361. #define PORT_PKCR 0xA4050112UL
  362. #define PORT_PLCR 0xA4050114UL
  363. #define PORT_SCPCR 0xA4050116UL
  364. #define PORT_PMCR 0xA4050118UL
  365. #define PORT_PNCR 0xA405011AUL
  366. #define PORT_PQCR 0xA405011CUL
  367. #define PORT_PSELA 0xA4050140UL
  368. #define PORT_PSELB 0xA4050142UL
  369. #define PORT_PSELC 0xA4050144UL
  370. #define PORT_HIZCRA 0xA4050146UL
  371. #define PORT_HIZCRB 0xA4050148UL
  372. #define PORT_DRVCR 0xA4050150UL
  373. #define PORT_PADR 0xA4050120UL
  374. #define PORT_PBDR 0xA4050122UL
  375. #define PORT_PCDR 0xA4050124UL
  376. #define PORT_PDDR 0xA4050126UL
  377. #define PORT_PEDR 0xA4050128UL
  378. #define PORT_PFDR 0xA405012AUL
  379. #define PORT_PGDR 0xA405012CUL
  380. #define PORT_PHDR 0xA405012EUL
  381. #define PORT_PJDR 0xA4050130UL
  382. #define PORT_PKDR 0xA4050132UL
  383. #define PORT_PLDR 0xA4050134UL
  384. #define PORT_SCPDR 0xA4050136UL
  385. #define PORT_PMDR 0xA4050138UL
  386. #define PORT_PNDR 0xA405013AUL
  387. #define PORT_PQDR 0xA405013CUL
  388. #define IRQ0_IRQ 32
  389. #define IRQ1_IRQ 33
  390. #define IRQ2_IRQ 34
  391. #define IRQ3_IRQ 35
  392. #define IRQ4_IRQ 36
  393. #define IRQ5_IRQ 37
  394. #define IRQ0_IPR_ADDR INTC_IPRC
  395. #define IRQ1_IPR_ADDR INTC_IPRC
  396. #define IRQ2_IPR_ADDR INTC_IPRC
  397. #define IRQ3_IPR_ADDR INTC_IPRC
  398. #define IRQ4_IPR_ADDR INTC_IPRD
  399. #define IRQ5_IPR_ADDR INTC_IPRD
  400. #define IRQ0_IPR_POS 0
  401. #define IRQ1_IPR_POS 1
  402. #define IRQ2_IPR_POS 2
  403. #define IRQ3_IPR_POS 3
  404. #define IRQ4_IPR_POS 0
  405. #define IRQ5_IPR_POS 1
  406. #define IRQ0_PRIORITY 1
  407. #define IRQ1_PRIORITY 1
  408. #define IRQ2_PRIORITY 1
  409. #define IRQ3_PRIORITY 1
  410. #define IRQ4_PRIORITY 1
  411. #define IRQ5_PRIORITY 1
  412. extern int ipr_irq_demux(int irq);
  413. #define __irq_demux(irq) ipr_irq_demux(irq)
  414. #elif defined(CONFIG_CPU_SUBTYPE_SH7604)
  415. #define INTC_IPRA 0xfffffee2UL
  416. #define INTC_IPRB 0xfffffe60UL
  417. #define INTC_VCRA 0xfffffe62UL
  418. #define INTC_VCRB 0xfffffe64UL
  419. #define INTC_VCRC 0xfffffe66UL
  420. #define INTC_VCRD 0xfffffe68UL
  421. #define INTC_VCRWDT 0xfffffee4UL
  422. #define INTC_VCRDIV 0xffffff0cUL
  423. #define INTC_VCRDMA0 0xffffffa0UL
  424. #define INTC_VCRDMA1 0xffffffa8UL
  425. #define INTC_ICR 0xfffffee0UL
  426. #elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
  427. defined(CONFIG_CPU_SUBTYPE_SH7706) || \
  428. defined(CONFIG_CPU_SUBTYPE_SH7707) || \
  429. defined(CONFIG_CPU_SUBTYPE_SH7709) || \
  430. defined(CONFIG_CPU_SUBTYPE_SH7710)
  431. #define INTC_IRR0 0xa4000004UL
  432. #define INTC_IRR1 0xa4000006UL
  433. #define INTC_IRR2 0xa4000008UL
  434. #define INTC_ICR0 0xfffffee0UL
  435. #define INTC_ICR1 0xa4000010UL
  436. #define INTC_ICR2 0xa4000012UL
  437. #define INTC_INTER 0xa4000014UL
  438. #define INTC_IPRC 0xa4000016UL
  439. #define INTC_IPRD 0xa4000018UL
  440. #define INTC_IPRE 0xa400001aUL
  441. #if defined(CONFIG_CPU_SUBTYPE_SH7707)
  442. #define INTC_IPRF 0xa400001cUL
  443. #elif defined(CONFIG_CPU_SUBTYPE_SH7705)
  444. #define INTC_IPRF 0xa4080000UL
  445. #define INTC_IPRG 0xa4080002UL
  446. #define INTC_IPRH 0xa4080004UL
  447. #elif defined(CONFIG_CPU_SUBTYPE_SH7710)
  448. /* Interrupt Controller Registers */
  449. #undef INTC_IPRA
  450. #undef INTC_IPRB
  451. #define INTC_IPRA 0xA414FEE2UL
  452. #define INTC_IPRB 0xA414FEE4UL
  453. #define INTC_IPRF 0xA4080000UL
  454. #define INTC_IPRG 0xA4080002UL
  455. #define INTC_IPRH 0xA4080004UL
  456. #define INTC_IPRI 0xA4080006UL
  457. #undef INTC_ICR0
  458. #undef INTC_ICR1
  459. #define INTC_ICR0 0xA414FEE0UL
  460. #define INTC_ICR1 0xA4140010UL
  461. #define INTC_IRR0 0xa4000004UL
  462. #define INTC_IRR1 0xa4000006UL
  463. #define INTC_IRR2 0xa4000008UL
  464. #define INTC_IRR3 0xa400000AUL
  465. #define INTC_IRR4 0xa400000CUL
  466. #define INTC_IRR5 0xa4080020UL
  467. #define INTC_IRR7 0xa4080024UL
  468. #define INTC_IRR8 0xa4080026UL
  469. /* Interrupt numbers */
  470. #define TIMER2_IRQ 18
  471. #define TIMER2_IPR_ADDR INTC_IPRA
  472. #define TIMER2_IPR_POS 1
  473. #define TIMER2_PRIORITY 2
  474. /* WDT */
  475. #define WDT_IRQ 27
  476. #define WDT_IPR_ADDR INTC_IPRB
  477. #define WDT_IPR_POS 3
  478. #define WDT_PRIORITY 2
  479. #define SCIF0_ERI_IRQ 52
  480. #define SCIF0_RXI_IRQ 53
  481. #define SCIF0_BRI_IRQ 54
  482. #define SCIF0_TXI_IRQ 55
  483. #define SCIF0_IPR_ADDR INTC_IPRE
  484. #define SCIF0_IPR_POS 2
  485. #define SCIF0_PRIORITY 3
  486. #define DMTE4_IRQ 76
  487. #define DMTE5_IRQ 77
  488. #define DMA2_IPR_ADDR INTC_IPRF
  489. #define DMA2_IPR_POS 2
  490. #define DMA2_PRIORITY 7
  491. #define IPSEC_IRQ 79
  492. #define IPSEC_IPR_ADDR INTC_IPRF
  493. #define IPSEC_IPR_POS 3
  494. #define IPSEC_PRIORITY 3
  495. /* EDMAC */
  496. #define EDMAC0_IRQ 80
  497. #define EDMAC0_IPR_ADDR INTC_IPRG
  498. #define EDMAC0_IPR_POS 3
  499. #define EDMAC0_PRIORITY 3
  500. #define EDMAC1_IRQ 81
  501. #define EDMAC1_IPR_ADDR INTC_IPRG
  502. #define EDMAC1_IPR_POS 2
  503. #define EDMAC1_PRIORITY 3
  504. #define EDMAC2_IRQ 82
  505. #define EDMAC2_IPR_ADDR INTC_IPRG
  506. #define EDMAC2_IPR_POS 1
  507. #define EDMAC2_PRIORITY 3
  508. /* SIOF */
  509. #define SIOF0_ERI_IRQ 96
  510. #define SIOF0_TXI_IRQ 97
  511. #define SIOF0_RXI_IRQ 98
  512. #define SIOF0_CCI_IRQ 99
  513. #define SIOF0_IPR_ADDR INTC_IPRH
  514. #define SIOF0_IPR_POS 0
  515. #define SIOF0_PRIORITY 7
  516. #define SIOF1_ERI_IRQ 100
  517. #define SIOF1_TXI_IRQ 101
  518. #define SIOF1_RXI_IRQ 102
  519. #define SIOF1_CCI_IRQ 103
  520. #define SIOF1_IPR_ADDR INTC_IPRI
  521. #define SIOF1_IPR_POS 1
  522. #define SIOF1_PRIORITY 7
  523. #endif /* CONFIG_CPU_SUBTYPE_SH7710 */
  524. #if defined(CONFIG_CPU_SUBTYPE_SH7710)
  525. #define PORT_PACR 0xa4050100UL
  526. #define PORT_PBCR 0xa4050102UL
  527. #define PORT_PCCR 0xa4050104UL
  528. #define PORT_PETCR 0xa4050106UL
  529. #define PORT_PADR 0xa4050120UL
  530. #define PORT_PBDR 0xa4050122UL
  531. #define PORT_PCDR 0xa4050124UL
  532. #else
  533. #define PORT_PACR 0xa4000100UL
  534. #define PORT_PBCR 0xa4000102UL
  535. #define PORT_PCCR 0xa4000104UL
  536. #define PORT_PFCR 0xa400010aUL
  537. #define PORT_PADR 0xa4000120UL
  538. #define PORT_PBDR 0xa4000122UL
  539. #define PORT_PCDR 0xa4000124UL
  540. #define PORT_PFDR 0xa400012aUL
  541. #endif
  542. #define IRQ0_IRQ 32
  543. #define IRQ1_IRQ 33
  544. #define IRQ2_IRQ 34
  545. #define IRQ3_IRQ 35
  546. #define IRQ4_IRQ 36
  547. #define IRQ5_IRQ 37
  548. #define IRQ0_IPR_ADDR INTC_IPRC
  549. #define IRQ1_IPR_ADDR INTC_IPRC
  550. #define IRQ2_IPR_ADDR INTC_IPRC
  551. #define IRQ3_IPR_ADDR INTC_IPRC
  552. #define IRQ4_IPR_ADDR INTC_IPRD
  553. #define IRQ5_IPR_ADDR INTC_IPRD
  554. #define IRQ0_IPR_POS 0
  555. #define IRQ1_IPR_POS 1
  556. #define IRQ2_IPR_POS 2
  557. #define IRQ3_IPR_POS 3
  558. #define IRQ4_IPR_POS 0
  559. #define IRQ5_IPR_POS 1
  560. #define IRQ0_PRIORITY 1
  561. #define IRQ1_PRIORITY 1
  562. #define IRQ2_PRIORITY 1
  563. #define IRQ3_PRIORITY 1
  564. #define IRQ4_PRIORITY 1
  565. #define IRQ5_PRIORITY 1
  566. #define PINT0_IRQ 40
  567. #define PINT8_IRQ 41
  568. #define PINT0_IPR_ADDR INTC_IPRD
  569. #define PINT8_IPR_ADDR INTC_IPRD
  570. #define PINT0_IPR_POS 3
  571. #define PINT8_IPR_POS 2
  572. #define PINT0_PRIORITY 2
  573. #define PINT8_PRIORITY 2
  574. extern int ipr_irq_demux(int irq);
  575. #define __irq_demux(irq) ipr_irq_demux(irq)
  576. #endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */
  577. #if defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
  578. defined(CONFIG_CPU_SUBTYPE_ST40STB1) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
  579. #define INTC_ICR 0xffd00000
  580. #define INTC_ICR_NMIL (1<<15)
  581. #define INTC_ICR_MAI (1<<14)
  582. #define INTC_ICR_NMIB (1<<9)
  583. #define INTC_ICR_NMIE (1<<8)
  584. #define INTC_ICR_IRLM (1<<7)
  585. #endif
  586. #ifdef CONFIG_CPU_SUBTYPE_SH7780
  587. #include <asm/irq-sh7780.h>
  588. #endif
  589. /* SH with INTC2-style interrupts */
  590. #ifdef CONFIG_CPU_HAS_INTC2_IRQ
  591. #if defined(CONFIG_CPU_SUBTYPE_ST40STB1)
  592. #define INTC2_BASE 0xfe080000
  593. #define INTC2_FIRST_IRQ 64
  594. #define INTC2_INTREQ_OFFSET 0x20
  595. #define INTC2_INTMSK_OFFSET 0x40
  596. #define INTC2_INTMSKCLR_OFFSET 0x60
  597. #define NR_INTC2_IRQS 25
  598. #elif defined(CONFIG_CPU_SUBTYPE_SH7760)
  599. #define INTC2_BASE 0xfe080000
  600. #define INTC2_FIRST_IRQ 48 /* INTEVT 0x800 */
  601. #define INTC2_INTREQ_OFFSET 0x20
  602. #define INTC2_INTMSK_OFFSET 0x40
  603. #define INTC2_INTMSKCLR_OFFSET 0x60
  604. #define NR_INTC2_IRQS 64
  605. #elif defined(CONFIG_CPU_SUBTYPE_SH7780)
  606. #define INTC2_BASE 0xffd40000
  607. #define INTC2_FIRST_IRQ 21
  608. #define INTC2_INTMSK_OFFSET (0x38)
  609. #define INTC2_INTMSKCLR_OFFSET (0x3c)
  610. #define NR_INTC2_IRQS 60
  611. #endif
  612. #define INTC2_INTPRI_OFFSET 0x00
  613. void make_intc2_irq(unsigned int irq,
  614. unsigned int ipr_offset, unsigned int ipr_shift,
  615. unsigned int msk_offset, unsigned int msk_shift,
  616. unsigned int priority);
  617. void init_IRQ_intc2(void);
  618. void intc2_add_clear_irq(int irq, int (*fn)(int));
  619. #endif
  620. extern int shmse_irq_demux(int irq);
  621. static inline int generic_irq_demux(int irq)
  622. {
  623. return irq;
  624. }
  625. #ifndef __irq_demux
  626. #define __irq_demux(irq) (irq)
  627. #endif
  628. #define irq_canonicalize(irq) (irq)
  629. #define irq_demux(irq) __irq_demux(sh_mv.mv_irq_demux(irq))
  630. #ifdef CONFIG_4KSTACKS
  631. extern void irq_ctx_init(int cpu);
  632. extern void irq_ctx_exit(int cpu);
  633. # define __ARCH_HAS_DO_SOFTIRQ
  634. #else
  635. # define irq_ctx_init(cpu) do { } while (0)
  636. # define irq_ctx_exit(cpu) do { } while (0)
  637. #endif
  638. #if defined(CONFIG_CPU_SUBTYPE_SH73180)
  639. #include <asm/irq-sh73180.h>
  640. #endif
  641. #if defined(CONFIG_CPU_SUBTYPE_SH7343)
  642. #include <asm/irq-sh7343.h>
  643. #endif
  644. #endif /* __ASM_SH_IRQ_H */