aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/sun4c_irq.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-14 01:43:48 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-20 00:18:01 -0400
commit45bb5a7cbfa28dedc07730d6ecedbd574faf5459 (patch)
treef47b58ff80a30763264296a780c91ff0b30a6d7f /arch/sparc/kernel/sun4c_irq.c
parent5ff0d55f93f8119b71b33d4c444cf5105d4c1d12 (diff)
sparc32: Use PROM device probing for sun4c interrupt register.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/sun4c_irq.c')
-rw-r--r--arch/sparc/kernel/sun4c_irq.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index ae3149ecaecd..8033132eda8c 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -59,7 +59,7 @@
59 * 59 *
60 * so don't go making it static, like I tried. sigh. 60 * so don't go making it static, like I tried. sigh.
61 */ 61 */
62unsigned char *interrupt_enable = NULL; 62unsigned char __iomem *interrupt_enable = NULL;
63 63
64static void sun4c_disable_irq(unsigned int irq_nr) 64static void sun4c_disable_irq(unsigned int irq_nr)
65{ 65{
@@ -68,7 +68,7 @@ static void sun4c_disable_irq(unsigned int irq_nr)
68 68
69 local_irq_save(flags); 69 local_irq_save(flags);
70 irq_nr &= (NR_IRQS - 1); 70 irq_nr &= (NR_IRQS - 1);
71 current_mask = *interrupt_enable; 71 current_mask = sbus_readb(interrupt_enable);
72 switch(irq_nr) { 72 switch(irq_nr) {
73 case 1: 73 case 1:
74 new_mask = ((current_mask) & (~(SUN4C_INT_E1))); 74 new_mask = ((current_mask) & (~(SUN4C_INT_E1)));
@@ -86,7 +86,7 @@ static void sun4c_disable_irq(unsigned int irq_nr)
86 local_irq_restore(flags); 86 local_irq_restore(flags);
87 return; 87 return;
88 } 88 }
89 *interrupt_enable = new_mask; 89 sbus_writeb(new_mask, interrupt_enable);
90 local_irq_restore(flags); 90 local_irq_restore(flags);
91} 91}
92 92
@@ -97,7 +97,7 @@ static void sun4c_enable_irq(unsigned int irq_nr)
97 97
98 local_irq_save(flags); 98 local_irq_save(flags);
99 irq_nr &= (NR_IRQS - 1); 99 irq_nr &= (NR_IRQS - 1);
100 current_mask = *interrupt_enable; 100 current_mask = sbus_readb(interrupt_enable);
101 switch(irq_nr) { 101 switch(irq_nr) {
102 case 1: 102 case 1:
103 new_mask = ((current_mask) | SUN4C_INT_E1); 103 new_mask = ((current_mask) | SUN4C_INT_E1);
@@ -115,7 +115,7 @@ static void sun4c_enable_irq(unsigned int irq_nr)
115 local_irq_restore(flags); 115 local_irq_restore(flags);
116 return; 116 return;
117 } 117 }
118 *interrupt_enable = new_mask; 118 sbus_writeb(new_mask, interrupt_enable);
119 local_irq_restore(flags); 119 local_irq_restore(flags);
120} 120}
121 121
@@ -172,27 +172,22 @@ static void sun4c_nop(void) {}
172 172
173void __init sun4c_init_IRQ(void) 173void __init sun4c_init_IRQ(void)
174{ 174{
175 struct linux_prom_registers int_regs[2]; 175 struct device_node *dp;
176 int ie_node; 176 const u32 *addr;
177 struct resource phyres; 177
178 178 dp = of_find_node_by_name(NULL, "interrupt-enable");
179 ie_node = prom_searchsiblings (prom_getchild(prom_root_node), 179 if (!dp) {
180 "interrupt-enable"); 180 prom_printf("sun4c_init_IRQ: Unable to find interrupt-enable\n");
181 if(ie_node == 0) 181 prom_halt();
182 panic("Cannot find /interrupt-enable node"); 182 }
183 183
184 /* Depending on the "address" property is bad news... */ 184 addr = of_get_property(dp, "address", NULL);
185 interrupt_enable = NULL; 185 if (!addr) {
186 if (prom_getproperty(ie_node, "reg", (char *) int_regs, 186 prom_printf("sun4c_init_IRQ: No address property\n");
187 sizeof(int_regs)) != -1) { 187 prom_halt();
188 memset(&phyres, 0, sizeof(struct resource));
189 phyres.flags = int_regs[0].which_io;
190 phyres.start = int_regs[0].phys_addr;
191 interrupt_enable = (char *) of_ioremap(&phyres, 0,
192 int_regs[0].reg_size, "sun4c_intr");
193 } 188 }
194 if (!interrupt_enable) 189
195 panic("Cannot map interrupt_enable"); 190 interrupt_enable = (void __iomem *) (unsigned long) addr[0];
196 191
197 BTFIXUPSET_CALL(enable_irq, sun4c_enable_irq, BTFIXUPCALL_NORM); 192 BTFIXUPSET_CALL(enable_irq, sun4c_enable_irq, BTFIXUPCALL_NORM);
198 BTFIXUPSET_CALL(disable_irq, sun4c_disable_irq, BTFIXUPCALL_NORM); 193 BTFIXUPSET_CALL(disable_irq, sun4c_disable_irq, BTFIXUPCALL_NORM);
@@ -206,6 +201,6 @@ void __init sun4c_init_IRQ(void)
206 BTFIXUPSET_CALL(clear_cpu_int, sun4c_nop, BTFIXUPCALL_NOP); 201 BTFIXUPSET_CALL(clear_cpu_int, sun4c_nop, BTFIXUPCALL_NOP);
207 BTFIXUPSET_CALL(set_irq_udt, sun4c_nop, BTFIXUPCALL_NOP); 202 BTFIXUPSET_CALL(set_irq_udt, sun4c_nop, BTFIXUPCALL_NOP);
208#endif 203#endif
209 *interrupt_enable = (SUN4C_INT_ENABLE); 204 sbus_writeb(SUN4C_INT_ENABLE, interrupt_enable);
210 /* Cannot enable interrupts until OBP ticker is disabled. */ 205 /* Cannot enable interrupts until OBP ticker is disabled. */
211} 206}