Message ID | 1307311658-15853-8-git-send-email-hauke@hauke-m.de (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
2011/6/6 Hauke Mehrtens <hauke@hauke-m.de>: > +config BCMA_PCICORE_HOSTMODE > + bool "Hostmode support for BCMA PCI core" > + depends on BCMA_DRIVER_MIPS > + help > + PCIcore hostmode operation (external PCI bus). I think you started to use BCMA_DRIVER_corename. Could you stick to it (one schema), please? Maybe just BCMA_DRIVER_PCI_HOSTMODE ? > +#ifdef CONFIG_BCMA_PCICORE_HOSTMODE > + pc->hostmode = bcma_pcicore_is_in_hostmode(pc); > + if (pc->hostmode) > + bcma_pcicore_init_hostmode(pc); > +#endif /* CONFIG_BCMA_PCICORE_HOSTMODE */ > + if (!pc->hostmode) > + bcma_pcicore_serdes_workaround(pc); Does it make sense to init hostmode PCI like clientmode if we just disable CONFIG_BCMA_PCICORE_HOSTMODE? I think we should always check if core is host or client mode and use correct initialization only. We should not init it as clientmode just because we do not have driver for host mode. > diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c > new file mode 100644 > index 0000000..b52c6c9 > --- /dev/null > +++ b/drivers/bcma/driver_pci_host.c > @@ -0,0 +1,44 @@ > +/* > + * Broadcom specific AMBA > + * PCI Core Please rename "PCI Core", add something about hostmode.
2011/6/6 Hauke Mehrtens <hauke@hauke-m.de>: > +#ifdef CONFIG_BCMA_PCICORE_HOSTMODE > +/* driver_pci_host.c */ > +extern int bcma_pcicore_is_in_hostmode(struct bcma_drv_pci *pc); > +extern void bcma_pcicore_init_hostmode(struct bcma_drv_pci *pc); > +#endif /* CONFIG_BCMA_PCICORE_HOSTMODE */ I don't know if I'm overreacting, but I really don't like naming mess in the ssb. Why don't you use bcma_core_pci_* to be consistent?
On 06/06/2011 01:32 PM, Rafa? Mi?ecki wrote: > 2011/6/6 Hauke Mehrtens <hauke@hauke-m.de>: >> +config BCMA_PCICORE_HOSTMODE >> + bool "Hostmode support for BCMA PCI core" >> + depends on BCMA_DRIVER_MIPS >> + help >> + PCIcore hostmode operation (external PCI bus). > > I think you started to use BCMA_DRIVER_corename. Could you stick to it > (one schema), please? Maybe just > BCMA_DRIVER_PCI_HOSTMODE > ? > Yes sounds better. > >> +#ifdef CONFIG_BCMA_PCICORE_HOSTMODE >> + pc->hostmode = bcma_pcicore_is_in_hostmode(pc); >> + if (pc->hostmode) >> + bcma_pcicore_init_hostmode(pc); >> +#endif /* CONFIG_BCMA_PCICORE_HOSTMODE */ >> + if (!pc->hostmode) >> + bcma_pcicore_serdes_workaround(pc); > > Does it make sense to init hostmode PCI like clientmode if we just > disable CONFIG_BCMA_PCICORE_HOSTMODE? > > I think we should always check if core is host or client mode and use > correct initialization only. We should not init it as clientmode just > because we do not have driver for host mode. Yes we should not initialize a host mode pci core with client init code as it will break my device. ;-) I will place bcma_pcicore_is_in_hostmode() into the normal PCI driver code so it is available all the time. > > >> diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c >> new file mode 100644 >> index 0000000..b52c6c9 >> --- /dev/null >> +++ b/drivers/bcma/driver_pci_host.c >> @@ -0,0 +1,44 @@ >> +/* >> + * Broadcom specific AMBA >> + * PCI Core > > Please rename "PCI Core", add something about hostmode. > Missed that while copy and past. Hauke -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index 568d30b..c863a87 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig @@ -27,6 +27,12 @@ config BCMA_HOST_PCI bool "Support for BCMA on PCI-host bus" depends on BCMA_HOST_PCI_POSSIBLE +config BCMA_PCICORE_HOSTMODE + bool "Hostmode support for BCMA PCI core" + depends on BCMA_DRIVER_MIPS + help + PCIcore hostmode operation (external PCI bus). + config BCMA_HOST_EMBEDDED bool depends on BCMA_DRIVER_MIPS diff --git a/drivers/bcma/Makefile b/drivers/bcma/Makefile index 50ddab8..f99abfe 100644 --- a/drivers/bcma/Makefile +++ b/drivers/bcma/Makefile @@ -1,6 +1,7 @@ bcma-y += main.o scan.o core.o bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o bcma-y += driver_pci.o +bcma-$(CONFIG_BCMA_PCICORE_HOSTMODE) += driver_pci_host.o bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o bcma-$(CONFIG_BCMA_HOST_EMBEDDED) += host_embedded.o diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index fbabe19..13cf25a 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h @@ -29,6 +29,12 @@ extern u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc); extern int bcma_chipco_serial_init(struct bcma_drv_cc *cc, struct bcma_drv_mips_serial_port *ports); +#ifdef CONFIG_BCMA_PCICORE_HOSTMODE +/* driver_pci_host.c */ +extern int bcma_pcicore_is_in_hostmode(struct bcma_drv_pci *pc); +extern void bcma_pcicore_init_hostmode(struct bcma_drv_pci *pc); +#endif /* CONFIG_BCMA_PCICORE_HOSTMODE */ + #ifdef CONFIG_BCMA_HOST_PCI /* host_pci.c */ extern int __init bcma_host_pci_init(void); diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index 789d68b..cf8cbe0 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c @@ -159,7 +159,17 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) void bcma_core_pci_init(struct bcma_drv_pci *pc) { - bcma_pcicore_serdes_workaround(pc); + struct bcma_device *core = pc->core; + + if (!bcma_core_is_enabled(core)) + bcma_core_enable(core, 0); +#ifdef CONFIG_BCMA_PCICORE_HOSTMODE + pc->hostmode = bcma_pcicore_is_in_hostmode(pc); + if (pc->hostmode) + bcma_pcicore_init_hostmode(pc); +#endif /* CONFIG_BCMA_PCICORE_HOSTMODE */ + if (!pc->hostmode) + bcma_pcicore_serdes_workaround(pc); } int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c new file mode 100644 index 0000000..b52c6c9 --- /dev/null +++ b/drivers/bcma/driver_pci_host.c @@ -0,0 +1,44 @@ +/* + * Broadcom specific AMBA + * PCI Core + * + * Copyright 2005, Broadcom Corporation + * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de> + * + * Licensed under the GNU/GPL. See COPYING for details. + */ + +#include "bcma_private.h" +#include <linux/bcma/bcma.h> + +#include <asm/paccess.h> +/* Probe a 32bit value on the bus and catch bus exceptions. + * Returns nonzero on a bus exception. + * This is MIPS specific */ +#define mips_busprobe32(val, addr) get_dbe((val), ((u32 *)(addr))) + + +void bcma_pcicore_init_hostmode(struct bcma_drv_pci *pc) +{ + /* TODO: implement PCI host mode */ +} + +int bcma_pcicore_is_in_hostmode(struct bcma_drv_pci *pc) +{ + struct bcma_bus *bus = pc->core->bus; + u16 chipid_top; + u32 tmp; + + chipid_top = (bus->chipinfo.id & 0xFF00); + if (chipid_top != 0x4700 && + chipid_top != 0x5300) + return 0; + +/* TODO: add when sprom is available + * if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) + * return 0; + */ + + return !mips_busprobe32(tmp, (bus->mmio + (pc->core->core_index * + BCMA_CORE_SIZE))); +} diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h index b7e191c..5bbc58f 100644 --- a/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h @@ -78,6 +78,7 @@ struct pci_dev; struct bcma_drv_pci { struct bcma_device *core; u8 setup_done:1; + u8 hostmode:1; }; /* Register access */
This adds some stub for a pci(e) host controller. This controller is found on some embedded devices to attach other chips. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- drivers/bcma/Kconfig | 6 ++++ drivers/bcma/Makefile | 1 + drivers/bcma/bcma_private.h | 6 ++++ drivers/bcma/driver_pci.c | 12 ++++++++- drivers/bcma/driver_pci_host.c | 44 ++++++++++++++++++++++++++++++++++ include/linux/bcma/bcma_driver_pci.h | 1 + 6 files changed, 69 insertions(+), 1 deletions(-) create mode 100644 drivers/bcma/driver_pci_host.c