| 1 | --- a/arch/mips/pci/pci-bcm47xx.c |
| 2 | +++ b/arch/mips/pci/pci-bcm47xx.c |
| 3 | @@ -25,6 +25,7 @@ |
| 4 | #include <linux/types.h> |
| 5 | #include <linux/pci.h> |
| 6 | #include <linux/ssb/ssb.h> |
| 7 | +#include <linux/bcma/bcma.h> |
| 8 | #include <bcm47xx.h> |
| 9 | |
| 10 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
| 11 | @@ -32,15 +33,12 @@ int __init pcibios_map_irq(const struct |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | -int pcibios_plat_dev_init(struct pci_dev *dev) |
| 16 | -{ |
| 17 | #ifdef CONFIG_BCM47XX_SSB |
| 18 | +static int bcm47xx_pcibios_plat_dev_init_ssb(struct pci_dev *dev) |
| 19 | +{ |
| 20 | int res; |
| 21 | u8 slot, pin; |
| 22 | |
| 23 | - if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB) |
| 24 | - return 0; |
| 25 | - |
| 26 | res = ssb_pcibios_plat_dev_init(dev); |
| 27 | if (res < 0) { |
| 28 | printk(KERN_ALERT "PCI: Failed to init device %s\n", |
| 29 | @@ -60,6 +58,47 @@ int pcibios_plat_dev_init(struct pci_dev |
| 30 | } |
| 31 | |
| 32 | dev->irq = res; |
| 33 | + return 0; |
| 34 | +} |
| 35 | #endif |
| 36 | + |
| 37 | +#ifdef CONFIG_BCM47XX_BCMA |
| 38 | +static int bcm47xx_pcibios_plat_dev_init_bcma(struct pci_dev *dev) |
| 39 | +{ |
| 40 | + int res; |
| 41 | + |
| 42 | + res = bcma_core_pci_plat_dev_init(dev); |
| 43 | + if (res < 0) { |
| 44 | + printk(KERN_ALERT "PCI: Failed to init device %s\n", |
| 45 | + pci_name(dev)); |
| 46 | + return res; |
| 47 | + } |
| 48 | + |
| 49 | + res = bcma_core_pci_pcibios_map_irq(dev); |
| 50 | + |
| 51 | + /* IRQ-0 and IRQ-1 are software interrupts. */ |
| 52 | + if (res < 2) { |
| 53 | + printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n", |
| 54 | + pci_name(dev)); |
| 55 | + return res; |
| 56 | + } |
| 57 | + |
| 58 | + dev->irq = res; |
| 59 | return 0; |
| 60 | } |
| 61 | +#endif |
| 62 | + |
| 63 | +int pcibios_plat_dev_init(struct pci_dev *dev) |
| 64 | +{ |
| 65 | +#ifdef CONFIG_BCM47XX_SSB |
| 66 | + if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_SSB) |
| 67 | + return bcm47xx_pcibios_plat_dev_init_ssb(dev); |
| 68 | + else |
| 69 | +#endif |
| 70 | +#ifdef CONFIG_BCM47XX_BCMA |
| 71 | + if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) |
| 72 | + return bcm47xx_pcibios_plat_dev_init_bcma(dev); |
| 73 | + else |
| 74 | +#endif |
| 75 | + return 0; |
| 76 | +} |
| 77 | |