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)
45 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
47 /* Set the priority in IPR to 0 */
48 val = ctrl_inw(IRLCNTR1);
50 ctrl_outw(val, IRLCNTR1);
53 static void enable_rts7751r2d_irq(unsigned int irq)
56 unsigned short value = (0x0001 << mask_pos[irq]);
58 /* Set priority in IPR back to original value */
59 val = ctrl_inw(IRLCNTR1);
61 ctrl_outw(val, IRLCNTR1);
64 int rts7751r2d_irq_demux(int irq)
68 demux_irq = voyagergx_irq_demux(irq);
72 static void ack_rts7751r2d_irq(unsigned int irq)
74 disable_rts7751r2d_irq(irq);
77 static void end_rts7751r2d_irq(unsigned int irq)
79 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
80 enable_rts7751r2d_irq(irq);
83 static struct hw_interrupt_type rts7751r2d_irq_type = {
84 .typename = "RTS7751R2D IRQ",
85 .startup = startup_rts7751r2d_irq,
86 .shutdown = shutdown_rts7751r2d_irq,
87 .enable = enable_rts7751r2d_irq,
88 .disable = disable_rts7751r2d_irq,
89 .ack = ack_rts7751r2d_irq,
90 .end = end_rts7751r2d_irq,
93 static void make_rts7751r2d_irq(unsigned int irq)
95 disable_irq_nosync(irq);
96 irq_desc[irq].chip = &rts7751r2d_irq_type;
97 disable_rts7751r2d_irq(irq);
101 * Initialize IRQ setting
103 void __init init_rts7751r2d_IRQ(void)
110 * IRL3=CF Card Insert
125 make_rts7751r2d_irq(i);
127 setup_voyagergx_irq();