2 * linux/arch/sh/boards/renesas/rts7751r2d/irq.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Renesas Technology Sales RTS7751R2D Support.
8 * Modified for RTS7751R2D by
9 * Atom Create Engineering Co., Ltd. 2002.
12 #include <linux/init.h>
13 #include <linux/irq.h>
16 #include <asm/rts7751r2d/rts7751r2d.h>
18 #if defined(CONFIG_RTS7751R2D_REV11)
19 static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
21 static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
24 extern int voyagergx_irq_demux(int irq);
25 extern void setup_voyagergx_irq(void);
27 static void enable_rts7751r2d_irq(unsigned int irq);
28 static void disable_rts7751r2d_irq(unsigned int irq);
30 /* shutdown is same as "disable" */
31 #define shutdown_rts7751r2d_irq disable_rts7751r2d_irq
33 static void ack_rts7751r2d_irq(unsigned int irq);
34 static void end_rts7751r2d_irq(unsigned int irq);
36 static unsigned int startup_rts7751r2d_irq(unsigned int irq)
38 enable_rts7751r2d_irq(irq);
39 return 0; /* never anything pending */
42 static void disable_rts7751r2d_irq(unsigned int irq)
46 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
48 /* Set the priority in IPR to 0 */
49 local_irq_save(flags);
50 val = ctrl_inw(IRLCNTR1);
52 ctrl_outw(val, IRLCNTR1);
53 local_irq_restore(flags);
56 static void enable_rts7751r2d_irq(unsigned int irq)
60 unsigned short value = (0x0001 << mask_pos[irq]);
62 /* Set priority in IPR back to original value */
63 local_irq_save(flags);
64 val = ctrl_inw(IRLCNTR1);
66 ctrl_outw(val, IRLCNTR1);
67 local_irq_restore(flags);
70 int rts7751r2d_irq_demux(int irq)
74 demux_irq = voyagergx_irq_demux(irq);
78 static void ack_rts7751r2d_irq(unsigned int irq)
80 disable_rts7751r2d_irq(irq);
83 static void end_rts7751r2d_irq(unsigned int irq)
85 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
86 enable_rts7751r2d_irq(irq);
89 static struct hw_interrupt_type rts7751r2d_irq_type = {
90 .typename = "RTS7751R2D IRQ",
91 .startup = startup_rts7751r2d_irq,
92 .shutdown = shutdown_rts7751r2d_irq,
93 .enable = enable_rts7751r2d_irq,
94 .disable = disable_rts7751r2d_irq,
95 .ack = ack_rts7751r2d_irq,
96 .end = end_rts7751r2d_irq,
99 static void make_rts7751r2d_irq(unsigned int irq)
101 disable_irq_nosync(irq);
102 irq_desc[irq].chip = &rts7751r2d_irq_type;
103 disable_rts7751r2d_irq(irq);
107 * Initialize IRQ setting
109 void __init init_rts7751r2d_IRQ(void)
116 * IRL3=CF Card Insert
131 make_rts7751r2d_irq(i);
133 setup_voyagergx_irq();