Index: linux-irq-work/arch/powerpc/platforms/powermac/pci.c =================================================================== --- linux-irq-work.orig/arch/powerpc/platforms/powermac/pci.c 2006-07-01 13:51:11.000000000 +1000 +++ linux-irq-work/arch/powerpc/platforms/powermac/pci.c 2006-07-01 15:26:17.000000000 +1000 @@ -958,30 +958,12 @@ return 0; } -static void __init pcibios_fixup_OF_interrupts(void) +void __init pmac_pcibios_fixup(void) { struct pci_dev* dev = NULL; - /* - * Open Firmware often doesn't initialize the - * PCI_INTERRUPT_LINE config register properly, so we - * should find the device node and apply the interrupt - * obtained from the OF device-tree - */ - for_each_pci_dev(dev) { - struct device_node *node; - node = pci_device_to_OF_node(dev); - /* this is the node, see if it has interrupts */ - if (node && node->n_intrs > 0) - dev->irq = node->intrs[0].line; - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - } -} - -void __init pmac_pcibios_fixup(void) -{ - /* Fixup interrupts according to OF tree */ - pcibios_fixup_OF_interrupts(); + for_each_pci_dev(dev) + pci_read_irq_line(dev); } #ifdef CONFIG_PPC64 Index: linux-irq-work/arch/powerpc/platforms/powermac/pic.c =================================================================== --- linux-irq-work.orig/arch/powerpc/platforms/powermac/pic.c 2006-07-01 15:25:26.000000000 +1000 +++ linux-irq-work/arch/powerpc/platforms/powermac/pic.c 2006-07-01 15:26:17.000000000 +1000 @@ -530,16 +530,11 @@ struct pt_regs *regs) { struct mpic *mpic = desc->handler_data; - unsigned int max = 100; - while(max--) { - int cascade_irq = mpic_get_one_irq(mpic, regs); - if (max == 99) - desc->chip->eoi(irq); - if (irq < 0) - break; + unsigned int cascade_irq = mpic_get_one_irq(mpic, regs); + if (cascade_irq != NO_IRQ) generic_handle_irq(cascade_irq, regs); - }; + desc->chip->eoi(irq); } static void __init pmac_pic_setup_mpic_nmi(struct mpic *mpic) @@ -561,9 +556,6 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np, int master) { - unsigned char senses[128]; - int offset = master ? 0 : 128; - int count = master ? 128 : 124; const char *name = master ? " MPIC 1 " : " MPIC 2 "; struct resource r; struct mpic *mpic; @@ -576,8 +568,6 @@ pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0); - prom_get_irq_senses(senses, offset, offset + count); - flags |= MPIC_WANTS_RESET; if (get_property(np, "big-endian", NULL)) flags |= MPIC_BIG_ENDIAN; @@ -588,8 +578,7 @@ if (master && (flags & MPIC_BIG_ENDIAN)) flags |= MPIC_BROKEN_U3; - mpic = mpic_alloc(r.start, flags, 0, offset, count, master ? 252 : 0, - senses, count, name); + mpic = mpic_alloc(np, r.start, flags, 0, 0, name); if (mpic == NULL) return NULL; @@ -602,6 +591,7 @@ { struct mpic *mpic1, *mpic2; struct device_node *np, *master = NULL, *slave = NULL; + unsigned int cascade; /* We can have up to 2 MPICs cascaded */ for (np = NULL; (np = of_find_node_by_type(np, "open-pic")) @@ -638,17 +628,24 @@ of_node_put(master); /* No slave, let's go out */ - if (slave == NULL || slave->n_intrs < 1) + if (slave == NULL) return 0; + /* Get/Map slave interrupt */ + cascade = irq_of_parse_and_map(slave, 0); + if (cascade == NO_IRQ) { + printk(KERN_ERR "Failed to map cascade IRQ\n"); + return 0; + } + mpic2 = pmac_setup_one_mpic(slave, 0); if (mpic2 == NULL) { printk(KERN_ERR "Failed to setup slave MPIC\n"); of_node_put(slave); return 0; } - set_irq_data(slave->intrs[0].line, mpic2); - set_irq_chained_handler(slave->intrs[0].line, pmac_u3_cascade); + set_irq_data(cascade, mpic2); + set_irq_chained_handler(cascade, pmac_u3_cascade); of_node_put(slave); return 0; Index: linux-irq-work/arch/powerpc/platforms/powermac/setup.c =================================================================== --- linux-irq-work.orig/arch/powerpc/platforms/powermac/setup.c 2006-07-01 13:51:11.000000000 +1000 +++ linux-irq-work/arch/powerpc/platforms/powermac/setup.c 2006-07-01 15:26:17.000000000 +1000 @@ -613,9 +613,6 @@ udbg_adb_init(!!strstr(cmd_line, "btextdbg")); #ifdef CONFIG_PPC64 - /* Setup interrupt mapping options */ - ppc64_interrupt_controller = IC_OPEN_PIC; - iommu_init_early_dart(); #endif } Index: linux-irq-work/arch/powerpc/platforms/powermac/low_i2c.c =================================================================== --- linux-irq-work.orig/arch/powerpc/platforms/powermac/low_i2c.c 2006-07-01 13:51:11.000000000 +1000 +++ linux-irq-work/arch/powerpc/platforms/powermac/low_i2c.c 2006-07-01 15:26:17.000000000 +1000 @@ -522,10 +522,11 @@ host->speed = KW_I2C_MODE_25KHZ; break; } - if (np->n_intrs > 0) - host->irq = np->intrs[0].line; - else - host->irq = NO_IRQ; + host->irq = irq_of_parse_and_map(np, 0); + if (host->irq == NO_IRQ) + printk(KERN_WARNING + "low_i2c: Failed to map interrupt for %s\n", + np->full_name); host->base = ioremap((*addrp), 0x1000); if (host->base == NULL) { Index: linux-irq-work/arch/powerpc/platforms/powermac/pfunc_base.c =================================================================== --- linux-irq-work.orig/arch/powerpc/platforms/powermac/pfunc_base.c 2006-07-01 13:51:11.000000000 +1000 +++ linux-irq-work/arch/powerpc/platforms/powermac/pfunc_base.c 2006-07-01 15:26:17.000000000 +1000 @@ -24,19 +24,18 @@ static int macio_do_gpio_irq_enable(struct pmf_function *func) { - if (func->node->n_intrs < 1) + unsigned int irq = irq_of_parse_and_map(func->node, 0); + if (irq == NO_IRQ) return -EINVAL; - - return request_irq(func->node->intrs[0].line, macio_gpio_irq, 0, - func->node->name, func); + return request_irq(irq, macio_gpio_irq, 0, func->node->name, func); } static int macio_do_gpio_irq_disable(struct pmf_function *func) { - if (func->node->n_intrs < 1) + unsigned int irq = irq_of_parse_and_map(func->node, 0); + if (irq == NO_IRQ) return -EINVAL; - - free_irq(func->node->intrs[0].line, func); + free_irq(irq, func); return 0; } Index: linux-irq-work/drivers/macintosh/macio_asic.c =================================================================== --- linux-irq-work.orig/drivers/macintosh/macio_asic.c 2006-07-01 13:51:20.000000000 +1000 +++ linux-irq-work/drivers/macintosh/macio_asic.c 2006-07-01 15:26:17.000000000 +1000 @@ -327,28 +327,24 @@ static void macio_setup_interrupts(struct macio_dev *dev) { struct device_node *np = dev->ofdev.node; - int i,j; + unsigned int irq; + int i = 0, j = 0; - /* For now, we use pre-parsed entries in the device-tree for - * interrupt routing and addresses, but we should change that - * to dynamically parsed entries and so get rid of most of the - * clutter in struct device_node - */ - for (i = j = 0; i < np->n_intrs; i++) { + for (;;) { struct resource *res = &dev->interrupt[j]; if (j >= MACIO_DEV_COUNT_IRQS) break; - res->start = np->intrs[i].line; - res->flags = IORESOURCE_IO; - if (np->intrs[j].sense) - res->flags |= IORESOURCE_IRQ_LOWLEVEL; - else - res->flags |= IORESOURCE_IRQ_HIGHEDGE; + irq = irq_of_parse_and_map(np, i++); + if (irq == NO_IRQ) + break; + res->start = irq; + res->flags = IORESOURCE_IRQ; res->name = dev->ofdev.dev.bus_id; - if (macio_resource_quirks(np, res, i)) + if (macio_resource_quirks(np, res, i - 1)) { memset(res, 0, sizeof(struct resource)); - else + continue; + } else j++; } dev->n_interrupts = j; Index: linux-irq-work/drivers/macintosh/smu.c =================================================================== --- linux-irq-work.orig/drivers/macintosh/smu.c 2006-07-01 13:51:20.000000000 +1000 +++ linux-irq-work/drivers/macintosh/smu.c 2006-07-01 15:26:17.000000000 +1000 @@ -497,8 +497,7 @@ smu->doorbell = *data; if (smu->doorbell < 0x50) smu->doorbell += 0x50; - if (np->n_intrs > 0) - smu->db_irq = np->intrs[0].line; + smu->db_irq = irq_of_parse_and_map(np, 0); of_node_put(np); @@ -515,8 +514,7 @@ smu->msg = *data; if (smu->msg < 0x50) smu->msg += 0x50; - if (np->n_intrs > 0) - smu->msg_irq = np->intrs[0].line; + smu->msg_irq = irq_of_parse_and_map(np, 0); of_node_put(np); } while(0); Index: linux-irq-work/drivers/macintosh/via-pmu.c =================================================================== --- linux-irq-work.orig/drivers/macintosh/via-pmu.c 2006-07-01 13:51:20.000000000 +1000 +++ linux-irq-work/drivers/macintosh/via-pmu.c 2006-07-01 15:26:17.000000000 +1000 @@ -151,7 +151,7 @@ static int pmu_has_adb; static struct device_node *gpio_node; static unsigned char __iomem *gpio_reg = NULL; -static int gpio_irq = -1; +static int gpio_irq = NO_IRQ; static int gpio_irq_enabled = -1; static volatile int pmu_suspended = 0; static spinlock_t pmu_lock; @@ -403,22 +403,21 @@ */ static int __init via_pmu_start(void) { + unsigned int irq; + if (vias == NULL) return -ENODEV; batt_req.complete = 1; -#ifndef CONFIG_PPC_MERGE - if (pmu_kind == PMU_KEYLARGO_BASED) - openpic_set_irq_priority(vias->intrs[0].line, - OPENPIC_PRIORITY_DEFAULT + 1); -#endif - - if (request_irq(vias->intrs[0].line, via_pmu_interrupt, 0, "VIA-PMU", - (void *)0)) { - printk(KERN_ERR "VIA-PMU: can't get irq %d\n", - vias->intrs[0].line); - return -EAGAIN; + irq = irq_of_parse_and_map(vias, 0); + if (irq == NO_IRQ) { + printk(KERN_ERR "via-pmu: can't map interruptn"); + return -ENODEV; + } + if (request_irq(irq, via_pmu_interrupt, 0, "VIA-PMU", (void *)0)) { + printk(KERN_ERR "via-pmu: can't request irq %d\n", irq); + return -ENODEV; } if (pmu_kind == PMU_KEYLARGO_BASED) { @@ -426,10 +425,10 @@ if (gpio_node == NULL) gpio_node = of_find_node_by_name(NULL, "pmu-interrupt"); - if (gpio_node && gpio_node->n_intrs > 0) - gpio_irq = gpio_node->intrs[0].line; + if (gpio_node) + gpio_irq = irq_of_parse_and_map(gpio_node, 0); - if (gpio_irq != -1) { + if (gpio_irq != NO_IRQ) { if (request_irq(gpio_irq, gpio1_interrupt, 0, "GPIO1 ADB", (void *)0)) printk(KERN_ERR "pmu: can't get irq %d" Index: linux-irq-work/sound/ppc/pmac.c =================================================================== --- linux-irq-work.orig/sound/ppc/pmac.c 2006-07-01 13:51:30.000000000 +1000 +++ linux-irq-work/sound/ppc/pmac.c 2006-07-01 15:26:17.000000000 +1000 @@ -1120,6 +1120,7 @@ struct snd_pmac *chip; struct device_node *np; int i, err; + unsigned int irq; unsigned long ctrl_addr, txdma_addr, rxdma_addr; static struct snd_device_ops ops = { .dev_free = snd_pmac_dev_free, @@ -1153,10 +1154,6 @@ if (chip->is_k2) { static char *rnames[] = { "Sound Control", "Sound DMA" }; - if (np->n_intrs < 3) { - err = -ENODEV; - goto __error; - } for (i = 0; i < 2; i ++) { if (of_address_to_resource(np->parent, i, &chip->rsrc[i])) { @@ -1185,10 +1182,6 @@ } else { static char *rnames[] = { "Sound Control", "Sound Tx DMA", "Sound Rx DMA" }; - if (np->n_intrs < 3) { - err = -ENODEV; - goto __error; - } for (i = 0; i < 3; i ++) { if (of_address_to_resource(np, i, &chip->rsrc[i])) { @@ -1220,28 +1213,30 @@ chip->playback.dma = ioremap(txdma_addr, 0x100); chip->capture.dma = ioremap(rxdma_addr, 0x100); if (chip->model <= PMAC_BURGUNDY) { - if (request_irq(np->intrs[0].line, snd_pmac_ctrl_intr, 0, + irq = irq_of_parse_and_map(np, 0); + if (request_irq(irq, snd_pmac_ctrl_intr, 0, "PMac", (void*)chip)) { - snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", np->intrs[0].line); + snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", + irq); err = -EBUSY; goto __error; } - chip->irq = np->intrs[0].line; + chip->irq = irq; } - if (request_irq(np->intrs[1].line, snd_pmac_tx_intr, 0, - "PMac Output", (void*)chip)) { - snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", np->intrs[1].line); + irq = irq_of_parse_and_map(np, 1); + if (request_irq(irq, snd_pmac_tx_intr, 0, "PMac Output", (void*)chip)){ + snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq); err = -EBUSY; goto __error; } - chip->tx_irq = np->intrs[1].line; - if (request_irq(np->intrs[2].line, snd_pmac_rx_intr, 0, - "PMac Input", (void*)chip)) { - snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", np->intrs[2].line); + chip->tx_irq = irq; + irq = irq_of_parse_and_map(np, 2); + if (request_irq(irq, snd_pmac_rx_intr, 0, "PMac Input", (void*)chip)) { + snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq); err = -EBUSY; goto __error; } - chip->rx_irq = np->intrs[2].line; + chip->rx_irq = irq; snd_pmac_sound_feature(chip, 1); Index: linux-irq-work/sound/ppc/tumbler.c =================================================================== --- linux-irq-work.orig/sound/ppc/tumbler.c 2006-06-23 13:22:17.000000000 +1000 +++ linux-irq-work/sound/ppc/tumbler.c 2006-07-01 15:26:17.000000000 +1000 @@ -1121,7 +1121,7 @@ DBG("(I) GPIO device %s found, offset: %x, active state: %d !\n", device, gp->addr, gp->active_state); - return (node->n_intrs > 0) ? node->intrs[0].line : 0; + return irq_of_parse_and_map(node, 0); } /* reset audio */ @@ -1264,16 +1264,16 @@ &mix->line_mute, 1); irq = tumbler_find_device("headphone-detect", NULL, &mix->hp_detect, 0); - if (irq < 0) + if (irq <= NO_IRQ) irq = tumbler_find_device("headphone-detect", NULL, &mix->hp_detect, 1); - if (irq < 0) + if (irq <= NO_IRQ) irq = tumbler_find_device("keywest-gpio15", NULL, &mix->hp_detect, 1); mix->headphone_irq = irq; irq = tumbler_find_device("line-output-detect", NULL, &mix->line_detect, 0); - if (irq < 0) + if (irq <= NO_IRQ) irq = tumbler_find_device("line-output-detect", NULL, &mix->line_detect, 1); mix->lineout_irq = irq;