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/interrupt.h>
13 #include <mach-se/mach/se7206.h>
15 #define INTSTS0 0x31800000
16 #define INTSTS1 0x31800002
17 #define INTMSK0 0x31800004
18 #define INTMSK1 0x31800006
19 #define INTSEL 0x31800008
25 #define INTC_IPR01 0xfffe0818
26 #define INTC_ICR1 0xfffe0802
28 static void disable_se7206_irq(unsigned int irq)
31 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq)));
32 unsigned short msk0,msk1;
34 /* Set the priority in IPR to 0 */
35 val = ctrl_inw(INTC_IPR01);
37 ctrl_outw(val, INTC_IPR01);
39 msk0 = ctrl_inw(INTMSK0);
40 msk1 = ctrl_inw(INTMSK1);
54 ctrl_outw(msk0, INTMSK0);
55 ctrl_outw(msk1, INTMSK1);
58 static void enable_se7206_irq(unsigned int irq)
61 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq)));
62 unsigned short msk0,msk1;
64 /* Set priority in IPR back to original value */
65 val = ctrl_inw(INTC_IPR01);
67 ctrl_outw(val, INTC_IPR01);
70 msk0 = ctrl_inw(INTMSK0);
71 msk1 = ctrl_inw(INTMSK1);
85 ctrl_outw(msk0, INTMSK0);
86 ctrl_outw(msk1, INTMSK1);
89 static void eoi_se7206_irq(unsigned int irq)
91 unsigned short sts0,sts1;
93 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
94 enable_se7206_irq(irq);
96 sts0 = ctrl_inw(INTSTS0);
97 sts1 = ctrl_inw(INTSTS1);
111 ctrl_outw(sts0, INTSTS0);
112 ctrl_outw(sts1, INTSTS1);
115 static struct irq_chip se7206_irq_chip __read_mostly = {
116 .name = "SE7206-FPGA",
117 .mask = disable_se7206_irq,
118 .unmask = enable_se7206_irq,
119 .mask_ack = disable_se7206_irq,
120 .eoi = eoi_se7206_irq,
123 static void make_se7206_irq(unsigned int irq)
125 disable_irq_nosync(irq);
126 set_irq_chip_and_handler_name(irq, &se7206_irq_chip,
127 handle_level_irq, "level");
128 disable_se7206_irq(irq);
132 * Initialize IRQ setting
134 void __init init_se7206_IRQ(void)
136 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
137 make_se7206_irq(IRQ1_IRQ); /* ATA */
138 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
139 ctrl_outw(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */
141 /* FPGA System register setup*/
142 ctrl_outw(0x0000,INTSTS0); /* Clear INTSTS0 */
143 ctrl_outw(0x0000,INTSTS1); /* Clear INTSTS1 */
144 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
145 ctrl_outw(0x0001,INTSEL);