aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/driver_pci.c
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2012-01-30 18:03:35 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:53:04 -0500
commit49dc9577155576b10ff79f0c1486c816b01f58bf (patch)
treec193e6110c54234ab5ed3d816cc2dc15df165f37 /drivers/bcma/driver_pci.c
parentd1a7a8e1d367e34e5adce91f48cae07dc08d9e6c (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 'drivers/bcma/driver_pci.c')
-rw-r--r--drivers/bcma/driver_pci.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 155d953dba7..4d38ae179b4 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -2,7 +2,7 @@
2 * Broadcom specific AMBA 2 * Broadcom specific AMBA
3 * PCI Core 3 * PCI Core
4 * 4 *
5 * Copyright 2005, Broadcom Corporation 5 * Copyright 2005, 2011, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch> 6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de> 7 * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de>
8 * 8 *
@@ -179,47 +179,19 @@ static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
179 bcma_pcicore_serdes_workaround(pc); 179 bcma_pcicore_serdes_workaround(pc);
180} 180}
181 181
182static bool __devinit bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc)
183{
184 struct bcma_bus *bus = pc->core->bus;
185 u16 chipid_top;
186
187 chipid_top = (bus->chipinfo.id & 0xFF00);
188 if (chipid_top != 0x4700 &&
189 chipid_top != 0x5300)
190 return false;
191
192#ifdef CONFIG_SSB_DRIVER_PCICORE
193 if (bus->sprom.boardflags_lo & SSB_BFL_NOPCI)
194 return false;
195#endif /* CONFIG_SSB_DRIVER_PCICORE */
196
197#if 0
198 /* TODO: on BCMA we use address from EROM instead of magic formula */
199 u32 tmp;
200 return !mips_busprobe32(tmp, (bus->mmio +
201 (pc->core->core_index * BCMA_CORE_SIZE)));
202#endif
203
204 return true;
205}
206
207void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc) 182void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc)
208{ 183{
209 if (pc->setup_done) 184 if (pc->setup_done)
210 return; 185 return;
211 186
212 if (bcma_core_pci_is_in_hostmode(pc)) {
213#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE 187#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE
188 pc->hostmode = bcma_core_pci_is_in_hostmode(pc);
189 if (pc->hostmode)
214 bcma_core_pci_hostmode_init(pc); 190 bcma_core_pci_hostmode_init(pc);
215#else
216 pr_err("Driver compiled without support for hostmode PCI\n");
217#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ 191#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
218 } else {
219 bcma_core_pci_clientmode_init(pc);
220 }
221 192
222 pc->setup_done = true; 193 if (!pc->hostmode)
194 bcma_core_pci_clientmode_init(pc);
223} 195}
224 196
225int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, 197int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,