aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-02-08 11:11:47 -0500
committerKalle Valo <kvalo@codeaurora.org>2015-03-02 09:59:45 -0500
commit4186721d02b71ae943e60bbf50d3488fd5fd6adb (patch)
tree7623f94d3baa042f5090780bb285f5be1e6ff847
parentba8b6ae6e91ed4d866f83b026138cc75a955e101 (diff)
bcma: add helpers bringing PCIe hosted bus up / down
Bringing PCIe hosted bus up requires operating on host-related core. Since we plan to support PCIe Gen 2 devices we should provide a helper picking the correct one (PCIE or PCIE2). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/bcma/bcma_private.h2
-rw-r--r--drivers/bcma/driver_pci.c20
-rw-r--r--drivers/bcma/host_pci.c28
-rw-r--r--drivers/net/wireless/b43/main.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/main.c8
-rw-r--r--include/linux/bcma/bcma.h3
-rw-r--r--include/linux/bcma/bcma_driver_pci.h2
7 files changed, 41 insertions, 26 deletions
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
index ac6c5fca906d..351f4afdad25 100644
--- a/drivers/bcma/bcma_private.h
+++ b/drivers/bcma/bcma_private.h
@@ -101,6 +101,8 @@ static inline void __exit bcma_host_soc_unregister_driver(void)
101 101
102/* driver_pci.c */ 102/* driver_pci.c */
103u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); 103u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
104void bcma_core_pci_up(struct bcma_drv_pci *pc);
105void bcma_core_pci_down(struct bcma_drv_pci *pc);
104 106
105extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc); 107extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
106 108
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 786666488a2d..cf92bfa7eae0 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -328,28 +328,12 @@ static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
328 bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG); 328 bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
329} 329}
330 330
331void bcma_core_pci_up(struct bcma_bus *bus) 331void bcma_core_pci_up(struct bcma_drv_pci *pc)
332{ 332{
333 struct bcma_drv_pci *pc;
334
335 if (bus->hosttype != BCMA_HOSTTYPE_PCI)
336 return;
337
338 pc = &bus->drv_pci[0];
339
340 bcma_core_pci_extend_L1timer(pc, true); 333 bcma_core_pci_extend_L1timer(pc, true);
341} 334}
342EXPORT_SYMBOL_GPL(bcma_core_pci_up);
343 335
344void bcma_core_pci_down(struct bcma_bus *bus) 336void bcma_core_pci_down(struct bcma_drv_pci *pc)
345{ 337{
346 struct bcma_drv_pci *pc;
347
348 if (bus->hosttype != BCMA_HOSTTYPE_PCI)
349 return;
350
351 pc = &bus->drv_pci[0];
352
353 bcma_core_pci_extend_L1timer(pc, false); 338 bcma_core_pci_extend_L1timer(pc, false);
354} 339}
355EXPORT_SYMBOL_GPL(bcma_core_pci_down);
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
index 53c6a8a58859..8dd37dc94cae 100644
--- a/drivers/bcma/host_pci.c
+++ b/drivers/bcma/host_pci.c
@@ -310,3 +310,31 @@ void __exit bcma_host_pci_exit(void)
310{ 310{
311 pci_unregister_driver(&bcma_pci_bridge_driver); 311 pci_unregister_driver(&bcma_pci_bridge_driver);
312} 312}
313
314/**************************************************
315 * Runtime ops for drivers.
316 **************************************************/
317
318/* See also pcicore_up */
319void bcma_host_pci_up(struct bcma_bus *bus)
320{
321 if (bus->hosttype != BCMA_HOSTTYPE_PCI)
322 return;
323
324 if (bus->host_is_pcie2)
325 pr_warn("Bringing up bus with PCIe Gen 2 host is unsupported yet\n");
326 else
327 bcma_core_pci_up(&bus->drv_pci[0]);
328}
329EXPORT_SYMBOL_GPL(bcma_host_pci_up);
330
331/* See also pcicore_down */
332void bcma_host_pci_down(struct bcma_bus *bus)
333{
334 if (bus->hosttype != BCMA_HOSTTYPE_PCI)
335 return;
336
337 if (!bus->host_is_pcie2)
338 bcma_core_pci_down(&bus->drv_pci[0]);
339}
340EXPORT_SYMBOL_GPL(bcma_host_pci_down);
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index ccbdb05b28cd..34065a6f7725 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4819,7 +4819,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
4819 switch (dev->dev->bus_type) { 4819 switch (dev->dev->bus_type) {
4820#ifdef CONFIG_B43_BCMA 4820#ifdef CONFIG_B43_BCMA
4821 case B43_BUS_BCMA: 4821 case B43_BUS_BCMA:
4822 bcma_core_pci_down(dev->dev->bdev->bus); 4822 bcma_host_pci_down(dev->dev->bdev->bus);
4823 break; 4823 break;
4824#endif 4824#endif
4825#ifdef CONFIG_B43_SSB 4825#ifdef CONFIG_B43_SSB
@@ -4868,7 +4868,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
4868 case B43_BUS_BCMA: 4868 case B43_BUS_BCMA:
4869 bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0], 4869 bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
4870 dev->dev->bdev, true); 4870 dev->dev->bdev, true);
4871 bcma_core_pci_up(dev->dev->bdev->bus); 4871 bcma_host_pci_up(dev->dev->bdev->bus);
4872 break; 4872 break;
4873#endif 4873#endif
4874#ifdef CONFIG_B43_SSB 4874#ifdef CONFIG_B43_SSB
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index eb8584a9c49a..bcbfc6e467e4 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4668,7 +4668,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
4668 brcms_c_coredisable(wlc_hw); 4668 brcms_c_coredisable(wlc_hw);
4669 4669
4670 /* Match driver "down" state */ 4670 /* Match driver "down" state */
4671 bcma_core_pci_down(wlc_hw->d11core->bus); 4671 bcma_host_pci_down(wlc_hw->d11core->bus);
4672 4672
4673 /* turn off pll and xtal to match driver "down" state */ 4673 /* turn off pll and xtal to match driver "down" state */
4674 brcms_b_xtal(wlc_hw, OFF); 4674 brcms_b_xtal(wlc_hw, OFF);
@@ -4969,12 +4969,12 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw)
4969 */ 4969 */
4970 if (brcms_b_radio_read_hwdisabled(wlc_hw)) { 4970 if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
4971 /* put SB PCI in down state again */ 4971 /* put SB PCI in down state again */
4972 bcma_core_pci_down(wlc_hw->d11core->bus); 4972 bcma_host_pci_down(wlc_hw->d11core->bus);
4973 brcms_b_xtal(wlc_hw, OFF); 4973 brcms_b_xtal(wlc_hw, OFF);
4974 return -ENOMEDIUM; 4974 return -ENOMEDIUM;
4975 } 4975 }
4976 4976
4977 bcma_core_pci_up(wlc_hw->d11core->bus); 4977 bcma_host_pci_up(wlc_hw->d11core->bus);
4978 4978
4979 /* reset the d11 core */ 4979 /* reset the d11 core */
4980 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS); 4980 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
@@ -5171,7 +5171,7 @@ static int brcms_b_down_finish(struct brcms_hardware *wlc_hw)
5171 5171
5172 /* turn off primary xtal and pll */ 5172 /* turn off primary xtal and pll */
5173 if (!wlc_hw->noreset) { 5173 if (!wlc_hw->noreset) {
5174 bcma_core_pci_down(wlc_hw->d11core->bus); 5174 bcma_host_pci_down(wlc_hw->d11core->bus);
5175 brcms_b_xtal(wlc_hw, OFF); 5175 brcms_b_xtal(wlc_hw, OFF);
5176 } 5176 }
5177 } 5177 }
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 994739da827f..037620b3f113 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -434,6 +434,9 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,
434 return bcma_find_core_unit(bus, coreid, 0); 434 return bcma_find_core_unit(bus, coreid, 0);
435} 435}
436 436
437extern void bcma_host_pci_up(struct bcma_bus *bus);
438extern void bcma_host_pci_down(struct bcma_bus *bus);
439
437extern bool bcma_core_is_enabled(struct bcma_device *core); 440extern bool bcma_core_is_enabled(struct bcma_device *core);
438extern void bcma_core_disable(struct bcma_device *core, u32 flags); 441extern void bcma_core_disable(struct bcma_device *core, u32 flags);
439extern int bcma_core_enable(struct bcma_device *core, u32 flags); 442extern int bcma_core_enable(struct bcma_device *core, u32 flags);
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 3f809ae372c4..23af893e9b86 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -242,8 +242,6 @@ extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
242extern void bcma_core_pci_init(struct bcma_drv_pci *pc); 242extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
243extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 243extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
244 struct bcma_device *core, bool enable); 244 struct bcma_device *core, bool enable);
245extern void bcma_core_pci_up(struct bcma_bus *bus);
246extern void bcma_core_pci_down(struct bcma_bus *bus);
247extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 245extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
248 246
249extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 247extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);