X-Git-Url: http://git.agner.ch/gitweb/?p=linux-drm-fsl-dcu.git;a=blobdiff_plain;f=arch%2Fpowerpc%2Fplatforms%2Fembedded6xx%2Fmpc7448_hpc2.c;h=3fcc85f60fbf2d78b7ee8ba29c8733026e951fcd;hp=e4f2b9df5e170027cf1ac85e5cbb65c21a59351d;hb=b361735043e3001eadb1d40916fd1a4fca1a9363;hpb=fecf3404f4aba6d0edeba31eeb018cbb6326dff2 diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c index e4f2b9df5e17..3fcc85f60fbf 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c @@ -18,7 +18,6 @@ * 2 of the License, or (at your option) any later version. */ -#include #include #include #include @@ -61,9 +60,8 @@ pci_dram_offset = MPC7448_HPC2_PCI_MEM_OFFSET; extern int tsi108_setup_pci(struct device_node *dev); extern void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val); -extern void tsi108_pci_int_init(void); -extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc, - struct pt_regs *regs); +extern void tsi108_pci_int_init(struct device_node *node); +extern void tsi108_irq_cascade(unsigned int irq, struct irq_desc *desc); int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) { @@ -73,65 +71,6 @@ int mpc7448_hpc2_exclude_device(u_char bus, u_char devfn) return PCIBIOS_SUCCESSFUL; } -/* - * find pci slot by devfn in interrupt map of OF tree - */ -u8 find_slot_by_devfn(unsigned int *interrupt_map, unsigned int devfn) -{ - int i; - unsigned int tmp; - for (i = 0; i < 4; i++){ - tmp = interrupt_map[i*4*7]; - if ((tmp >> 11) == (devfn >> 3)) - return i; - } - return i; -} - -/* - * Scans the interrupt map for pci device - */ -void mpc7448_hpc2_fixup_irq(struct pci_dev *dev) -{ - struct pci_controller *hose; - struct device_node *node; - const unsigned int *interrupt; - int busnr; - int len; - u8 slot; - u8 pin; - - /* Lookup the hose */ - busnr = dev->bus->number; - hose = pci_bus_to_hose(busnr); - if (!hose) - printk(KERN_ERR "No pci hose found\n"); - - /* Check it has an OF node associated */ - node = (struct device_node *) hose->arch_data; - if (!node) - printk(KERN_ERR "No pci node found\n"); - - interrupt = get_property(node, "interrupt-map", &len); - slot = find_slot_by_devfn(interrupt, dev->devfn); - pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); - if (pin == 0 || pin > 4) - pin = 1; - pin--; - dev->irq = interrupt[slot*4*7 + pin*7 + 5]; - DBG("TSI_PCI: dev->irq = 0x%x\n", dev->irq); -} -/* temporary pci irq map fixup*/ - -void __init mpc7448_hpc2_pcibios_fixup(void) -{ - struct pci_dev *dev = NULL; - for_each_pci_dev(dev) { - mpc7448_hpc2_fixup_irq(dev); - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - } -} - static void __init mpc7448_hpc2_setup_arch(void) { struct device_node *cpu; @@ -194,14 +133,17 @@ static void __init mpc7448_hpc2_init_IRQ(void) { struct mpic *mpic; phys_addr_t mpic_paddr = 0; + struct device_node *tsi_pic; +#ifdef CONFIG_PCI unsigned int cascade_pci_irq; struct device_node *tsi_pci; - struct device_node *tsi_pic; + struct device_node *cascade_node = NULL; +#endif tsi_pic = of_find_node_by_type(NULL, "open-pic"); if (tsi_pic) { unsigned int size; - void *prop = get_property(tsi_pic, "reg", &size); + const void *prop = get_property(tsi_pic, "reg", &size); mpic_paddr = of_translate_address(tsi_pic, prop); } @@ -210,31 +152,41 @@ static void __init mpc7448_hpc2_init_IRQ(void) return; } - DBG("%s: tsi108pic phys_addr = 0x%x\n", __FUNCTION__, + DBG("%s: tsi108 pic phys_addr = 0x%x\n", __FUNCTION__, (u32) mpic_paddr); mpic = mpic_alloc(tsi_pic, mpic_paddr, MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET | MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108, - 0, /* num_sources used */ - 0, /* num_sources used */ + 24, + NR_IRQS-4, /* num_sources used */ "Tsi108_PIC"); - BUG_ON(mpic == NULL); /* XXXX */ + BUG_ON(mpic == NULL); + + mpic_assign_isu(mpic, 0, mpic_paddr + 0x100); + mpic_init(mpic); +#ifdef CONFIG_PCI tsi_pci = of_find_node_by_type(NULL, "pci"); - if (tsi_pci == 0) { + if (tsi_pci == NULL) { printk("%s: No tsi108 pci node found !\n", __FUNCTION__); return; } + cascade_node = of_find_node_by_type(NULL, "pic-router"); + if (cascade_node == NULL) { + printk("%s: No tsi108 pci cascade node found !\n", __FUNCTION__); + return; + } cascade_pci_irq = irq_of_parse_and_map(tsi_pci, 0); + DBG("%s: tsi108 cascade_pci_irq = 0x%x\n", __FUNCTION__, + (u32) cascade_pci_irq); + tsi108_pci_int_init(cascade_node); set_irq_data(cascade_pci_irq, mpic); set_irq_chained_handler(cascade_pci_irq, tsi108_irq_cascade); - - tsi108_pci_int_init(); - +#endif /* Configure MPIC outputs to CPU0 */ tsi108_write_reg(TSI108_MPIC_OFFSET + 0x30c, 0); of_node_put(tsi_pic); @@ -292,7 +244,6 @@ static int mpc7448_machine_check_exception(struct pt_regs *regs) return 1; } return 0; - } define_machine(mpc7448_hpc2){ @@ -302,7 +253,6 @@ define_machine(mpc7448_hpc2){ .init_IRQ = mpc7448_hpc2_init_IRQ, .show_cpuinfo = mpc7448_hpc2_show_cpuinfo, .get_irq = mpic_get_irq, - .pcibios_fixup = mpc7448_hpc2_pcibios_fixup, .restart = mpc7448_hpc2_restart, .calibrate_decr = generic_calibrate_decr, .machine_check_exception= mpc7448_machine_check_exception,