diff options
-rw-r--r-- | drivers/bcma/Kconfig | 6 | ||||
-rw-r--r-- | drivers/bcma/Makefile | 1 | ||||
-rw-r--r-- | drivers/bcma/bcma_private.h | 4 | ||||
-rw-r--r-- | drivers/bcma/driver_pci.c | 38 | ||||
-rw-r--r-- | drivers/bcma/driver_pci_host.c | 14 |
5 files changed, 62 insertions, 1 deletions
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index 83e9adf46441..ae0a02e1b808 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
@@ -27,6 +27,12 @@ config BCMA_HOST_PCI | |||
27 | bool "Support for BCMA on PCI-host bus" | 27 | bool "Support for BCMA on PCI-host bus" |
28 | depends on BCMA_HOST_PCI_POSSIBLE | 28 | depends on BCMA_HOST_PCI_POSSIBLE |
29 | 29 | ||
30 | config BCMA_DRIVER_PCI_HOSTMODE | ||
31 | bool "Driver for PCI core working in hostmode" | ||
32 | depends on BCMA && MIPS | ||
33 | help | ||
34 | PCI core hostmode operation (external PCI bus). | ||
35 | |||
30 | config BCMA_DEBUG | 36 | config BCMA_DEBUG |
31 | bool "BCMA debugging" | 37 | bool "BCMA debugging" |
32 | depends on BCMA | 38 | depends on BCMA |
diff --git a/drivers/bcma/Makefile b/drivers/bcma/Makefile index cde0182bd1dc..a2161cceafb9 100644 --- a/drivers/bcma/Makefile +++ b/drivers/bcma/Makefile | |||
@@ -1,6 +1,7 @@ | |||
1 | bcma-y += main.o scan.o core.o sprom.o | 1 | bcma-y += main.o scan.o core.o sprom.o |
2 | bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o | 2 | bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o |
3 | bcma-y += driver_pci.o | 3 | bcma-y += driver_pci.o |
4 | bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o | ||
4 | bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o | 5 | bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o |
5 | obj-$(CONFIG_BCMA) += bcma.o | 6 | obj-$(CONFIG_BCMA) += bcma.o |
6 | 7 | ||
diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h index 4228736de0e8..e02ff21835c9 100644 --- a/drivers/bcma/bcma_private.h +++ b/drivers/bcma/bcma_private.h | |||
@@ -28,4 +28,8 @@ extern int __init bcma_host_pci_init(void); | |||
28 | extern void __exit bcma_host_pci_exit(void); | 28 | extern void __exit bcma_host_pci_exit(void); |
29 | #endif /* CONFIG_BCMA_HOST_PCI */ | 29 | #endif /* CONFIG_BCMA_HOST_PCI */ |
30 | 30 | ||
31 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
32 | void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc); | ||
33 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | ||
34 | |||
31 | #endif | 35 | #endif |
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index b0c19ede0d2e..dc6f34ac96a0 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c | |||
@@ -157,11 +157,47 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc) | |||
157 | * Init. | 157 | * Init. |
158 | **************************************************/ | 158 | **************************************************/ |
159 | 159 | ||
160 | void bcma_core_pci_init(struct bcma_drv_pci *pc) | 160 | static void bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc) |
161 | { | 161 | { |
162 | bcma_pcicore_serdes_workaround(pc); | 162 | bcma_pcicore_serdes_workaround(pc); |
163 | } | 163 | } |
164 | 164 | ||
165 | static bool bcma_core_pci_is_in_hostmode(struct bcma_drv_pci *pc) | ||
166 | { | ||
167 | struct bcma_bus *bus = pc->core->bus; | ||
168 | u16 chipid_top; | ||
169 | |||
170 | chipid_top = (bus->chipinfo.id & 0xFF00); | ||
171 | if (chipid_top != 0x4700 && | ||
172 | chipid_top != 0x5300) | ||
173 | return false; | ||
174 | |||
175 | if (bus->sprom.boardflags_lo & SSB_PCICORE_BFL_NOPCI) | ||
176 | return false; | ||
177 | |||
178 | #if 0 | ||
179 | /* TODO: on BCMA we use address from EROM instead of magic formula */ | ||
180 | u32 tmp; | ||
181 | return !mips_busprobe32(tmp, (bus->mmio + | ||
182 | (pc->core->core_index * BCMA_CORE_SIZE))); | ||
183 | #endif | ||
184 | |||
185 | return true; | ||
186 | } | ||
187 | |||
188 | void bcma_core_pci_init(struct bcma_drv_pci *pc) | ||
189 | { | ||
190 | if (bcma_core_pci_is_in_hostmode(pc)) { | ||
191 | #ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE | ||
192 | bcma_core_pci_hostmode_init(pc); | ||
193 | #else | ||
194 | pr_err("Driver compiled without support for hostmode PCI\n"); | ||
195 | #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */ | ||
196 | } else { | ||
197 | bcma_core_pci_clientmode_init(pc); | ||
198 | } | ||
199 | } | ||
200 | |||
165 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, | 201 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, |
166 | bool enable) | 202 | bool enable) |
167 | { | 203 | { |
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c new file mode 100644 index 000000000000..eb332b75ce83 --- /dev/null +++ b/drivers/bcma/driver_pci_host.c | |||
@@ -0,0 +1,14 @@ | |||
1 | /* | ||
2 | * Broadcom specific AMBA | ||
3 | * PCI Core in hostmode | ||
4 | * | ||
5 | * Licensed under the GNU/GPL. See COPYING for details. | ||
6 | */ | ||
7 | |||
8 | #include "bcma_private.h" | ||
9 | #include <linux/bcma/bcma.h> | ||
10 | |||
11 | void bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc) | ||
12 | { | ||
13 | pr_err("No support for PCI core in hostmode yet\n"); | ||
14 | } | ||