2 * linux/arch/sh/boards/se/7206/irq.c
4 * Copyright (C) 2005,2006 Yoshinori Sato
6 * Hitachi SolutionEngine Support.
10 #include <linux/config.h>
11 #include <linux/init.h>
12 #include <linux/irq.h>
15 #include <asm/se7206.h>
17 #define INTSTS0 0x31800000
18 #define INTSTS1 0x31800002
19 #define INTMSK0 0x31800004
20 #define INTMSK1 0x31800006
21 #define INTSEL 0x31800008
23 /* shutdown is same as "disable" */
24 #define shutdown_se7206_irq disable_se7206_irq
26 static void disable_se7206_irq(unsigned int irq
)
29 unsigned short mask
= 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ
- irq
)));
30 unsigned short msk0
,msk1
;
32 /* Set the priority in IPR to 0 */
33 val
= ctrl_inw(INTC_IPR01
);
35 ctrl_outw(val
, INTC_IPR01
);
37 msk0
= ctrl_inw(INTMSK0
);
38 msk1
= ctrl_inw(INTMSK1
);
52 ctrl_outw(msk0
, INTMSK0
);
53 ctrl_outw(msk1
, INTMSK1
);
56 static void enable_se7206_irq(unsigned int irq
)
59 unsigned short value
= (0x0001 << 4 * (3 - (IRQ0_IRQ
- irq
)));
60 unsigned short msk0
,msk1
;
62 /* Set priority in IPR back to original value */
63 val
= ctrl_inw(INTC_IPR01
);
65 ctrl_outw(val
, INTC_IPR01
);
68 msk0
= ctrl_inw(INTMSK0
);
69 msk1
= ctrl_inw(INTMSK1
);
83 ctrl_outw(msk0
, INTMSK0
);
84 ctrl_outw(msk1
, INTMSK1
);
87 static unsigned int startup_se7206_irq(unsigned int irq
)
89 enable_se7206_irq(irq
);
90 return 0; /* never anything pending */
93 static void ack_se7206_irq(unsigned int irq
)
95 disable_se7206_irq(irq
);
98 static void end_se7206_irq(unsigned int irq
)
100 unsigned short sts0
,sts1
;
102 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
103 enable_se7206_irq(irq
);
105 sts0
= ctrl_inw(INTSTS0
);
106 sts1
= ctrl_inw(INTSTS1
);
120 ctrl_outw(sts0
, INTSTS0
);
121 ctrl_outw(sts1
, INTSTS1
);
124 static struct hw_interrupt_type se7206_irq_type
= {
125 .typename
= "SE7206 FPGA-IRQ",
126 .startup
= startup_se7206_irq
,
127 .shutdown
= shutdown_se7206_irq
,
128 .enable
= enable_se7206_irq
,
129 .disable
= disable_se7206_irq
,
130 .ack
= ack_se7206_irq
,
131 .end
= end_se7206_irq
,
134 static void make_se7206_irq(unsigned int irq
)
136 disable_irq_nosync(irq
);
137 irq_desc
[irq
].handler
= &se7206_irq_type
;
138 disable_se7206_irq(irq
);
142 * Initialize IRQ setting
144 void __init
init_se7206_IRQ(void)
146 make_se7206_irq(IRQ0_IRQ
); /* SMC91C111 */
147 make_se7206_irq(IRQ1_IRQ
); /* ATA */
148 make_se7206_irq(IRQ3_IRQ
); /* SLOT / PCM */
149 ctrl_outw(inw(INTC_ICR1
) | 0x000b ,INTC_ICR1
) ; /* ICR1 */
151 /* FPGA System register setup*/
152 ctrl_outw(0x0000,INTSTS0
); /* Clear INTSTS0 */
153 ctrl_outw(0x0000,INTSTS1
); /* Clear INTSTS1 */
154 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
155 ctrl_outw(0x0001,INTSEL
);
158 int se7206_irq_demux(int irq
)