diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-01-30 18:03:35 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-02-06 14:53:04 -0500 |
commit | 49dc9577155576b10ff79f0c1486c816b01f58bf (patch) | |
tree | c193e6110c54234ab5ed3d816cc2dc15df165f37 /arch | |
parent | d1a7a8e1d367e34e5adce91f48cae07dc08d9e6c (diff) |
bcma: add PCIe host controller
Some SoCs have a PCIe host controller to make it possible to attach
some other devices to it, like an other Wifi card.
This code was tested with an Netgear WNDR3400 (bcm4716 based), but
should work with all bcma based SoCs.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/pci/pci-bcm47xx.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c index 400535a955d0..c682468010c5 100644 --- a/arch/mips/pci/pci-bcm47xx.c +++ b/arch/mips/pci/pci-bcm47xx.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/ssb/ssb.h> | 27 | #include <linux/ssb/ssb.h> |
28 | #include <linux/bcma/bcma.h> | ||
28 | #include <bcm47xx.h> | 29 | #include <bcm47xx.h> |
29 | 30 | ||
30 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 31 | int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
@@ -32,15 +33,12 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
32 | return 0; | 33 | return 0; |
33 | } | 34 | } |
34 | 35 | ||
35 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
36 | { | ||
37 | #ifdef CONFIG_BCM47XX_SSB | 36 | #ifdef CONFIG_BCM47XX_SSB |
37 | static int bcm47xx_pcibios_plat_dev_init_ssb(struct pci_dev *dev) | ||
38 | { | ||
38 | int res; | 39 | int res; |
39 | u8 slot, pin; | 40 | u8 slot, pin; |
40 | 41 | ||
41 | if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB) | ||
42 | return 0; | ||
43 | |||
44 | res = ssb_pcibios_plat_dev_init(dev); | 42 | res = ssb_pcibios_plat_dev_init(dev); |
45 | if (res < 0) { | 43 | if (res < 0) { |
46 | printk(KERN_ALERT "PCI: Failed to init device %s\n", | 44 | printk(KERN_ALERT "PCI: Failed to init device %s\n", |
@@ -60,6 +58,47 @@ int pcibios_plat_dev_init(struct pci_dev *dev) | |||
60 | } | 58 | } |
61 | 59 | ||
62 | dev->irq = res; | 60 | dev->irq = res; |
61 | return 0; | ||
62 | } | ||
63 | #endif | 63 | #endif |
64 | |||
65 | #ifdef CONFIG_BCM47XX_BCMA | ||
66 | static int bcm47xx_pcibios_plat_dev_init_bcma(struct pci_dev *dev) | ||
67 | { | ||
68 | int res; | ||
69 | |||
70 | res = bcma_core_pci_plat_dev_init(dev); | ||
71 | if (res < 0) { | ||
72 | printk(KERN_ALERT "PCI: Failed to init device %s\n", | ||
73 | pci_name(dev)); | ||
74 | return res; | ||
75 | } | ||
76 | |||
77 | res = bcma_core_pci_pcibios_map_irq(dev); | ||
78 | |||
79 | /* IRQ-0 and IRQ-1 are software interrupts. */ | ||
80 | if (res < 2) { | ||
81 | printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n", | ||
82 | pci_name(dev)); | ||
83 | return res; | ||
84 | } | ||
85 | |||
86 | dev->irq = res; | ||
64 | return 0; | 87 | return 0; |
65 | } | 88 | } |
89 | #endif | ||
90 | |||
91 | int pcibios_plat_dev_init(struct pci_dev *dev) | ||
92 | { | ||
93 | #ifdef CONFIG_BCM47XX_SSB | ||
94 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_SSB) | ||
95 | return bcm47xx_pcibios_plat_dev_init_ssb(dev); | ||
96 | else | ||
97 | #endif | ||
98 | #ifdef CONFIG_BCM47XX_BCMA | ||
99 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) | ||
100 | return bcm47xx_pcibios_plat_dev_init_bcma(dev); | ||
101 | else | ||
102 | #endif | ||
103 | return 0; | ||
104 | } | ||