aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/rbtx4938/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/txx9/rbtx4938/irq.c')
-rw-r--r--arch/mips/txx9/rbtx4938/irq.c48
1 files changed, 29 insertions, 19 deletions
diff --git a/arch/mips/txx9/rbtx4938/irq.c b/arch/mips/txx9/rbtx4938/irq.c
index f4984820251a..3971a061657a 100644
--- a/arch/mips/txx9/rbtx4938/irq.c
+++ b/arch/mips/txx9/rbtx4938/irq.c
@@ -66,6 +66,8 @@ IRQ Device
66*/ 66*/
67#include <linux/init.h> 67#include <linux/init.h>
68#include <linux/interrupt.h> 68#include <linux/interrupt.h>
69#include <asm/mipsregs.h>
70#include <asm/txx9/generic.h>
69#include <asm/txx9/rbtx4938.h> 71#include <asm/txx9/rbtx4938.h>
70 72
71static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq); 73static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq);
@@ -80,26 +82,17 @@ static struct irq_chip toshiba_rbtx4938_irq_ioc_type = {
80 .unmask = toshiba_rbtx4938_irq_ioc_enable, 82 .unmask = toshiba_rbtx4938_irq_ioc_enable,
81}; 83};
82 84
83int 85static int toshiba_rbtx4938_irq_nested(int sw_irq)
84toshiba_rbtx4938_irq_nested(int sw_irq)
85{ 86{
86 u8 level3; 87 u8 level3;
87 88
88 level3 = readb(rbtx4938_imstat_addr); 89 level3 = readb(rbtx4938_imstat_addr);
89 if (level3) 90 if (level3)
90 /* must use fls so onboard ATA has priority */ 91 /* must use fls so onboard ATA has priority */
91 sw_irq = TOSHIBA_RBTX4938_IRQ_IOC_BEG + fls(level3) - 1; 92 sw_irq = RBTX4938_IRQ_IOC + fls(level3) - 1;
92
93 return sw_irq; 93 return sw_irq;
94} 94}
95 95
96static struct irqaction toshiba_rbtx4938_irq_ioc_action = {
97 .handler = no_action,
98 .flags = 0,
99 .mask = CPU_MASK_NONE,
100 .name = TOSHIBA_RBTX4938_IOC_NAME,
101};
102
103/**********************************************************************************/ 96/**********************************************************************************/
104/* Functions for ioc */ 97/* Functions for ioc */
105/**********************************************************************************/ 98/**********************************************************************************/
@@ -108,13 +101,12 @@ toshiba_rbtx4938_irq_ioc_init(void)
108{ 101{
109 int i; 102 int i;
110 103
111 for (i = TOSHIBA_RBTX4938_IRQ_IOC_BEG; 104 for (i = RBTX4938_IRQ_IOC;
112 i <= TOSHIBA_RBTX4938_IRQ_IOC_END; i++) 105 i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++)
113 set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type, 106 set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type,
114 handle_level_irq); 107 handle_level_irq);
115 108
116 setup_irq(RBTX4938_IRQ_IOCINT, 109 set_irq_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq);
117 &toshiba_rbtx4938_irq_ioc_action);
118} 110}
119 111
120static void 112static void
@@ -123,7 +115,7 @@ toshiba_rbtx4938_irq_ioc_enable(unsigned int irq)
123 unsigned char v; 115 unsigned char v;
124 116
125 v = readb(rbtx4938_imask_addr); 117 v = readb(rbtx4938_imask_addr);
126 v |= (1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); 118 v |= (1 << (irq - RBTX4938_IRQ_IOC));
127 writeb(v, rbtx4938_imask_addr); 119 writeb(v, rbtx4938_imask_addr);
128 mmiowb(); 120 mmiowb();
129} 121}
@@ -134,15 +126,33 @@ toshiba_rbtx4938_irq_ioc_disable(unsigned int irq)
134 unsigned char v; 126 unsigned char v;
135 127
136 v = readb(rbtx4938_imask_addr); 128 v = readb(rbtx4938_imask_addr);
137 v &= ~(1 << (irq - TOSHIBA_RBTX4938_IRQ_IOC_BEG)); 129 v &= ~(1 << (irq - RBTX4938_IRQ_IOC));
138 writeb(v, rbtx4938_imask_addr); 130 writeb(v, rbtx4938_imask_addr);
139 mmiowb(); 131 mmiowb();
140} 132}
141 133
142void __init arch_init_irq(void) 134static int rbtx4938_irq_dispatch(int pending)
143{ 135{
144 extern void tx4938_irq_init(void); 136 int irq;
137
138 if (pending & STATUSF_IP7)
139 irq = MIPS_CPU_IRQ_BASE + 7;
140 else if (pending & STATUSF_IP2) {
141 irq = txx9_irq();
142 if (irq == RBTX4938_IRQ_IOCINT)
143 irq = toshiba_rbtx4938_irq_nested(irq);
144 } else if (pending & STATUSF_IP1)
145 irq = MIPS_CPU_IRQ_BASE + 0;
146 else if (pending & STATUSF_IP0)
147 irq = MIPS_CPU_IRQ_BASE + 1;
148 else
149 irq = -1;
150 return irq;
151}
145 152
153void __init rbtx4938_irq_setup(void)
154{
155 txx9_irq_dispatch = rbtx4938_irq_dispatch;
146 /* Now, interrupt control disabled, */ 156 /* Now, interrupt control disabled, */
147 /* all IRC interrupts are masked, */ 157 /* all IRC interrupts are masked, */
148 /* all IRC interrupt mode are Low Active. */ 158 /* all IRC interrupt mode are Low Active. */