aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authoroftedal <oftedal@gmail.com>2011-06-01 07:11:41 -0400
committerDavid S. Miller <davem@davemloft.net>2011-06-07 19:06:33 -0400
commit9eeb08986f41c0740306f6f56cf04e619e2fe525 (patch)
tree37b20e6c13d839f86aa6294bcd888ea4a8667b3e /arch/sparc
parentea160584574e345495e75ee4a7d3a7dbcad9e16c (diff)
Add support for allocating irqs for bootbus devices
Some devices that can generate interrupts are connected directly to the CPU through the bootbus on sun4d. This patch allows IRQs to be allocated for such devices. The information used for allocating interrupts for sbus devices are present at the corresponding SBI node. For bootbus devices this information is present in the bootbus node. Signed-off-by: Kjetil Oftedal <oftedal@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/kernel/sun4d_irq.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index eaec8a90fb9f..1d13c5bda0b1 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -334,7 +334,8 @@ unsigned int sun4d_build_device_irq(struct platform_device *op,
334 unsigned int real_irq) 334 unsigned int real_irq)
335{ 335{
336 struct device_node *dp = op->dev.of_node; 336 struct device_node *dp = op->dev.of_node;
337 struct device_node *io_unit, *sbi = dp->parent; 337 struct device_node *board_parent, *bus = dp->parent;
338 char *bus_connection;
338 const struct linux_prom_registers *regs; 339 const struct linux_prom_registers *regs;
339 unsigned int pil; 340 unsigned int pil;
340 unsigned int irq; 341 unsigned int irq;
@@ -342,13 +343,20 @@ unsigned int sun4d_build_device_irq(struct platform_device *op,
342 int sbusl; 343 int sbusl;
343 344
344 irq = real_irq; 345 irq = real_irq;
345 while (sbi) { 346 while (bus) {
346 if (!strcmp(sbi->name, "sbi")) 347 if (!strcmp(bus->name, "sbi")) {
348 bus_connection = "io-unit";
347 break; 349 break;
350 }
351
352 if (!strcmp(bus->name, "bootbus")) {
353 bus_connection = "cpu-unit";
354 break;
355 }
348 356
349 sbi = sbi->parent; 357 bus = bus->parent;
350 } 358 }
351 if (!sbi) 359 if (!bus)
352 goto err_out; 360 goto err_out;
353 361
354 regs = of_get_property(dp, "reg", NULL); 362 regs = of_get_property(dp, "reg", NULL);
@@ -358,17 +366,19 @@ unsigned int sun4d_build_device_irq(struct platform_device *op,
358 slot = regs->which_io; 366 slot = regs->which_io;
359 367
360 /* 368 /*
361 * If SBI's parent is not io-unit or the io-unit lacks 369 * If Bus nodes parent is not io-unit/cpu-unit or the io-unit/cpu-unit
362 * a "board#" property, something is very wrong. 370 * lacks a "board#" property, something is very wrong.
363 */ 371 */
364 if (!sbi->parent || strcmp(sbi->parent->name, "io-unit")) { 372 if (!bus->parent || strcmp(bus->parent->name, bus_connection)) {
365 printk("%s: Error, parent is not io-unit.\n", sbi->full_name); 373 printk(KERN_ERR "%s: Error, parent is not %s.\n",
374 bus->full_name, bus_connection);
366 goto err_out; 375 goto err_out;
367 } 376 }
368 io_unit = sbi->parent; 377 board_parent = bus->parent;
369 board = of_getintprop_default(io_unit, "board#", -1); 378 board = of_getintprop_default(board_parent, "board#", -1);
370 if (board == -1) { 379 if (board == -1) {
371 printk("%s: Error, lacks board# property.\n", io_unit->full_name); 380 printk(KERN_ERR "%s: Error, lacks board# property.\n",
381 board_parent->full_name);
372 goto err_out; 382 goto err_out;
373 } 383 }
374 384