bcma: detect PCI core working in hostmode
Rafał Miłecki
maintainerPATCH 1/1 bcma: detect PCI core working in hostmode
We must not init it like clientmode one, it would break device (tested by Hauke on BCM4718). Add stub hostmode driver for now.
---
Hauke: will you add your Signed-off-by?
In comparison to your patch for seriee, I have:
1) Disabled MIPS check for now (commented in code)
2) Enabled mode check even for driver without hostmode enabled
--- drivers/bcma/Kconfig | 6 ++++++ drivers/bcma/Makefile | 1 + drivers/bcma/bcma_private.h | 4 ++++ drivers/bcma/driver_pci.c | 38 +++++++++++++++++++++++++++++++++++++- drivers/bcma/driver_pci_host.c | 14 ++++++++++++++ 5 files changed, 62 insertions(+), 1 deletions(-) create mode 100644 drivers/bcma/driver_pci_host.c
drivers/bcma/Kconfig +6 -0
@@ -27,6 +27,12 @@ config BCMA_HOST_PCI bool "Support for BCMA on PCI-host bus" depends on BCMA_HOST_PCI_POSSIBLE +config BCMA_DRIVER_PCI_HOSTMODE + bool "Driver for PCI core working in hostmode" + depends on BCMA && MIPS + help + PCI core hostmode operation (external PCI bus). + config BCMA_DEBUG bool "BCMA debugging" depends on BCMA
drivers/bcma/Makefile +1 -0
@@ -1,6 +1,7 @@ bcma-y += main.o scan.o core.o sprom.o bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o bcma-y += driver_pci.o +bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o obj-$(CONFIG_BCMA) += bcma.o
drivers/bcma/bcma_private.h +4 -0
@@ -28,4 +28,8 @@ extern int __init bcma_host_pci_init(void); extern void __exit bcma_host_pci_exit(void);#endif /* CONFIG_BCMA_HOST_PCI */ +#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE +void bcma_core_pci_hostmode_init (struct bcma_drv_pci *pc); +#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ +#endif
drivers/bcma/driver_pci.c +37 -1
@@ -157,11 +157,47 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc)* Init. **************************************************/ -void bcma_core_pci_init (struct bcma_drv_pci *pc) +static void bcma_core_pci_clientmode_init (struct bcma_drv_pci *pc) {bcma_pcicore_serdes_workaround (pc); } +static bool bcma_core_pci_is_in_hostmode (struct bcma_drv_pci *pc) +{ +struct bcma_bus *bus = pc->core->bus; +u16 chipid_top; + + chipid_top = (bus->chipinfo.id &0xFF00 ); +if (chipid_top !=0x4700 && + chipid_top !=0x5300 ) +return false; + +if (bus->sprom.boardflags_lo &SSB_PCICORE_BFL_NOPCI ) +return false; + +#if 0 +/* TODO: on BCMA we use address from EROM instead of magic formula */ +u32 tmp; +return !mips_busprobe32 (tmp, (bus->mmio + + (pc->core->core_index *BCMA_CORE_SIZE ))); +#endif + +return true; +} + +void bcma_core_pci_init (struct bcma_drv_pci *pc) +{ +if (bcma_core_pci_is_in_hostmode (pc)) { +#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE +bcma_core_pci_hostmode_init (pc); +#else +pr_err ("Driver compiled without support for hostmode PCI\n" ); +#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ + }else { +bcma_core_pci_clientmode_init (pc); + } +} +int bcma_core_pci_irq_ctl (struct bcma_drv_pci *pc,struct bcma_device *core,bool enable) {
drivers/bcma/driver_pci_host.c new file +14 -0
@@ -0,0 +1,14 @@ +/* +* Broadcom specific AMBA +* PCI Core in hostmode +* +* Licensed under the GNU/GPL. See COPYING for details. +*/ + +#include "bcma_private.h" +#include <linux/bcma/bcma.h> + +void bcma_core_pci_hostmode_init (struct bcma_drv_pci *pc) +{ +pr_err ("No support for PCI core in hostmode yet\n" ); +}
Signature · 1 line
1.7.3.4
PATCH 1/1 bcma: detect PCI core working in hostmode
Quoted 4 lines · Rafa? Mi?ecki
We must not init it like clientmode one, it would break device (tested by Hauke on BCM4718). Add stub hostmode driver for now.
Signed-off-by Rafa? Mi?ecki <[email protected]>
Quoted 130 lines
---
Hauke: will you add your Signed-off-by?In comparison to your patch for seriee, I have:
1) Disabled MIPS check for now (commented in code)
2) Enabled mode check even for driver without hostmode enabled--- drivers/bcma/Kconfig | 6 ++++++ drivers/bcma/Makefile | 1 + drivers/bcma/bcma_private.h | 4 ++++ drivers/bcma/driver_pci.c | 38 +++++++++++++++++++++++++++++++++++++- drivers/bcma/driver_pci_host.c | 14 ++++++++++++++ 5 files changed, 62 insertions(+), 1 deletions(-) create mode 100644 drivers/bcma/driver_pci_host.cdrivers/bcma/Kconfig +6
-0@@ -27,6 +27,12 @@ config BCMA_HOST_PCI bool "Support for BCMA on PCI-host bus" depends on BCMA_HOST_PCI_POSSIBLE +config BCMA_DRIVER_PCI_HOSTMODE + bool "Driver for PCI core working in hostmode" + depends on BCMA && MIPS + help + PCI core hostmode operation (external PCI bus). + config BCMA_DEBUG bool "BCMA debugging" depends on BCMAdrivers/bcma/Makefile +1
-0@@ -1,6 +1,7 @@ bcma-y += main.o scan.o core.o sprom.o bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o bcma-y += driver_pci.o +bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o obj-$(CONFIG_BCMA) += bcma.odrivers/bcma/bcma_private.h +4
-0@@ -28,4 +28,8 @@ extern int __init bcma_host_pci_init(void); extern void __exit bcma_host_pci_exit(void);#endif /* CONFIG_BCMA_HOST_PCI */ +#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE +void bcma_core_pci_hostmode_init (struct bcma_drv_pci *pc); +#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ +#endif drivers/bcma/driver_pci.c +37
-1@@ -157,11 +157,47 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc)* Init. **************************************************/ -void bcma_core_pci_init (struct bcma_drv_pci *pc) +static void bcma_core_pci_clientmode_init (struct bcma_drv_pci *pc) {bcma_pcicore_serdes_workaround (pc); } +static bool bcma_core_pci_is_in_hostmode (struct bcma_drv_pci *pc) +{ +struct bcma_bus *bus = pc->core->bus; +u16 chipid_top; + + chipid_top = (bus->chipinfo.id &0xFF00 ); +if (chipid_top !=0x4700 && + chipid_top !=0x5300 ) +return false; + +if (bus->sprom.boardflags_lo &SSB_PCICORE_BFL_NOPCI ) +return false; + +#if 0 +/* TODO: on BCMA we use address from EROM instead of magic formula */ +u32 tmp; +return !mips_busprobe32 (tmp, (bus->mmio + + (pc->core->core_index *BCMA_CORE_SIZE ))); +#endif + +return true; +} + +void bcma_core_pci_init (struct bcma_drv_pci *pc) +{ +if (bcma_core_pci_is_in_hostmode (pc)) { +#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE +bcma_core_pci_hostmode_init (pc); +#else +pr_err ("Driver compiled without support for hostmode PCI\n" ); +#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ + }else { +bcma_core_pci_clientmode_init (pc); + } +} +int bcma_core_pci_irq_ctl (struct bcma_drv_pci *pc,struct bcma_device *core,bool enable) {drivers/bcma/driver_pci_host.c new file +14
-0@@ -0,0 +1,14 @@ +/* +* Broadcom specific AMBA +* PCI Core in hostmode +* +* Licensed under the GNU/GPL. See COPYING for details. +*/ + +#include "bcma_private.h" +#include <linux/bcma/bcma.h> + +void bcma_core_pci_hostmode_init (struct bcma_drv_pci *pc) +{ +pr_err ("No support for PCI core in hostmode yet\n" ); +}