aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/renesas/rts7751r2d/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/renesas/rts7751r2d/irq.c')
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/irq.c80
1 files changed, 19 insertions, 61 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c
index cb0eb20d1b43..0bae9041aceb 100644
--- a/arch/sh/boards/renesas/rts7751r2d/irq.c
+++ b/arch/sh/boards/renesas/rts7751r2d/irq.c
@@ -9,7 +9,9 @@
9 * Atom Create Engineering Co., Ltd. 2002. 9 * Atom Create Engineering Co., Ltd. 2002.
10 */ 10 */
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/interrupt.h>
12#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h>
13#include <linux/io.h> 15#include <linux/io.h>
14#include <asm/rts7751r2d.h> 16#include <asm/rts7751r2d.h>
15 17
@@ -22,79 +24,31 @@ static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
22extern int voyagergx_irq_demux(int irq); 24extern int voyagergx_irq_demux(int irq);
23extern void setup_voyagergx_irq(void); 25extern void setup_voyagergx_irq(void);
24 26
25static void enable_rts7751r2d_irq(unsigned int irq); 27static void enable_rts7751r2d_irq(unsigned int irq)
26static void disable_rts7751r2d_irq(unsigned int irq);
27
28/* shutdown is same as "disable" */
29#define shutdown_rts7751r2d_irq disable_rts7751r2d_irq
30
31static void ack_rts7751r2d_irq(unsigned int irq);
32static void end_rts7751r2d_irq(unsigned int irq);
33
34static unsigned int startup_rts7751r2d_irq(unsigned int irq)
35{ 28{
36 enable_rts7751r2d_irq(irq); 29 /* Set priority in IPR back to original value */
37 return 0; /* never anything pending */ 30 ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
38} 31}
39 32
40static void disable_rts7751r2d_irq(unsigned int irq) 33static void disable_rts7751r2d_irq(unsigned int irq)
41{ 34{
42 unsigned short val;
43 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
44
45 /* Set the priority in IPR to 0 */ 35 /* Set the priority in IPR to 0 */
46 val = ctrl_inw(IRLCNTR1); 36 ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])),
47 val &= mask; 37 IRLCNTR1);
48 ctrl_outw(val, IRLCNTR1);
49}
50
51static void enable_rts7751r2d_irq(unsigned int irq)
52{
53 unsigned short val;
54 unsigned short value = (0x0001 << mask_pos[irq]);
55
56 /* Set priority in IPR back to original value */
57 val = ctrl_inw(IRLCNTR1);
58 val |= value;
59 ctrl_outw(val, IRLCNTR1);
60} 38}
61 39
62int rts7751r2d_irq_demux(int irq) 40int rts7751r2d_irq_demux(int irq)
63{ 41{
64 int demux_irq; 42 return voyagergx_irq_demux(irq);
65
66 demux_irq = voyagergx_irq_demux(irq);
67 return demux_irq;
68}
69
70static void ack_rts7751r2d_irq(unsigned int irq)
71{
72 disable_rts7751r2d_irq(irq);
73} 43}
74 44
75static void end_rts7751r2d_irq(unsigned int irq) 45static struct irq_chip rts7751r2d_irq_chip __read_mostly = {
76{ 46 .name = "rts7751r2d",
77 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 47 .mask = disable_rts7751r2d_irq,
78 enable_rts7751r2d_irq(irq); 48 .unmask = enable_rts7751r2d_irq,
79} 49 .mask_ack = disable_rts7751r2d_irq,
80
81static struct hw_interrupt_type rts7751r2d_irq_type = {
82 .typename = "RTS7751R2D IRQ",
83 .startup = startup_rts7751r2d_irq,
84 .shutdown = shutdown_rts7751r2d_irq,
85 .enable = enable_rts7751r2d_irq,
86 .disable = disable_rts7751r2d_irq,
87 .ack = ack_rts7751r2d_irq,
88 .end = end_rts7751r2d_irq,
89}; 50};
90 51
91static void make_rts7751r2d_irq(unsigned int irq)
92{
93 disable_irq_nosync(irq);
94 irq_desc[irq].chip = &rts7751r2d_irq_type;
95 disable_rts7751r2d_irq(irq);
96}
97
98/* 52/*
99 * Initialize IRQ setting 53 * Initialize IRQ setting
100 */ 54 */
@@ -119,8 +73,12 @@ void __init init_rts7751r2d_IRQ(void)
119 * IRL14=Extention #3 73 * IRL14=Extention #3
120 */ 74 */
121 75
122 for (i=0; i<15; i++) 76 for (i=0; i<15; i++) {
123 make_rts7751r2d_irq(i); 77 disable_irq_nosync(i);
78 set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip,
79 handle_level_irq, "level");
80 enable_rts7751r2d_irq(i);
81 }
124 82
125 setup_voyagergx_irq(); 83 setup_voyagergx_irq();
126} 84}