2 * linux/arch/sh/boards/se/7206/irq.c
4 * Copyright (C) 2005,2006 Yoshinori Sato
6 * Hitachi SolutionEngine Support.
9 #include <linux/init.h>
10 #include <linux/irq.h>
12 #include <linux/irq.h>
13 #include <linux/interrupt.h>
14 #include <asm/se7206.h>
16 #define INTSTS0 0x31800000
17 #define INTSTS1 0x31800002
18 #define INTMSK0 0x31800004
19 #define INTMSK1 0x31800006
20 #define INTSEL 0x31800008
26 #define INTC_IPR01 0xfffe0818
27 #define INTC_ICR1 0xfffe0802
29 static void disable_se7206_irq(unsigned int irq)
32 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq)));
33 unsigned short msk0,msk1;
35 /* Set the priority in IPR to 0 */
36 val = ctrl_inw(INTC_IPR01);
38 ctrl_outw(val, INTC_IPR01);
40 msk0 = ctrl_inw(INTMSK0);
41 msk1 = ctrl_inw(INTMSK1);
55 ctrl_outw(msk0, INTMSK0);
56 ctrl_outw(msk1, INTMSK1);
59 static void enable_se7206_irq(unsigned int irq)
62 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq)));
63 unsigned short msk0,msk1;
65 /* Set priority in IPR back to original value */
66 val = ctrl_inw(INTC_IPR01);
68 ctrl_outw(val, INTC_IPR01);
71 msk0 = ctrl_inw(INTMSK0);
72 msk1 = ctrl_inw(INTMSK1);
86 ctrl_outw(msk0, INTMSK0);
87 ctrl_outw(msk1, INTMSK1);
90 static void eoi_se7206_irq(unsigned int irq)
92 unsigned short sts0,sts1;
94 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
95 enable_se7206_irq(irq);
97 sts0 = ctrl_inw(INTSTS0);
98 sts1 = ctrl_inw(INTSTS1);
112 ctrl_outw(sts0, INTSTS0);
113 ctrl_outw(sts1, INTSTS1);
116 static struct irq_chip se7206_irq_chip __read_mostly = {
117 .name = "SE7206-FPGA",
118 .mask = disable_se7206_irq,
119 .unmask = enable_se7206_irq,
120 .mask_ack = disable_se7206_irq,
121 .eoi = eoi_se7206_irq,
124 static void make_se7206_irq(unsigned int irq)
126 disable_irq_nosync(irq);
127 set_irq_chip_and_handler_name(irq, &se7206_irq_chip,
128 handle_level_irq, "level");
129 disable_se7206_irq(irq);
133 * Initialize IRQ setting
135 void __init init_se7206_IRQ(void)
137 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
138 make_se7206_irq(IRQ1_IRQ); /* ATA */
139 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
140 ctrl_outw(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */
142 /* FPGA System register setup*/
143 ctrl_outw(0x0000,INTSTS0); /* Clear INTSTS0 */
144 ctrl_outw(0x0000,INTSTS1); /* Clear INTSTS1 */
145 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
146 ctrl_outw(0x0001,INTSEL);