0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include <linux/types.h>
0026 #include <linux/pci.h>
0027 #include <linux/ssb/ssb.h>
0028 #include <linux/bcma/bcma.h>
0029 #include <bcm47xx.h>
0030
0031 int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
0032 {
0033 return 0;
0034 }
0035
0036 #ifdef CONFIG_BCM47XX_SSB
0037 static int bcm47xx_pcibios_plat_dev_init_ssb(struct pci_dev *dev)
0038 {
0039 int res;
0040 u8 slot, pin;
0041
0042 res = ssb_pcibios_plat_dev_init(dev);
0043 if (res < 0) {
0044 pci_alert(dev, "PCI: Failed to init device\n");
0045 return res;
0046 }
0047
0048 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
0049 slot = PCI_SLOT(dev->devfn);
0050 res = ssb_pcibios_map_irq(dev, slot, pin);
0051
0052
0053 if (res < 2) {
0054 pci_alert(dev, "PCI: Failed to map IRQ of device\n");
0055 return res;
0056 }
0057
0058 dev->irq = res;
0059 return 0;
0060 }
0061 #endif
0062
0063 #ifdef CONFIG_BCM47XX_BCMA
0064 static int bcm47xx_pcibios_plat_dev_init_bcma(struct pci_dev *dev)
0065 {
0066 int res;
0067
0068 res = bcma_core_pci_plat_dev_init(dev);
0069 if (res < 0) {
0070 pci_alert(dev, "PCI: Failed to init device\n");
0071 return res;
0072 }
0073
0074 res = bcma_core_pci_pcibios_map_irq(dev);
0075
0076
0077 if (res < 2) {
0078 pci_alert(dev, "PCI: Failed to map IRQ of device\n");
0079 return res;
0080 }
0081
0082 dev->irq = res;
0083 return 0;
0084 }
0085 #endif
0086
0087 int pcibios_plat_dev_init(struct pci_dev *dev)
0088 {
0089 #ifdef CONFIG_BCM47XX_SSB
0090 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_SSB)
0091 return bcm47xx_pcibios_plat_dev_init_ssb(dev);
0092 #endif
0093 #ifdef CONFIG_BCM47XX_BCMA
0094 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA)
0095 return bcm47xx_pcibios_plat_dev_init_bcma(dev);
0096 #endif
0097 return 0;
0098 }