irq.h 19 KB

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