mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 06:08:08 +00:00
kernel/mac80211: backport bcma changes from 4.1
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 44595
This commit is contained in:
parent
1e4f59c670
commit
be2abf706f
318
package/kernel/mac80211/patches/085-bcma-from-4.1.patch
Normal file
318
package/kernel/mac80211/patches/085-bcma-from-4.1.patch
Normal file
@ -0,0 +1,318 @@
|
||||
--- a/drivers/bcma/bcma_private.h
|
||||
+++ b/drivers/bcma/bcma_private.h
|
||||
@@ -41,6 +41,7 @@ int __init bcma_bus_scan_early(struct bc
|
||||
struct bcma_device_id *match,
|
||||
struct bcma_device *core);
|
||||
void bcma_init_bus(struct bcma_bus *bus);
|
||||
+void bcma_unregister_cores(struct bcma_bus *bus);
|
||||
|
||||
/* sprom.c */
|
||||
int bcma_sprom_get(struct bcma_bus *bus);
|
||||
@@ -105,6 +106,11 @@ static inline void __exit bcma_host_soc_
|
||||
|
||||
/* driver_pci.c */
|
||||
u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
|
||||
+void bcma_core_pci_up(struct bcma_drv_pci *pc);
|
||||
+void bcma_core_pci_down(struct bcma_drv_pci *pc);
|
||||
+
|
||||
+/* driver_pcie2.c */
|
||||
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
|
||||
|
||||
extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
|
||||
|
||||
--- a/drivers/bcma/driver_gpio.c
|
||||
+++ b/drivers/bcma/driver_gpio.c
|
||||
@@ -76,7 +76,7 @@ static void bcma_gpio_free(struct gpio_c
|
||||
bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
|
||||
}
|
||||
|
||||
-#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||
+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
|
||||
static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
|
||||
{
|
||||
struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
|
||||
@@ -215,7 +215,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
|
||||
chip->set = bcma_gpio_set_value;
|
||||
chip->direction_input = bcma_gpio_direction_input;
|
||||
chip->direction_output = bcma_gpio_direction_output;
|
||||
-#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||
+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
|
||||
chip->to_irq = bcma_gpio_to_irq;
|
||||
#endif
|
||||
#if IS_BUILTIN(CONFIG_OF)
|
||||
--- a/drivers/bcma/driver_pci.c
|
||||
+++ b/drivers/bcma/driver_pci.c
|
||||
@@ -262,21 +262,21 @@ void bcma_core_pci_power_save(struct bcm
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
|
||||
|
||||
-int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
|
||||
+int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
|
||||
bool enable)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
u32 coremask, tmp;
|
||||
int err = 0;
|
||||
|
||||
- if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) {
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
|
||||
/* This bcma device is not on a PCI host-bus. So the IRQs are
|
||||
* not routed through the PCI core.
|
||||
* So we must not enable routing through the PCI core. */
|
||||
goto out;
|
||||
}
|
||||
|
||||
- pdev = pc->core->bus->host_pci;
|
||||
+ pdev = bus->host_pci;
|
||||
|
||||
err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
|
||||
if (err)
|
||||
@@ -308,28 +308,12 @@ static void bcma_core_pci_extend_L1timer
|
||||
bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
|
||||
}
|
||||
|
||||
-void bcma_core_pci_up(struct bcma_bus *bus)
|
||||
+void bcma_core_pci_up(struct bcma_drv_pci *pc)
|
||||
{
|
||||
- struct bcma_drv_pci *pc;
|
||||
-
|
||||
- if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
- return;
|
||||
-
|
||||
- pc = &bus->drv_pci[0];
|
||||
-
|
||||
bcma_core_pci_extend_L1timer(pc, true);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(bcma_core_pci_up);
|
||||
|
||||
-void bcma_core_pci_down(struct bcma_bus *bus)
|
||||
+void bcma_core_pci_down(struct bcma_drv_pci *pc)
|
||||
{
|
||||
- struct bcma_drv_pci *pc;
|
||||
-
|
||||
- if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
- return;
|
||||
-
|
||||
- pc = &bus->drv_pci[0];
|
||||
-
|
||||
bcma_core_pci_extend_L1timer(pc, false);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(bcma_core_pci_down);
|
||||
--- a/drivers/bcma/driver_pci_host.c
|
||||
+++ b/drivers/bcma/driver_pci_host.c
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <asm/paccess.h>
|
||||
--- a/drivers/bcma/driver_pcie2.c
|
||||
+++ b/drivers/bcma/driver_pcie2.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
+#include <linux/pci.h>
|
||||
|
||||
/**************************************************
|
||||
* R/W ops.
|
||||
@@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st
|
||||
|
||||
void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
|
||||
{
|
||||
- struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo;
|
||||
+ struct bcma_bus *bus = pcie2->core->bus;
|
||||
+ struct bcma_chipinfo *ci = &bus->chipinfo;
|
||||
u32 tmp;
|
||||
|
||||
tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
|
||||
if ((tmp & 0xe) >> 1 == 2)
|
||||
bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);
|
||||
|
||||
- /* TODO: Do we need pcie_reqsize? */
|
||||
+ switch (bus->chipinfo.id) {
|
||||
+ case BCMA_CHIP_ID_BCM4360:
|
||||
+ case BCMA_CHIP_ID_BCM4352:
|
||||
+ pcie2->reqsize = 1024;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pcie2->reqsize = 128;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3)
|
||||
bcma_core_pcie2_war_delay_perst_enab(pcie2, true);
|
||||
@@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr
|
||||
pciedev_crwlpciegen2_180(pcie2);
|
||||
pciedev_crwlpciegen2_182(pcie2);
|
||||
}
|
||||
+
|
||||
+/**************************************************
|
||||
+ * Runtime ops.
|
||||
+ **************************************************/
|
||||
+
|
||||
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
|
||||
+{
|
||||
+ struct bcma_bus *bus = pcie2->core->bus;
|
||||
+ struct pci_dev *dev = bus->host_pci;
|
||||
+ int err;
|
||||
+
|
||||
+ err = pcie_set_readrq(dev, pcie2->reqsize);
|
||||
+ if (err)
|
||||
+ bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err);
|
||||
+}
|
||||
--- a/drivers/bcma/host_pci.c
|
||||
+++ b/drivers/bcma/host_pci.c
|
||||
@@ -211,16 +211,26 @@ static int bcma_host_pci_probe(struct pc
|
||||
/* Initialize struct, detect chip */
|
||||
bcma_init_bus(bus);
|
||||
|
||||
+ /* Scan bus to find out generation of PCIe core */
|
||||
+ err = bcma_bus_scan(bus);
|
||||
+ if (err)
|
||||
+ goto err_pci_unmap_mmio;
|
||||
+
|
||||
+ if (bcma_find_core(bus, BCMA_CORE_PCIE2))
|
||||
+ bus->host_is_pcie2 = true;
|
||||
+
|
||||
/* Register */
|
||||
err = bcma_bus_register(bus);
|
||||
if (err)
|
||||
- goto err_pci_unmap_mmio;
|
||||
+ goto err_unregister_cores;
|
||||
|
||||
pci_set_drvdata(dev, bus);
|
||||
|
||||
out:
|
||||
return err;
|
||||
|
||||
+err_unregister_cores:
|
||||
+ bcma_unregister_cores(bus);
|
||||
err_pci_unmap_mmio:
|
||||
pci_iounmap(dev, bus->mmio);
|
||||
err_pci_release_regions:
|
||||
@@ -281,9 +291,12 @@ static const struct pci_device_id bcma_p
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */
|
||||
@@ -308,3 +321,31 @@ void __exit bcma_host_pci_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&bcma_pci_bridge_driver);
|
||||
}
|
||||
+
|
||||
+/**************************************************
|
||||
+ * Runtime ops for drivers.
|
||||
+ **************************************************/
|
||||
+
|
||||
+/* See also pcicore_up */
|
||||
+void bcma_host_pci_up(struct bcma_bus *bus)
|
||||
+{
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
+ return;
|
||||
+
|
||||
+ if (bus->host_is_pcie2)
|
||||
+ bcma_core_pcie2_up(&bus->drv_pcie2);
|
||||
+ else
|
||||
+ bcma_core_pci_up(&bus->drv_pci[0]);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(bcma_host_pci_up);
|
||||
+
|
||||
+/* See also pcicore_down */
|
||||
+void bcma_host_pci_down(struct bcma_bus *bus)
|
||||
+{
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
+ return;
|
||||
+
|
||||
+ if (!bus->host_is_pcie2)
|
||||
+ bcma_core_pci_down(&bus->drv_pci[0]);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(bcma_host_pci_down);
|
||||
--- a/drivers/bcma/main.c
|
||||
+++ b/drivers/bcma/main.c
|
||||
@@ -288,7 +288,7 @@ static int bcma_register_devices(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
+void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
{
|
||||
struct bcma_device *core, *tmp;
|
||||
|
||||
--- a/drivers/net/wireless/b43/main.c
|
||||
+++ b/drivers/net/wireless/b43/main.c
|
||||
@@ -4770,7 +4770,7 @@ static void b43_wireless_core_exit(struc
|
||||
switch (dev->dev->bus_type) {
|
||||
#ifdef CPTCFG_B43_BCMA
|
||||
case B43_BUS_BCMA:
|
||||
- bcma_core_pci_down(dev->dev->bdev->bus);
|
||||
+ bcma_host_pci_down(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CPTCFG_B43_SSB
|
||||
@@ -4817,9 +4817,9 @@ static int b43_wireless_core_init(struct
|
||||
switch (dev->dev->bus_type) {
|
||||
#ifdef CPTCFG_B43_BCMA
|
||||
case B43_BUS_BCMA:
|
||||
- bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
|
||||
+ bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
|
||||
dev->dev->bdev, true);
|
||||
- bcma_core_pci_up(dev->dev->bdev->bus);
|
||||
+ bcma_host_pci_up(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CPTCFG_B43_SSB
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
@@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c
|
||||
brcms_c_coredisable(wlc_hw);
|
||||
|
||||
/* Match driver "down" state */
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
|
||||
/* turn off pll and xtal to match driver "down" state */
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
@@ -4960,7 +4960,7 @@ static int brcms_b_up_prep(struct brcms_
|
||||
* Configure pci/pcmcia here instead of in brcms_c_attach()
|
||||
* to allow mfg hotswap: down, hotswap (chip power cycle), up.
|
||||
*/
|
||||
- bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core,
|
||||
+ bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
|
||||
true);
|
||||
|
||||
/*
|
||||
@@ -4970,12 +4970,12 @@ static int brcms_b_up_prep(struct brcms_
|
||||
*/
|
||||
if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
|
||||
/* put SB PCI in down state again */
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
- bcma_core_pci_up(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_up(wlc_hw->d11core->bus);
|
||||
|
||||
/* reset the d11 core */
|
||||
brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
|
||||
@@ -5172,7 +5172,7 @@ static int brcms_b_down_finish(struct br
|
||||
|
||||
/* turn off primary xtal and pll */
|
||||
if (!wlc_hw->noreset) {
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
}
|
||||
}
|
355
target/linux/generic/patches-3.14/027-bcma-from-4.1.patch
Normal file
355
target/linux/generic/patches-3.14/027-bcma-from-4.1.patch
Normal file
@ -0,0 +1,355 @@
|
||||
--- a/drivers/bcma/bcma_private.h
|
||||
+++ b/drivers/bcma/bcma_private.h
|
||||
@@ -26,6 +26,7 @@ bool bcma_wait_value(struct bcma_device
|
||||
int timeout);
|
||||
void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
|
||||
void bcma_init_bus(struct bcma_bus *bus);
|
||||
+void bcma_unregister_cores(struct bcma_bus *bus);
|
||||
int bcma_bus_register(struct bcma_bus *bus);
|
||||
void bcma_bus_unregister(struct bcma_bus *bus);
|
||||
int __init bcma_bus_early_register(struct bcma_bus *bus);
|
||||
@@ -101,6 +102,11 @@ static inline void __exit bcma_host_soc_
|
||||
|
||||
/* driver_pci.c */
|
||||
u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
|
||||
+void bcma_core_pci_up(struct bcma_drv_pci *pc);
|
||||
+void bcma_core_pci_down(struct bcma_drv_pci *pc);
|
||||
+
|
||||
+/* driver_pcie2.c */
|
||||
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
|
||||
|
||||
extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
|
||||
|
||||
--- a/drivers/bcma/driver_gpio.c
|
||||
+++ b/drivers/bcma/driver_gpio.c
|
||||
@@ -76,7 +76,7 @@ static void bcma_gpio_free(struct gpio_c
|
||||
bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
|
||||
}
|
||||
|
||||
-#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||
+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
|
||||
static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
|
||||
{
|
||||
struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
|
||||
@@ -215,7 +215,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
|
||||
chip->set = bcma_gpio_set_value;
|
||||
chip->direction_input = bcma_gpio_direction_input;
|
||||
chip->direction_output = bcma_gpio_direction_output;
|
||||
-#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||
+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
|
||||
chip->to_irq = bcma_gpio_to_irq;
|
||||
#endif
|
||||
#if IS_BUILTIN(CONFIG_OF)
|
||||
--- a/drivers/bcma/driver_pci.c
|
||||
+++ b/drivers/bcma/driver_pci.c
|
||||
@@ -282,21 +282,21 @@ void bcma_core_pci_power_save(struct bcm
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
|
||||
|
||||
-int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
|
||||
+int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
|
||||
bool enable)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
u32 coremask, tmp;
|
||||
int err = 0;
|
||||
|
||||
- if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) {
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
|
||||
/* This bcma device is not on a PCI host-bus. So the IRQs are
|
||||
* not routed through the PCI core.
|
||||
* So we must not enable routing through the PCI core. */
|
||||
goto out;
|
||||
}
|
||||
|
||||
- pdev = pc->core->bus->host_pci;
|
||||
+ pdev = bus->host_pci;
|
||||
|
||||
err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
|
||||
if (err)
|
||||
@@ -328,28 +328,12 @@ static void bcma_core_pci_extend_L1timer
|
||||
bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
|
||||
}
|
||||
|
||||
-void bcma_core_pci_up(struct bcma_bus *bus)
|
||||
+void bcma_core_pci_up(struct bcma_drv_pci *pc)
|
||||
{
|
||||
- struct bcma_drv_pci *pc;
|
||||
-
|
||||
- if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
- return;
|
||||
-
|
||||
- pc = &bus->drv_pci[0];
|
||||
-
|
||||
bcma_core_pci_extend_L1timer(pc, true);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(bcma_core_pci_up);
|
||||
|
||||
-void bcma_core_pci_down(struct bcma_bus *bus)
|
||||
+void bcma_core_pci_down(struct bcma_drv_pci *pc)
|
||||
{
|
||||
- struct bcma_drv_pci *pc;
|
||||
-
|
||||
- if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
- return;
|
||||
-
|
||||
- pc = &bus->drv_pci[0];
|
||||
-
|
||||
bcma_core_pci_extend_L1timer(pc, false);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(bcma_core_pci_down);
|
||||
--- a/drivers/bcma/driver_pci_host.c
|
||||
+++ b/drivers/bcma/driver_pci_host.c
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <asm/paccess.h>
|
||||
--- a/drivers/bcma/driver_pcie2.c
|
||||
+++ b/drivers/bcma/driver_pcie2.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
+#include <linux/pci.h>
|
||||
|
||||
/**************************************************
|
||||
* R/W ops.
|
||||
@@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st
|
||||
|
||||
void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
|
||||
{
|
||||
- struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo;
|
||||
+ struct bcma_bus *bus = pcie2->core->bus;
|
||||
+ struct bcma_chipinfo *ci = &bus->chipinfo;
|
||||
u32 tmp;
|
||||
|
||||
tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
|
||||
if ((tmp & 0xe) >> 1 == 2)
|
||||
bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);
|
||||
|
||||
- /* TODO: Do we need pcie_reqsize? */
|
||||
+ switch (bus->chipinfo.id) {
|
||||
+ case BCMA_CHIP_ID_BCM4360:
|
||||
+ case BCMA_CHIP_ID_BCM4352:
|
||||
+ pcie2->reqsize = 1024;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pcie2->reqsize = 128;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3)
|
||||
bcma_core_pcie2_war_delay_perst_enab(pcie2, true);
|
||||
@@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr
|
||||
pciedev_crwlpciegen2_180(pcie2);
|
||||
pciedev_crwlpciegen2_182(pcie2);
|
||||
}
|
||||
+
|
||||
+/**************************************************
|
||||
+ * Runtime ops.
|
||||
+ **************************************************/
|
||||
+
|
||||
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
|
||||
+{
|
||||
+ struct bcma_bus *bus = pcie2->core->bus;
|
||||
+ struct pci_dev *dev = bus->host_pci;
|
||||
+ int err;
|
||||
+
|
||||
+ err = pcie_set_readrq(dev, pcie2->reqsize);
|
||||
+ if (err)
|
||||
+ bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err);
|
||||
+}
|
||||
--- a/drivers/bcma/host_pci.c
|
||||
+++ b/drivers/bcma/host_pci.c
|
||||
@@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pc
|
||||
/* Initialize struct, detect chip */
|
||||
bcma_init_bus(bus);
|
||||
|
||||
+ /* Scan bus to find out generation of PCIe core */
|
||||
+ err = bcma_bus_scan(bus);
|
||||
+ if (err)
|
||||
+ goto err_pci_unmap_mmio;
|
||||
+
|
||||
+ if (bcma_find_core(bus, BCMA_CORE_PCIE2))
|
||||
+ bus->host_is_pcie2 = true;
|
||||
+
|
||||
/* Register */
|
||||
err = bcma_bus_register(bus);
|
||||
if (err)
|
||||
- goto err_pci_unmap_mmio;
|
||||
+ goto err_unregister_cores;
|
||||
|
||||
pci_set_drvdata(dev, bus);
|
||||
|
||||
out:
|
||||
return err;
|
||||
|
||||
+err_unregister_cores:
|
||||
+ bcma_unregister_cores(bus);
|
||||
err_pci_unmap_mmio:
|
||||
pci_iounmap(dev, bus->mmio);
|
||||
err_pci_release_regions:
|
||||
@@ -283,9 +293,12 @@ static const struct pci_device_id bcma_p
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */
|
||||
@@ -310,3 +323,31 @@ void __exit bcma_host_pci_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&bcma_pci_bridge_driver);
|
||||
}
|
||||
+
|
||||
+/**************************************************
|
||||
+ * Runtime ops for drivers.
|
||||
+ **************************************************/
|
||||
+
|
||||
+/* See also pcicore_up */
|
||||
+void bcma_host_pci_up(struct bcma_bus *bus)
|
||||
+{
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
+ return;
|
||||
+
|
||||
+ if (bus->host_is_pcie2)
|
||||
+ bcma_core_pcie2_up(&bus->drv_pcie2);
|
||||
+ else
|
||||
+ bcma_core_pci_up(&bus->drv_pci[0]);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(bcma_host_pci_up);
|
||||
+
|
||||
+/* See also pcicore_down */
|
||||
+void bcma_host_pci_down(struct bcma_bus *bus)
|
||||
+{
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
+ return;
|
||||
+
|
||||
+ if (!bus->host_is_pcie2)
|
||||
+ bcma_core_pci_down(&bus->drv_pci[0]);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(bcma_host_pci_down);
|
||||
--- a/drivers/bcma/main.c
|
||||
+++ b/drivers/bcma/main.c
|
||||
@@ -363,7 +363,7 @@ static int bcma_register_devices(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
+void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
{
|
||||
struct bcma_device *core, *tmp;
|
||||
|
||||
--- a/drivers/net/wireless/b43/main.c
|
||||
+++ b/drivers/net/wireless/b43/main.c
|
||||
@@ -4650,7 +4650,7 @@ static void b43_wireless_core_exit(struc
|
||||
switch (dev->dev->bus_type) {
|
||||
#ifdef CONFIG_B43_BCMA
|
||||
case B43_BUS_BCMA:
|
||||
- bcma_core_pci_down(dev->dev->bdev->bus);
|
||||
+ bcma_host_pci_down(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_B43_SSB
|
||||
@@ -4697,9 +4697,9 @@ static int b43_wireless_core_init(struct
|
||||
switch (dev->dev->bus_type) {
|
||||
#ifdef CONFIG_B43_BCMA
|
||||
case B43_BUS_BCMA:
|
||||
- bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
|
||||
+ bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
|
||||
dev->dev->bdev, true);
|
||||
- bcma_core_pci_up(dev->dev->bdev->bus);
|
||||
+ bcma_host_pci_up(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_B43_SSB
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
@@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c
|
||||
brcms_c_coredisable(wlc_hw);
|
||||
|
||||
/* Match driver "down" state */
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
|
||||
/* turn off pll and xtal to match driver "down" state */
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
@@ -5002,7 +5002,7 @@ static int brcms_b_up_prep(struct brcms_
|
||||
* Configure pci/pcmcia here instead of in brcms_c_attach()
|
||||
* to allow mfg hotswap: down, hotswap (chip power cycle), up.
|
||||
*/
|
||||
- bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core,
|
||||
+ bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
|
||||
true);
|
||||
|
||||
/*
|
||||
@@ -5012,12 +5012,12 @@ static int brcms_b_up_prep(struct brcms_
|
||||
*/
|
||||
if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
|
||||
/* put SB PCI in down state again */
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
- bcma_core_pci_up(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_up(wlc_hw->d11core->bus);
|
||||
|
||||
/* reset the d11 core */
|
||||
brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
|
||||
@@ -5214,7 +5214,7 @@ static int brcms_b_down_finish(struct br
|
||||
|
||||
/* turn off primary xtal and pll */
|
||||
if (!wlc_hw->noreset) {
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
}
|
||||
}
|
||||
--- a/include/linux/bcma/bcma.h
|
||||
+++ b/include/linux/bcma/bcma.h
|
||||
@@ -434,6 +434,9 @@ static inline struct bcma_device *bcma_f
|
||||
return bcma_find_core_unit(bus, coreid, 0);
|
||||
}
|
||||
|
||||
+extern void bcma_host_pci_up(struct bcma_bus *bus);
|
||||
+extern void bcma_host_pci_down(struct bcma_bus *bus);
|
||||
+
|
||||
extern bool bcma_core_is_enabled(struct bcma_device *core);
|
||||
extern void bcma_core_disable(struct bcma_device *core, u32 flags);
|
||||
extern int bcma_core_enable(struct bcma_device *core, u32 flags);
|
||||
--- a/include/linux/bcma/bcma_driver_pci.h
|
||||
+++ b/include/linux/bcma/bcma_driver_pci.h
|
||||
@@ -240,10 +240,8 @@ struct bcma_drv_pci {
|
||||
|
||||
extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
|
||||
extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
|
||||
-extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
|
||||
+extern int bcma_core_pci_irq_ctl(struct bcma_bus *bus,
|
||||
struct bcma_device *core, bool enable);
|
||||
-extern void bcma_core_pci_up(struct bcma_bus *bus);
|
||||
-extern void bcma_core_pci_down(struct bcma_bus *bus);
|
||||
extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
|
||||
|
||||
extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
|
||||
--- a/include/linux/bcma/bcma_driver_pcie2.h
|
||||
+++ b/include/linux/bcma/bcma_driver_pcie2.h
|
||||
@@ -143,6 +143,8 @@
|
||||
|
||||
struct bcma_drv_pcie2 {
|
||||
struct bcma_device *core;
|
||||
+
|
||||
+ u16 reqsize;
|
||||
};
|
||||
|
||||
#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
|
355
target/linux/generic/patches-3.18/027-bcma-from-4.1.patch
Normal file
355
target/linux/generic/patches-3.18/027-bcma-from-4.1.patch
Normal file
@ -0,0 +1,355 @@
|
||||
--- a/drivers/bcma/bcma_private.h
|
||||
+++ b/drivers/bcma/bcma_private.h
|
||||
@@ -26,6 +26,7 @@ bool bcma_wait_value(struct bcma_device
|
||||
int timeout);
|
||||
void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
|
||||
void bcma_init_bus(struct bcma_bus *bus);
|
||||
+void bcma_unregister_cores(struct bcma_bus *bus);
|
||||
int bcma_bus_register(struct bcma_bus *bus);
|
||||
void bcma_bus_unregister(struct bcma_bus *bus);
|
||||
int __init bcma_bus_early_register(struct bcma_bus *bus);
|
||||
@@ -101,6 +102,11 @@ static inline void __exit bcma_host_soc_
|
||||
|
||||
/* driver_pci.c */
|
||||
u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
|
||||
+void bcma_core_pci_up(struct bcma_drv_pci *pc);
|
||||
+void bcma_core_pci_down(struct bcma_drv_pci *pc);
|
||||
+
|
||||
+/* driver_pcie2.c */
|
||||
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
|
||||
|
||||
extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
|
||||
|
||||
--- a/drivers/bcma/driver_gpio.c
|
||||
+++ b/drivers/bcma/driver_gpio.c
|
||||
@@ -76,7 +76,7 @@ static void bcma_gpio_free(struct gpio_c
|
||||
bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
|
||||
}
|
||||
|
||||
-#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||
+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
|
||||
static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
|
||||
{
|
||||
struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
|
||||
@@ -215,7 +215,7 @@ int bcma_gpio_init(struct bcma_drv_cc *c
|
||||
chip->set = bcma_gpio_set_value;
|
||||
chip->direction_input = bcma_gpio_direction_input;
|
||||
chip->direction_output = bcma_gpio_direction_output;
|
||||
-#if IS_BUILTIN(CONFIG_BCM47XX)
|
||||
+#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
|
||||
chip->to_irq = bcma_gpio_to_irq;
|
||||
#endif
|
||||
#if IS_BUILTIN(CONFIG_OF)
|
||||
--- a/drivers/bcma/driver_pci.c
|
||||
+++ b/drivers/bcma/driver_pci.c
|
||||
@@ -282,21 +282,21 @@ void bcma_core_pci_power_save(struct bcm
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
|
||||
|
||||
-int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
|
||||
+int bcma_core_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
|
||||
bool enable)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
u32 coremask, tmp;
|
||||
int err = 0;
|
||||
|
||||
- if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) {
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
|
||||
/* This bcma device is not on a PCI host-bus. So the IRQs are
|
||||
* not routed through the PCI core.
|
||||
* So we must not enable routing through the PCI core. */
|
||||
goto out;
|
||||
}
|
||||
|
||||
- pdev = pc->core->bus->host_pci;
|
||||
+ pdev = bus->host_pci;
|
||||
|
||||
err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
|
||||
if (err)
|
||||
@@ -328,28 +328,12 @@ static void bcma_core_pci_extend_L1timer
|
||||
bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
|
||||
}
|
||||
|
||||
-void bcma_core_pci_up(struct bcma_bus *bus)
|
||||
+void bcma_core_pci_up(struct bcma_drv_pci *pc)
|
||||
{
|
||||
- struct bcma_drv_pci *pc;
|
||||
-
|
||||
- if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
- return;
|
||||
-
|
||||
- pc = &bus->drv_pci[0];
|
||||
-
|
||||
bcma_core_pci_extend_L1timer(pc, true);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(bcma_core_pci_up);
|
||||
|
||||
-void bcma_core_pci_down(struct bcma_bus *bus)
|
||||
+void bcma_core_pci_down(struct bcma_drv_pci *pc)
|
||||
{
|
||||
- struct bcma_drv_pci *pc;
|
||||
-
|
||||
- if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
- return;
|
||||
-
|
||||
- pc = &bus->drv_pci[0];
|
||||
-
|
||||
bcma_core_pci_extend_L1timer(pc, false);
|
||||
}
|
||||
-EXPORT_SYMBOL_GPL(bcma_core_pci_down);
|
||||
--- a/drivers/bcma/driver_pci_host.c
|
||||
+++ b/drivers/bcma/driver_pci_host.c
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/pci.h>
|
||||
+#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/bcma/bcma.h>
|
||||
#include <asm/paccess.h>
|
||||
--- a/drivers/bcma/driver_pcie2.c
|
||||
+++ b/drivers/bcma/driver_pcie2.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "bcma_private.h"
|
||||
#include <linux/bcma/bcma.h>
|
||||
+#include <linux/pci.h>
|
||||
|
||||
/**************************************************
|
||||
* R/W ops.
|
||||
@@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st
|
||||
|
||||
void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
|
||||
{
|
||||
- struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo;
|
||||
+ struct bcma_bus *bus = pcie2->core->bus;
|
||||
+ struct bcma_chipinfo *ci = &bus->chipinfo;
|
||||
u32 tmp;
|
||||
|
||||
tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
|
||||
if ((tmp & 0xe) >> 1 == 2)
|
||||
bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);
|
||||
|
||||
- /* TODO: Do we need pcie_reqsize? */
|
||||
+ switch (bus->chipinfo.id) {
|
||||
+ case BCMA_CHIP_ID_BCM4360:
|
||||
+ case BCMA_CHIP_ID_BCM4352:
|
||||
+ pcie2->reqsize = 1024;
|
||||
+ break;
|
||||
+ default:
|
||||
+ pcie2->reqsize = 128;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3)
|
||||
bcma_core_pcie2_war_delay_perst_enab(pcie2, true);
|
||||
@@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr
|
||||
pciedev_crwlpciegen2_180(pcie2);
|
||||
pciedev_crwlpciegen2_182(pcie2);
|
||||
}
|
||||
+
|
||||
+/**************************************************
|
||||
+ * Runtime ops.
|
||||
+ **************************************************/
|
||||
+
|
||||
+void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
|
||||
+{
|
||||
+ struct bcma_bus *bus = pcie2->core->bus;
|
||||
+ struct pci_dev *dev = bus->host_pci;
|
||||
+ int err;
|
||||
+
|
||||
+ err = pcie_set_readrq(dev, pcie2->reqsize);
|
||||
+ if (err)
|
||||
+ bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err);
|
||||
+}
|
||||
--- a/drivers/bcma/host_pci.c
|
||||
+++ b/drivers/bcma/host_pci.c
|
||||
@@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pc
|
||||
/* Initialize struct, detect chip */
|
||||
bcma_init_bus(bus);
|
||||
|
||||
+ /* Scan bus to find out generation of PCIe core */
|
||||
+ err = bcma_bus_scan(bus);
|
||||
+ if (err)
|
||||
+ goto err_pci_unmap_mmio;
|
||||
+
|
||||
+ if (bcma_find_core(bus, BCMA_CORE_PCIE2))
|
||||
+ bus->host_is_pcie2 = true;
|
||||
+
|
||||
/* Register */
|
||||
err = bcma_bus_register(bus);
|
||||
if (err)
|
||||
- goto err_pci_unmap_mmio;
|
||||
+ goto err_unregister_cores;
|
||||
|
||||
pci_set_drvdata(dev, bus);
|
||||
|
||||
out:
|
||||
return err;
|
||||
|
||||
+err_unregister_cores:
|
||||
+ bcma_unregister_cores(bus);
|
||||
err_pci_unmap_mmio:
|
||||
pci_iounmap(dev, bus->mmio);
|
||||
err_pci_release_regions:
|
||||
@@ -283,9 +293,12 @@ static const struct pci_device_id bcma_p
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
|
||||
+ { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */
|
||||
@@ -310,3 +323,31 @@ void __exit bcma_host_pci_exit(void)
|
||||
{
|
||||
pci_unregister_driver(&bcma_pci_bridge_driver);
|
||||
}
|
||||
+
|
||||
+/**************************************************
|
||||
+ * Runtime ops for drivers.
|
||||
+ **************************************************/
|
||||
+
|
||||
+/* See also pcicore_up */
|
||||
+void bcma_host_pci_up(struct bcma_bus *bus)
|
||||
+{
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
+ return;
|
||||
+
|
||||
+ if (bus->host_is_pcie2)
|
||||
+ bcma_core_pcie2_up(&bus->drv_pcie2);
|
||||
+ else
|
||||
+ bcma_core_pci_up(&bus->drv_pci[0]);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(bcma_host_pci_up);
|
||||
+
|
||||
+/* See also pcicore_down */
|
||||
+void bcma_host_pci_down(struct bcma_bus *bus)
|
||||
+{
|
||||
+ if (bus->hosttype != BCMA_HOSTTYPE_PCI)
|
||||
+ return;
|
||||
+
|
||||
+ if (!bus->host_is_pcie2)
|
||||
+ bcma_core_pci_down(&bus->drv_pci[0]);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(bcma_host_pci_down);
|
||||
--- a/drivers/bcma/main.c
|
||||
+++ b/drivers/bcma/main.c
|
||||
@@ -363,7 +363,7 @@ static int bcma_register_devices(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
+void bcma_unregister_cores(struct bcma_bus *bus)
|
||||
{
|
||||
struct bcma_device *core, *tmp;
|
||||
|
||||
--- a/drivers/net/wireless/b43/main.c
|
||||
+++ b/drivers/net/wireless/b43/main.c
|
||||
@@ -4770,7 +4770,7 @@ static void b43_wireless_core_exit(struc
|
||||
switch (dev->dev->bus_type) {
|
||||
#ifdef CONFIG_B43_BCMA
|
||||
case B43_BUS_BCMA:
|
||||
- bcma_core_pci_down(dev->dev->bdev->bus);
|
||||
+ bcma_host_pci_down(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_B43_SSB
|
||||
@@ -4817,9 +4817,9 @@ static int b43_wireless_core_init(struct
|
||||
switch (dev->dev->bus_type) {
|
||||
#ifdef CONFIG_B43_BCMA
|
||||
case B43_BUS_BCMA:
|
||||
- bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
|
||||
+ bcma_core_pci_irq_ctl(dev->dev->bdev->bus,
|
||||
dev->dev->bdev, true);
|
||||
- bcma_core_pci_up(dev->dev->bdev->bus);
|
||||
+ bcma_host_pci_up(dev->dev->bdev->bus);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_B43_SSB
|
||||
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
|
||||
@@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c
|
||||
brcms_c_coredisable(wlc_hw);
|
||||
|
||||
/* Match driver "down" state */
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
|
||||
/* turn off pll and xtal to match driver "down" state */
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
@@ -4960,7 +4960,7 @@ static int brcms_b_up_prep(struct brcms_
|
||||
* Configure pci/pcmcia here instead of in brcms_c_attach()
|
||||
* to allow mfg hotswap: down, hotswap (chip power cycle), up.
|
||||
*/
|
||||
- bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core,
|
||||
+ bcma_core_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
|
||||
true);
|
||||
|
||||
/*
|
||||
@@ -4970,12 +4970,12 @@ static int brcms_b_up_prep(struct brcms_
|
||||
*/
|
||||
if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
|
||||
/* put SB PCI in down state again */
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
|
||||
- bcma_core_pci_up(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_up(wlc_hw->d11core->bus);
|
||||
|
||||
/* reset the d11 core */
|
||||
brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
|
||||
@@ -5172,7 +5172,7 @@ static int brcms_b_down_finish(struct br
|
||||
|
||||
/* turn off primary xtal and pll */
|
||||
if (!wlc_hw->noreset) {
|
||||
- bcma_core_pci_down(wlc_hw->d11core->bus);
|
||||
+ bcma_host_pci_down(wlc_hw->d11core->bus);
|
||||
brcms_b_xtal(wlc_hw, OFF);
|
||||
}
|
||||
}
|
||||
--- a/include/linux/bcma/bcma.h
|
||||
+++ b/include/linux/bcma/bcma.h
|
||||
@@ -434,6 +434,9 @@ static inline struct bcma_device *bcma_f
|
||||
return bcma_find_core_unit(bus, coreid, 0);
|
||||
}
|
||||
|
||||
+extern void bcma_host_pci_up(struct bcma_bus *bus);
|
||||
+extern void bcma_host_pci_down(struct bcma_bus *bus);
|
||||
+
|
||||
extern bool bcma_core_is_enabled(struct bcma_device *core);
|
||||
extern void bcma_core_disable(struct bcma_device *core, u32 flags);
|
||||
extern int bcma_core_enable(struct bcma_device *core, u32 flags);
|
||||
--- a/include/linux/bcma/bcma_driver_pci.h
|
||||
+++ b/include/linux/bcma/bcma_driver_pci.h
|
||||
@@ -240,10 +240,8 @@ struct bcma_drv_pci {
|
||||
|
||||
extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
|
||||
extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
|
||||
-extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
|
||||
+extern int bcma_core_pci_irq_ctl(struct bcma_bus *bus,
|
||||
struct bcma_device *core, bool enable);
|
||||
-extern void bcma_core_pci_up(struct bcma_bus *bus);
|
||||
-extern void bcma_core_pci_down(struct bcma_bus *bus);
|
||||
extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
|
||||
|
||||
extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
|
||||
--- a/include/linux/bcma/bcma_driver_pcie2.h
|
||||
+++ b/include/linux/bcma/bcma_driver_pcie2.h
|
||||
@@ -143,6 +143,8 @@
|
||||
|
||||
struct bcma_drv_pcie2 {
|
||||
struct bcma_device *core;
|
||||
+
|
||||
+ u16 reqsize;
|
||||
};
|
||||
|
||||
#define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
|
Loading…
Reference in New Issue
Block a user