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/config.h>
13 #include <linux/init.h>
14 #include <linux/irq.h>
17 #include <asm/rts7751r2d/rts7751r2d.h>
19 #if defined(CONFIG_RTS7751R2D_REV11)
20 static int mask_pos
[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
22 static int mask_pos
[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
25 extern int voyagergx_irq_demux(int irq
);
26 extern void setup_voyagergx_irq(void);
28 static void enable_rts7751r2d_irq(unsigned int irq
);
29 static void disable_rts7751r2d_irq(unsigned int irq
);
31 /* shutdown is same as "disable" */
32 #define shutdown_rts7751r2d_irq disable_rts7751r2d_irq
34 static void ack_rts7751r2d_irq(unsigned int irq
);
35 static void end_rts7751r2d_irq(unsigned int irq
);
37 static unsigned int startup_rts7751r2d_irq(unsigned int irq
)
39 enable_rts7751r2d_irq(irq
);
40 return 0; /* never anything pending */
43 static void disable_rts7751r2d_irq(unsigned int irq
)
47 unsigned short mask
= 0xffff ^ (0x0001 << mask_pos
[irq
]);
49 /* Set the priority in IPR to 0 */
50 local_irq_save(flags
);
51 val
= ctrl_inw(IRLCNTR1
);
53 ctrl_outw(val
, IRLCNTR1
);
54 local_irq_restore(flags
);
57 static void enable_rts7751r2d_irq(unsigned int irq
)
61 unsigned short value
= (0x0001 << mask_pos
[irq
]);
63 /* Set priority in IPR back to original value */
64 local_irq_save(flags
);
65 val
= ctrl_inw(IRLCNTR1
);
67 ctrl_outw(val
, IRLCNTR1
);
68 local_irq_restore(flags
);
71 int rts7751r2d_irq_demux(int irq
)
75 demux_irq
= voyagergx_irq_demux(irq
);
79 static void ack_rts7751r2d_irq(unsigned int irq
)
81 disable_rts7751r2d_irq(irq
);
84 static void end_rts7751r2d_irq(unsigned int irq
)
86 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
87 enable_rts7751r2d_irq(irq
);
90 static struct hw_interrupt_type rts7751r2d_irq_type
= {
92 startup_rts7751r2d_irq
,
93 shutdown_rts7751r2d_irq
,
94 enable_rts7751r2d_irq
,
95 disable_rts7751r2d_irq
,
100 static void make_rts7751r2d_irq(unsigned int irq
)
102 disable_irq_nosync(irq
);
103 irq_desc
[irq
].handler
= &rts7751r2d_irq_type
;
104 disable_rts7751r2d_irq(irq
);
108 * Initialize IRQ setting
110 void __init
init_rts7751r2d_IRQ(void)
117 * IRL3=CF Card Insert
132 make_rts7751r2d_irq(i
);
134 setup_voyagergx_irq();