kernel: backport rest of bcma patches

This backports
bcma: allow disabling (not building) PCI driver
Revert "bcma: Kconfig: Let it depend on PCI"

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 44970
This commit is contained in:
Rafał Miłecki 2015-03-24 10:39:10 +00:00
parent a7724918c9
commit 8fdd0fb07c
3 changed files with 67 additions and 26 deletions

View file

@ -26,6 +26,7 @@ CONFIG_BCMA_DEBUG=y
CONFIG_BCMA_DRIVER_GMAC_CMN=y CONFIG_BCMA_DRIVER_GMAC_CMN=y
CONFIG_BCMA_DRIVER_GPIO=y CONFIG_BCMA_DRIVER_GPIO=y
CONFIG_BCMA_DRIVER_MIPS=y CONFIG_BCMA_DRIVER_MIPS=y
CONFIG_BCMA_DRIVER_PCI=y
CONFIG_BCMA_DRIVER_PCI_HOSTMODE=y CONFIG_BCMA_DRIVER_PCI_HOSTMODE=y
CONFIG_BCMA_HOST_PCI=y CONFIG_BCMA_HOST_PCI=y
CONFIG_BCMA_HOST_PCI_POSSIBLE=y CONFIG_BCMA_HOST_PCI_POSSIBLE=y

View file

@ -27,22 +27,43 @@
u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
@@ -101,6 +107,14 @@ static inline void __exit bcma_host_soc_ @@ -100,7 +106,35 @@ static inline void __exit bcma_host_soc_
#endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
/* driver_pci.c */ /* driver_pci.c */
+#ifdef CONFIG_BCMA_DRIVER_PCI
u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); 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_early_init(struct bcma_drv_pci *pc);
+void bcma_core_pci_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_up(struct bcma_drv_pci *pc);
+void bcma_core_pci_down(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 */ +/* driver_pcie2.c */
+#ifdef CONFIG_BCMA_DRIVER_PCI
+void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); +void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
+void bcma_core_pcie2_up(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); extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
@@ -117,6 +131,39 @@ static inline void bcma_core_pci_hostmod @@ -117,6 +151,39 @@ static inline void bcma_core_pci_hostmod
} }
#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
@ -509,7 +530,7 @@
extern int bcma_core_enable(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 --- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h
@@ -238,12 +238,6 @@ struct bcma_drv_pci { @@ -238,13 +238,13 @@ struct bcma_drv_pci {
#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
@ -519,9 +540,16 @@
- struct bcma_device *core, bool enable); - struct bcma_device *core, bool enable);
-extern void bcma_core_pci_up(struct bcma_bus *bus); -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_down(struct bcma_bus *bus);
+#ifdef CONFIG_BCMA_DRIVER_PCI
extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 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_pcibios_map_irq(const struct pci_dev *dev);
extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
--- a/include/linux/bcma/bcma_driver_pcie2.h --- a/include/linux/bcma/bcma_driver_pcie2.h
+++ b/include/linux/bcma/bcma_driver_pcie2.h +++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -143,6 +143,8 @@ @@ -143,6 +143,8 @@
@ -542,14 +570,6 @@
#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
--- a/drivers/bcma/Kconfig --- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig
@@ -1,6 +1,6 @@
config BCMA_POSSIBLE
bool
- depends on HAS_IOMEM && HAS_DMA
+ depends on HAS_IOMEM && HAS_DMA && PCI
default y
menu "Broadcom specific AMBA"
@@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE @@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE
config BCMA_HOST_PCI config BCMA_HOST_PCI
bool "Support for BCMA on PCI-host bus" bool "Support for BCMA on PCI-host bus"
@ -562,9 +582,9 @@
If unsure, say N If unsure, say N
+# TODO: make it depend on PCI when ready
+config BCMA_DRIVER_PCI +config BCMA_DRIVER_PCI
+ bool + bool "BCMA Broadcom PCI core driver"
+ depends on BCMA && PCI
+ default y + default y
+ help + help
+ BCMA bus may have many versions of PCIe core. This driver + BCMA bus may have many versions of PCIe core. This driver

View file

@ -27,22 +27,43 @@
u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc); u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc); u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
@@ -101,6 +107,14 @@ static inline void __exit bcma_host_soc_ @@ -100,7 +106,35 @@ static inline void __exit bcma_host_soc_
#endif /* CONFIG_BCMA_HOST_SOC && CONFIG_OF */
/* driver_pci.c */ /* driver_pci.c */
+#ifdef CONFIG_BCMA_DRIVER_PCI
u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address); 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_early_init(struct bcma_drv_pci *pc);
+void bcma_core_pci_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_up(struct bcma_drv_pci *pc);
+void bcma_core_pci_down(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 */ +/* driver_pcie2.c */
+#ifdef CONFIG_BCMA_DRIVER_PCI
+void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2); +void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
+void bcma_core_pcie2_up(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); extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
@@ -117,6 +131,39 @@ static inline void bcma_core_pci_hostmod @@ -117,6 +151,39 @@ static inline void bcma_core_pci_hostmod
} }
#endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
@ -509,7 +530,7 @@
extern int bcma_core_enable(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 --- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h +++ b/include/linux/bcma/bcma_driver_pci.h
@@ -238,12 +238,6 @@ struct bcma_drv_pci { @@ -238,13 +238,13 @@ struct bcma_drv_pci {
#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val) #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
@ -519,9 +540,16 @@
- struct bcma_device *core, bool enable); - struct bcma_device *core, bool enable);
-extern void bcma_core_pci_up(struct bcma_bus *bus); -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_down(struct bcma_bus *bus);
+#ifdef CONFIG_BCMA_DRIVER_PCI
extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up); 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_pcibios_map_irq(const struct pci_dev *dev);
extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
--- a/include/linux/bcma/bcma_driver_pcie2.h --- a/include/linux/bcma/bcma_driver_pcie2.h
+++ b/include/linux/bcma/bcma_driver_pcie2.h +++ b/include/linux/bcma/bcma_driver_pcie2.h
@@ -143,6 +143,8 @@ @@ -143,6 +143,8 @@
@ -542,14 +570,6 @@
#endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */ #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
--- a/drivers/bcma/Kconfig --- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig
@@ -1,6 +1,6 @@
config BCMA_POSSIBLE
bool
- depends on HAS_IOMEM && HAS_DMA
+ depends on HAS_IOMEM && HAS_DMA && PCI
default y
menu "Broadcom specific AMBA"
@@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE @@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE
config BCMA_HOST_PCI config BCMA_HOST_PCI
bool "Support for BCMA on PCI-host bus" bool "Support for BCMA on PCI-host bus"
@ -562,9 +582,9 @@
If unsure, say N If unsure, say N
+# TODO: make it depend on PCI when ready
+config BCMA_DRIVER_PCI +config BCMA_DRIVER_PCI
+ bool + bool "BCMA Broadcom PCI core driver"
+ depends on BCMA && PCI
+ default y + default y
+ help + help
+ BCMA bus may have many versions of PCIe core. This driver + BCMA bus may have many versions of PCIe core. This driver