2 * linux/arch/sh/boards/renesas/r7780rp/irq.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Renesas Solutions Highlander R7780RP-1 Support.
8 * Modified for R7780RP-1 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/r7780rp/r7780rp.h>
19 #ifdef CONFIG_SH_R7780MP
20 static int mask_pos
[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0};
22 static int mask_pos
[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0};
25 static void enable_r7780rp_irq(unsigned int irq
);
26 static void disable_r7780rp_irq(unsigned int irq
);
28 /* shutdown is same as "disable" */
29 #define shutdown_r7780rp_irq disable_r7780rp_irq
31 static void ack_r7780rp_irq(unsigned int irq
);
32 static void end_r7780rp_irq(unsigned int irq
);
34 static unsigned int startup_r7780rp_irq(unsigned int irq
)
36 enable_r7780rp_irq(irq
);
37 return 0; /* never anything pending */
40 static void disable_r7780rp_irq(unsigned int irq
)
43 unsigned short mask
= 0xffff ^ (0x0001 << mask_pos
[irq
]);
45 /* Set the priority in IPR to 0 */
46 val
= ctrl_inw(IRLCNTR1
);
48 ctrl_outw(val
, IRLCNTR1
);
51 static void enable_r7780rp_irq(unsigned int irq
)
54 unsigned short value
= (0x0001 << mask_pos
[irq
]);
56 /* Set priority in IPR back to original value */
57 val
= ctrl_inw(IRLCNTR1
);
59 ctrl_outw(val
, IRLCNTR1
);
62 static void ack_r7780rp_irq(unsigned int irq
)
64 disable_r7780rp_irq(irq
);
67 static void end_r7780rp_irq(unsigned int irq
)
69 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
70 enable_r7780rp_irq(irq
);
73 static struct hw_interrupt_type r7780rp_irq_type
= {
74 .typename
= "R7780RP-IRQ",
75 .startup
= startup_r7780rp_irq
,
76 .shutdown
= shutdown_r7780rp_irq
,
77 .enable
= enable_r7780rp_irq
,
78 .disable
= disable_r7780rp_irq
,
79 .ack
= ack_r7780rp_irq
,
80 .end
= end_r7780rp_irq
,
83 static void make_r7780rp_irq(unsigned int irq
)
85 disable_irq_nosync(irq
);
86 irq_desc
[irq
].chip
= &r7780rp_irq_type
;
87 disable_r7780rp_irq(irq
);
91 * Initialize IRQ setting
93 void __init
init_r7780rp_IRQ(void)
102 * IRL5=CF Card Insert