bcma: move PCI IRQ control function to host specific code
Rafał Miłecki
maintainerPATCH 1/3 bcma: move PCI IRQ control function to host specific code
This function isn't really related to any bus core. It touches PCI device config registers only, so move it to the (PCI) host file.
--- drivers/bcma/driver_pci.c | 33 ------------------------- drivers/bcma/host_pci.c | 34 ++++++++++++++++++++++++++ drivers/net/wireless/b43/main.c | 2 +- drivers/net/wireless/brcm80211/brcmsmac/main.c | 2 +- include/linux/bcma/bcma.h | 9 +++++++ include/linux/bcma/bcma_driver_pci.h | 2 -- 6 files changed, 45 insertions(+), 37 deletions(-)
drivers/bcma/driver_pci.c +0 -33
@@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcma_bus *bus, bool up) }EXPORT_SYMBOL_GPL (bcma_core_pci_power_save); -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 (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 = bus->host_pci; - - err =pci_read_config_dword (pdev,BCMA_PCI_IRQMASK , &tmp); -if (err) - goto out; - - coremask =BIT (core->core_index) <<8 ; -if (enable) - tmp |= coremask; -else - tmp &= ~coremask; - - err =pci_write_config_dword (pdev,BCMA_PCI_IRQMASK , tmp); - -out: -return err; -} -EXPORT_SYMBOL_GPL (bcma_core_pci_irq_ctl); -static void bcma_core_pci_extend_L1timer (struct bcma_drv_pci *pc,bool extend) {u32 w;
drivers/bcma/host_pci.c +34 -0
@@ -351,3 +351,37 @@ void bcma_host_pci_down(struct bcma_bus *bus)bcma_core_pci_down (&bus->drv_pci[0 ]); }EXPORT_SYMBOL_GPL (bcma_host_pci_down); + +/* See also si_pci_setup */ +int bcma_host_pci_irq_ctl (struct bcma_bus *bus,struct bcma_device *core, +bool enable) +{ +struct pci_dev *pdev; +u32 coremask, tmp; +int err =0 ; + +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 = bus->host_pci; + + err =pci_read_config_dword (pdev,BCMA_PCI_IRQMASK , &tmp); +if (err) + goto out; + + coremask =BIT (core->core_index) <<8 ; +if (enable) + tmp |= coremask; +else + tmp &= ~coremask; + + err =pci_write_config_dword (pdev,BCMA_PCI_IRQMASK , tmp); + +out: +return err; +} +EXPORT_SYMBOL_GPL (bcma_host_pci_irq_ctl);
drivers/net/wireless/b43/main.c +1 -1
@@ -4866,7 +4866,7 @@ static int b43_wireless_core_init(struct b43_wldev *dev)switch (dev->dev->bus_type) {#ifdef CONFIG_B43_BCMA case B43_BUS_BCMA : -bcma_core_pci_irq_ctl (dev->dev->bdev->bus, +bcma_host_pci_irq_ctl (dev->dev->bdev->bus, dev->dev->bdev, true);bcma_host_pci_up (dev->dev->bdev->bus);break ;
drivers/net/wireless/brcm80211/brcmsmac/main.c +1 -1
@@ -4959,7 +4959,7 @@ static int brcms_b_up_prep(struct brcms_hardware *wlc_hw)* 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, wlc_hw->d11core, +bcma_host_pci_irq_ctl (wlc_hw->d11core->bus, wlc_hw->d11core, true);/*
include/linux/bcma/bcma.h +9 -0
@@ -437,6 +437,8 @@ static inline struct bcma_device *bcma_find_core(struct bcma_bus *bus,#ifdef CONFIG_BCMA_HOST_PCI extern void bcma_host_pci_up (struct bcma_bus *bus);extern void bcma_host_pci_down (struct bcma_bus *bus); +extern int bcma_host_pci_irq_ctl (struct bcma_bus *bus, +struct bcma_device *core,bool enable);#else static inline void bcma_host_pci_up (struct bcma_bus *bus) {
@@ -444,6 +446,13 @@ static inline void bcma_host_pci_up(struct bcma_bus *bus)static inline void bcma_host_pci_down (struct bcma_bus *bus) { } +static inline int bcma_host_pci_irq_ctl (struct bcma_bus *bus, +struct bcma_device *core,bool enable) +{ +if (bus->hosttype ==BCMA_HOSTTYPE_PCI ) +return -ENOTSUPP ; +return 0 ; +}#endif extern bool bcma_core_is_enabled (struct bcma_device *core);
include/linux/bcma/bcma_driver_pci.h +0 -2
@@ -238,8 +238,6 @@ struct bcma_drv_pci {#define pcicore_write16 (pc, offset, val) bcma_write16((pc)->core, offset, val)#define pcicore_write32 (pc, offset, val) bcma_write32((pc)->core, offset, val) -extern int bcma_core_pci_irq_ctl (struct bcma_bus *bus, -struct bcma_device *core,bool enable);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);
Signature · 1 line
1.8.4.5
Rafał Miłecki
maintainerPATCH 2/3 bcma: allow disabling (not building) PCI driver
It isn't required for bcma bus on SoCs, so provide some empty functions and allow disabling it.
--- drivers/bcma/Kconfig | 4 ++-- drivers/bcma/bcma_private.h | 20 ++++++++++++++++++++ include/linux/bcma/bcma_driver_pci.h | 6 ++++++ 3 files changed, 28 insertions(+), 2 deletions(-)
drivers/bcma/Kconfig +2 -2
@@ -45,9 +45,9 @@ config BCMA_HOST_SOC If unsure, say N -# TODO: make it depend on PCI when ready config BCMA_DRIVER_PCI - bool + bool "BCMA Broadcom PCI core driver" + depends on BCMA && PCI default y help BCMA bus may have many versions of PCIe core. This driver
drivers/bcma/bcma_private.h +20 -0
@@ -106,15 +106,35 @@ static inline void __exit bcma_host_soc_unregister_driver(void)#endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */ /* driver_pci.c */ +#ifdef CONFIG_BCMA_DRIVER_PCI u32 bcma_pcie_read (struct bcma_drv_pci *pc,u32 address);void bcma_core_pci_early_init (struct bcma_drv_pci *pc);void bcma_core_pci_init (struct bcma_drv_pci *pc);void bcma_core_pci_up (struct bcma_drv_pci *pc);void bcma_core_pci_down (struct bcma_drv_pci *pc); +#else +static inline void bcma_core_pci_early_init (struct bcma_drv_pci *pc) +{ +WARN_ON (pc->core->bus->hosttype ==BCMA_HOSTTYPE_PCI ); +} +static inline void bcma_core_pci_init (struct bcma_drv_pci *pc) +{ +/* Initialization is required for PCI hosted bus */ +WARN_ON (pc->core->bus->hosttype ==BCMA_HOSTTYPE_PCI ); +} +#endif /* driver_pcie2.c */ +#ifdef CONFIG_BCMA_DRIVER_PCI void bcma_core_pcie2_init (struct bcma_drv_pcie2 *pcie2);void bcma_core_pcie2_up (struct bcma_drv_pcie2 *pcie2); +#else +static inline void bcma_core_pcie2_init (struct bcma_drv_pcie2 *pcie2) +{ +/* Initialization is required for PCI hosted bus */ +WARN_ON (pcie2->core->bus->hosttype ==BCMA_HOSTTYPE_PCI ); +} +#endif extern int bcma_chipco_watchdog_register (struct bcma_drv_cc *cc);
include/linux/bcma/bcma_driver_pci.h +6 -0
@@ -238,7 +238,13 @@ struct bcma_drv_pci {#define pcicore_write16 (pc, offset, val) bcma_write16((pc)->core, offset, val)#define pcicore_write32 (pc, offset, val) bcma_write32((pc)->core, offset, val) +#ifdef CONFIG_BCMA_DRIVER_PCI extern void bcma_core_pci_power_save (struct bcma_bus *bus,bool up); +#else +static inline void bcma_core_pci_power_save (struct bcma_bus *bus,bool up) +{ +} +#endif extern int bcma_core_pci_pcibios_map_irq (const struct pci_dev *dev);extern int bcma_core_pci_plat_dev_init (struct pci_dev *dev);
Signature · 1 line
1.8.4.5
Rafał Miłecki
maintainerPATCH 3/3 Revert "bcma: Kconfig: Let it depend on PCI"
In reply to Rafał MiłeckiThis reverts commit b09f5ec18b16b82f4db8a735e453332db7514275.
Now that we have fully working BCMA_DRIVER_PCI symbol (in can be safely disabled), there is no risk bcma will try to use PCI code without PCI available.
--- drivers/bcma/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bcma/Kconfig +1 -1
@@ -1,6 +1,6 @@ config BCMA_POSSIBLE bool - depends on HAS_IOMEM && HAS_DMA && PCI + depends on HAS_IOMEM && HAS_DMA default y menu "Broadcom specific AMBA"
Signature · 1 line
1.8.4.5
Quoted 4 lines · Rafał Miłecki
This function isn't really related to any bus core. It touches PCI device config registers only, so move it to the (PCI) host file.
Signed-off-by Rafał Miłecki <[email protected]>
Thanks, all three patches manually applied to wireless-drivers-next.
Signature · 1 line
Kalle Valo