kernel: mac80211: backport bcma patch renaming IRQ control function
[openwrt/openwrt.git] / target / linux / generic / patches-3.18 / 027-bcma-from-4.1.patch
1 --- a/drivers/bcma/bcma_private.h
2 +++ b/drivers/bcma/bcma_private.h
3 @@ -26,6 +26,7 @@ bool bcma_wait_value(struct bcma_device
4 int timeout);
5 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core);
6 void bcma_init_bus(struct bcma_bus *bus);
7 +void bcma_unregister_cores(struct bcma_bus *bus);
8 int bcma_bus_register(struct bcma_bus *bus);
9 void bcma_bus_unregister(struct bcma_bus *bus);
10 int __init bcma_bus_early_register(struct bcma_bus *bus);
11 @@ -42,6 +43,9 @@ int bcma_bus_scan(struct bcma_bus *bus);
12 int bcma_sprom_get(struct bcma_bus *bus);
13
14 /* driver_chipcommon.c */
15 +void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
16 +void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
17 +void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
18 #ifdef CONFIG_BCMA_DRIVER_MIPS
19 void bcma_chipco_serial_init(struct bcma_drv_cc *cc);
20 extern struct platform_device bcma_pflash_dev;
21 @@ -52,6 +56,8 @@ int bcma_core_chipcommon_b_init(struct b
22 void bcma_core_chipcommon_b_free(struct bcma_drv_cc_b *ccb);
23
24 /* driver_chipcommon_pmu.c */
25 +void bcma_pmu_early_init(struct bcma_drv_cc *cc);
26 +void bcma_pmu_init(struct bcma_drv_cc *cc);
27 u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc);
28 u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc);
29
30 @@ -101,6 +107,14 @@ static inline void __exit bcma_host_soc_
31
32 /* driver_pci.c */
33 u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address);
34 +void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
35 +void bcma_core_pci_init(struct bcma_drv_pci *pc);
36 +void bcma_core_pci_up(struct bcma_drv_pci *pc);
37 +void bcma_core_pci_down(struct bcma_drv_pci *pc);
38 +
39 +/* driver_pcie2.c */
40 +void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
41 +void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2);
42
43 extern int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc);
44
45 @@ -117,6 +131,39 @@ static inline void bcma_core_pci_hostmod
46 }
47 #endif /* CONFIG_BCMA_DRIVER_PCI_HOSTMODE */
48
49 +/**************************************************
50 + * driver_mips.c
51 + **************************************************/
52 +
53 +#ifdef CONFIG_BCMA_DRIVER_MIPS
54 +unsigned int bcma_core_mips_irq(struct bcma_device *dev);
55 +void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
56 +void bcma_core_mips_init(struct bcma_drv_mips *mcore);
57 +#else
58 +static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
59 +{
60 + return 0;
61 +}
62 +static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
63 +{
64 +}
65 +static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore)
66 +{
67 +}
68 +#endif
69 +
70 +/**************************************************
71 + * driver_gmac_cmn.c
72 + **************************************************/
73 +
74 +#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
75 +void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
76 +#else
77 +static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
78 +{
79 +}
80 +#endif
81 +
82 #ifdef CONFIG_BCMA_DRIVER_GPIO
83 /* driver_gpio.c */
84 int bcma_gpio_init(struct bcma_drv_cc *cc);
85 --- a/drivers/bcma/driver_gpio.c
86 +++ b/drivers/bcma/driver_gpio.c
87 @@ -17,6 +17,8 @@
88
89 #include "bcma_private.h"
90
91 +#define BCMA_GPIO_MAX_PINS 32
92 +
93 static inline struct bcma_drv_cc *bcma_gpio_get_cc(struct gpio_chip *chip)
94 {
95 return container_of(chip, struct bcma_drv_cc, gpio);
96 @@ -76,7 +78,7 @@ static void bcma_gpio_free(struct gpio_c
97 bcma_chipco_gpio_pullup(cc, 1 << gpio, 0);
98 }
99
100 -#if IS_BUILTIN(CONFIG_BCM47XX)
101 +#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
102 static int bcma_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
103 {
104 struct bcma_drv_cc *cc = bcma_gpio_get_cc(chip);
105 @@ -204,6 +206,7 @@ static void bcma_gpio_irq_domain_exit(st
106
107 int bcma_gpio_init(struct bcma_drv_cc *cc)
108 {
109 + struct bcma_bus *bus = cc->core->bus;
110 struct gpio_chip *chip = &cc->gpio;
111 int err;
112
113 @@ -215,14 +218,14 @@ int bcma_gpio_init(struct bcma_drv_cc *c
114 chip->set = bcma_gpio_set_value;
115 chip->direction_input = bcma_gpio_direction_input;
116 chip->direction_output = bcma_gpio_direction_output;
117 -#if IS_BUILTIN(CONFIG_BCM47XX)
118 +#if IS_BUILTIN(CONFIG_BCM47XX) || IS_BUILTIN(CONFIG_ARCH_BCM_5301X)
119 chip->to_irq = bcma_gpio_to_irq;
120 #endif
121 #if IS_BUILTIN(CONFIG_OF)
122 if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
123 chip->of_node = cc->core->dev.of_node;
124 #endif
125 - switch (cc->core->bus->chipinfo.id) {
126 + switch (bus->chipinfo.id) {
127 case BCMA_CHIP_ID_BCM5357:
128 case BCMA_CHIP_ID_BCM53572:
129 chip->ngpio = 32;
130 @@ -231,13 +234,17 @@ int bcma_gpio_init(struct bcma_drv_cc *c
131 chip->ngpio = 16;
132 }
133
134 - /* There is just one SoC in one device and its GPIO addresses should be
135 - * deterministic to address them more easily. The other buses could get
136 - * a random base number. */
137 - if (cc->core->bus->hosttype == BCMA_HOSTTYPE_SOC)
138 - chip->base = 0;
139 - else
140 - chip->base = -1;
141 + /*
142 + * On MIPS we register GPIO devices (LEDs, buttons) using absolute GPIO
143 + * pin numbers. We don't have Device Tree there and we can't really use
144 + * relative (per chip) numbers.
145 + * So let's use predictable base for BCM47XX and "random" for all other.
146 + */
147 +#if IS_BUILTIN(CONFIG_BCM47XX)
148 + chip->base = bus->num * BCMA_GPIO_MAX_PINS;
149 +#else
150 + chip->base = -1;
151 +#endif
152
153 err = bcma_gpio_irq_domain_init(cc);
154 if (err)
155 --- a/drivers/bcma/driver_pci.c
156 +++ b/drivers/bcma/driver_pci.c
157 @@ -282,39 +282,6 @@ void bcma_core_pci_power_save(struct bcm
158 }
159 EXPORT_SYMBOL_GPL(bcma_core_pci_power_save);
160
161 -int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core,
162 - bool enable)
163 -{
164 - struct pci_dev *pdev;
165 - u32 coremask, tmp;
166 - int err = 0;
167 -
168 - if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) {
169 - /* This bcma device is not on a PCI host-bus. So the IRQs are
170 - * not routed through the PCI core.
171 - * So we must not enable routing through the PCI core. */
172 - goto out;
173 - }
174 -
175 - pdev = pc->core->bus->host_pci;
176 -
177 - err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
178 - if (err)
179 - goto out;
180 -
181 - coremask = BIT(core->core_index) << 8;
182 - if (enable)
183 - tmp |= coremask;
184 - else
185 - tmp &= ~coremask;
186 -
187 - err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
188 -
189 -out:
190 - return err;
191 -}
192 -EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
193 -
194 static void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
195 {
196 u32 w;
197 @@ -328,28 +295,12 @@ static void bcma_core_pci_extend_L1timer
198 bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
199 }
200
201 -void bcma_core_pci_up(struct bcma_bus *bus)
202 +void bcma_core_pci_up(struct bcma_drv_pci *pc)
203 {
204 - struct bcma_drv_pci *pc;
205 -
206 - if (bus->hosttype != BCMA_HOSTTYPE_PCI)
207 - return;
208 -
209 - pc = &bus->drv_pci[0];
210 -
211 bcma_core_pci_extend_L1timer(pc, true);
212 }
213 -EXPORT_SYMBOL_GPL(bcma_core_pci_up);
214
215 -void bcma_core_pci_down(struct bcma_bus *bus)
216 +void bcma_core_pci_down(struct bcma_drv_pci *pc)
217 {
218 - struct bcma_drv_pci *pc;
219 -
220 - if (bus->hosttype != BCMA_HOSTTYPE_PCI)
221 - return;
222 -
223 - pc = &bus->drv_pci[0];
224 -
225 bcma_core_pci_extend_L1timer(pc, false);
226 }
227 -EXPORT_SYMBOL_GPL(bcma_core_pci_down);
228 --- a/drivers/bcma/driver_pci_host.c
229 +++ b/drivers/bcma/driver_pci_host.c
230 @@ -11,6 +11,7 @@
231
232 #include "bcma_private.h"
233 #include <linux/pci.h>
234 +#include <linux/slab.h>
235 #include <linux/export.h>
236 #include <linux/bcma/bcma.h>
237 #include <asm/paccess.h>
238 --- a/drivers/bcma/driver_pcie2.c
239 +++ b/drivers/bcma/driver_pcie2.c
240 @@ -10,6 +10,7 @@
241
242 #include "bcma_private.h"
243 #include <linux/bcma/bcma.h>
244 +#include <linux/pci.h>
245
246 /**************************************************
247 * R/W ops.
248 @@ -156,14 +157,23 @@ static void pciedev_reg_pm_clk_period(st
249
250 void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2)
251 {
252 - struct bcma_chipinfo *ci = &pcie2->core->bus->chipinfo;
253 + struct bcma_bus *bus = pcie2->core->bus;
254 + struct bcma_chipinfo *ci = &bus->chipinfo;
255 u32 tmp;
256
257 tmp = pcie2_read32(pcie2, BCMA_CORE_PCIE2_SPROM(54));
258 if ((tmp & 0xe) >> 1 == 2)
259 bcma_core_pcie2_cfg_write(pcie2, 0x4e0, 0x17);
260
261 - /* TODO: Do we need pcie_reqsize? */
262 + switch (bus->chipinfo.id) {
263 + case BCMA_CHIP_ID_BCM4360:
264 + case BCMA_CHIP_ID_BCM4352:
265 + pcie2->reqsize = 1024;
266 + break;
267 + default:
268 + pcie2->reqsize = 128;
269 + break;
270 + }
271
272 if (ci->id == BCMA_CHIP_ID_BCM4360 && ci->rev > 3)
273 bcma_core_pcie2_war_delay_perst_enab(pcie2, true);
274 @@ -173,3 +183,18 @@ void bcma_core_pcie2_init(struct bcma_dr
275 pciedev_crwlpciegen2_180(pcie2);
276 pciedev_crwlpciegen2_182(pcie2);
277 }
278 +
279 +/**************************************************
280 + * Runtime ops.
281 + **************************************************/
282 +
283 +void bcma_core_pcie2_up(struct bcma_drv_pcie2 *pcie2)
284 +{
285 + struct bcma_bus *bus = pcie2->core->bus;
286 + struct pci_dev *dev = bus->host_pci;
287 + int err;
288 +
289 + err = pcie_set_readrq(dev, pcie2->reqsize);
290 + if (err)
291 + bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err);
292 +}
293 --- a/drivers/bcma/host_pci.c
294 +++ b/drivers/bcma/host_pci.c
295 @@ -213,16 +213,26 @@ static int bcma_host_pci_probe(struct pc
296 /* Initialize struct, detect chip */
297 bcma_init_bus(bus);
298
299 + /* Scan bus to find out generation of PCIe core */
300 + err = bcma_bus_scan(bus);
301 + if (err)
302 + goto err_pci_unmap_mmio;
303 +
304 + if (bcma_find_core(bus, BCMA_CORE_PCIE2))
305 + bus->host_is_pcie2 = true;
306 +
307 /* Register */
308 err = bcma_bus_register(bus);
309 if (err)
310 - goto err_pci_unmap_mmio;
311 + goto err_unregister_cores;
312
313 pci_set_drvdata(dev, bus);
314
315 out:
316 return err;
317
318 +err_unregister_cores:
319 + bcma_unregister_cores(bus);
320 err_pci_unmap_mmio:
321 pci_iounmap(dev, bus->mmio);
322 err_pci_release_regions:
323 @@ -283,9 +293,12 @@ static const struct pci_device_id bcma_p
324 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) },
325 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4358) },
326 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4359) },
327 + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4360) },
328 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4365) },
329 + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a0) },
330 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) },
331 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) },
332 + { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43b1) },
333 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) },
334 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */
335 { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */
336 @@ -310,3 +323,65 @@ void __exit bcma_host_pci_exit(void)
337 {
338 pci_unregister_driver(&bcma_pci_bridge_driver);
339 }
340 +
341 +/**************************************************
342 + * Runtime ops for drivers.
343 + **************************************************/
344 +
345 +/* See also pcicore_up */
346 +void bcma_host_pci_up(struct bcma_bus *bus)
347 +{
348 + if (bus->hosttype != BCMA_HOSTTYPE_PCI)
349 + return;
350 +
351 + if (bus->host_is_pcie2)
352 + bcma_core_pcie2_up(&bus->drv_pcie2);
353 + else
354 + bcma_core_pci_up(&bus->drv_pci[0]);
355 +}
356 +EXPORT_SYMBOL_GPL(bcma_host_pci_up);
357 +
358 +/* See also pcicore_down */
359 +void bcma_host_pci_down(struct bcma_bus *bus)
360 +{
361 + if (bus->hosttype != BCMA_HOSTTYPE_PCI)
362 + return;
363 +
364 + if (!bus->host_is_pcie2)
365 + bcma_core_pci_down(&bus->drv_pci[0]);
366 +}
367 +EXPORT_SYMBOL_GPL(bcma_host_pci_down);
368 +
369 +/* See also si_pci_setup */
370 +int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core,
371 + bool enable)
372 +{
373 + struct pci_dev *pdev;
374 + u32 coremask, tmp;
375 + int err = 0;
376 +
377 + if (bus->hosttype != BCMA_HOSTTYPE_PCI) {
378 + /* This bcma device is not on a PCI host-bus. So the IRQs are
379 + * not routed through the PCI core.
380 + * So we must not enable routing through the PCI core. */
381 + goto out;
382 + }
383 +
384 + pdev = bus->host_pci;
385 +
386 + err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp);
387 + if (err)
388 + goto out;
389 +
390 + coremask = BIT(core->core_index) << 8;
391 + if (enable)
392 + tmp |= coremask;
393 + else
394 + tmp &= ~coremask;
395 +
396 + err = pci_write_config_dword(pdev, BCMA_PCI_IRQMASK, tmp);
397 +
398 +out:
399 + return err;
400 +}
401 +EXPORT_SYMBOL_GPL(bcma_host_pci_irq_ctl);
402 --- a/drivers/bcma/main.c
403 +++ b/drivers/bcma/main.c
404 @@ -363,7 +363,7 @@ static int bcma_register_devices(struct
405 return 0;
406 }
407
408 -static void bcma_unregister_cores(struct bcma_bus *bus)
409 +void bcma_unregister_cores(struct bcma_bus *bus)
410 {
411 struct bcma_device *core, *tmp;
412
413 --- a/drivers/net/wireless/b43/main.c
414 +++ b/drivers/net/wireless/b43/main.c
415 @@ -4770,7 +4770,7 @@ static void b43_wireless_core_exit(struc
416 switch (dev->dev->bus_type) {
417 #ifdef CONFIG_B43_BCMA
418 case B43_BUS_BCMA:
419 - bcma_core_pci_down(dev->dev->bdev->bus);
420 + bcma_host_pci_down(dev->dev->bdev->bus);
421 break;
422 #endif
423 #ifdef CONFIG_B43_SSB
424 @@ -4817,9 +4817,9 @@ static int b43_wireless_core_init(struct
425 switch (dev->dev->bus_type) {
426 #ifdef CONFIG_B43_BCMA
427 case B43_BUS_BCMA:
428 - bcma_core_pci_irq_ctl(&dev->dev->bdev->bus->drv_pci[0],
429 + bcma_host_pci_irq_ctl(dev->dev->bdev->bus,
430 dev->dev->bdev, true);
431 - bcma_core_pci_up(dev->dev->bdev->bus);
432 + bcma_host_pci_up(dev->dev->bdev->bus);
433 break;
434 #endif
435 #ifdef CONFIG_B43_SSB
436 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
437 +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
438 @@ -4669,7 +4669,7 @@ static int brcms_b_attach(struct brcms_c
439 brcms_c_coredisable(wlc_hw);
440
441 /* Match driver "down" state */
442 - bcma_core_pci_down(wlc_hw->d11core->bus);
443 + bcma_host_pci_down(wlc_hw->d11core->bus);
444
445 /* turn off pll and xtal to match driver "down" state */
446 brcms_b_xtal(wlc_hw, OFF);
447 @@ -4960,7 +4960,7 @@ static int brcms_b_up_prep(struct brcms_
448 * Configure pci/pcmcia here instead of in brcms_c_attach()
449 * to allow mfg hotswap: down, hotswap (chip power cycle), up.
450 */
451 - bcma_core_pci_irq_ctl(&wlc_hw->d11core->bus->drv_pci[0], wlc_hw->d11core,
452 + bcma_host_pci_irq_ctl(wlc_hw->d11core->bus, wlc_hw->d11core,
453 true);
454
455 /*
456 @@ -4970,12 +4970,12 @@ static int brcms_b_up_prep(struct brcms_
457 */
458 if (brcms_b_radio_read_hwdisabled(wlc_hw)) {
459 /* put SB PCI in down state again */
460 - bcma_core_pci_down(wlc_hw->d11core->bus);
461 + bcma_host_pci_down(wlc_hw->d11core->bus);
462 brcms_b_xtal(wlc_hw, OFF);
463 return -ENOMEDIUM;
464 }
465
466 - bcma_core_pci_up(wlc_hw->d11core->bus);
467 + bcma_host_pci_up(wlc_hw->d11core->bus);
468
469 /* reset the d11 core */
470 brcms_b_corereset(wlc_hw, BRCMS_USE_COREFLAGS);
471 @@ -5172,7 +5172,7 @@ static int brcms_b_down_finish(struct br
472
473 /* turn off primary xtal and pll */
474 if (!wlc_hw->noreset) {
475 - bcma_core_pci_down(wlc_hw->d11core->bus);
476 + bcma_host_pci_down(wlc_hw->d11core->bus);
477 brcms_b_xtal(wlc_hw, OFF);
478 }
479 }
480 --- a/include/linux/bcma/bcma.h
481 +++ b/include/linux/bcma/bcma.h
482 @@ -434,6 +434,27 @@ static inline struct bcma_device *bcma_f
483 return bcma_find_core_unit(bus, coreid, 0);
484 }
485
486 +#ifdef CONFIG_BCMA_HOST_PCI
487 +extern void bcma_host_pci_up(struct bcma_bus *bus);
488 +extern void bcma_host_pci_down(struct bcma_bus *bus);
489 +extern int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
490 + struct bcma_device *core, bool enable);
491 +#else
492 +static inline void bcma_host_pci_up(struct bcma_bus *bus)
493 +{
494 +}
495 +static inline void bcma_host_pci_down(struct bcma_bus *bus)
496 +{
497 +}
498 +static inline int bcma_host_pci_irq_ctl(struct bcma_bus *bus,
499 + struct bcma_device *core, bool enable)
500 +{
501 + if (bus->hosttype == BCMA_HOSTTYPE_PCI)
502 + return -ENOTSUPP;
503 + return 0;
504 +}
505 +#endif
506 +
507 extern bool bcma_core_is_enabled(struct bcma_device *core);
508 extern void bcma_core_disable(struct bcma_device *core, u32 flags);
509 extern int bcma_core_enable(struct bcma_device *core, u32 flags);
510 --- a/include/linux/bcma/bcma_driver_pci.h
511 +++ b/include/linux/bcma/bcma_driver_pci.h
512 @@ -238,12 +238,6 @@ struct bcma_drv_pci {
513 #define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
514 #define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
515
516 -extern void bcma_core_pci_early_init(struct bcma_drv_pci *pc);
517 -extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
518 -extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
519 - struct bcma_device *core, bool enable);
520 -extern void bcma_core_pci_up(struct bcma_bus *bus);
521 -extern void bcma_core_pci_down(struct bcma_bus *bus);
522 extern void bcma_core_pci_power_save(struct bcma_bus *bus, bool up);
523
524 extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
525 --- a/include/linux/bcma/bcma_driver_pcie2.h
526 +++ b/include/linux/bcma/bcma_driver_pcie2.h
527 @@ -143,6 +143,8 @@
528
529 struct bcma_drv_pcie2 {
530 struct bcma_device *core;
531 +
532 + u16 reqsize;
533 };
534
535 #define pcie2_read16(pcie2, offset) bcma_read16((pcie2)->core, offset)
536 @@ -153,6 +155,4 @@ struct bcma_drv_pcie2 {
537 #define pcie2_set32(pcie2, offset, set) bcma_set32((pcie2)->core, offset, set)
538 #define pcie2_mask32(pcie2, offset, mask) bcma_mask32((pcie2)->core, offset, mask)
539
540 -void bcma_core_pcie2_init(struct bcma_drv_pcie2 *pcie2);
541 -
542 #endif /* LINUX_BCMA_DRIVER_PCIE2_H_ */
543 --- a/drivers/bcma/Kconfig
544 +++ b/drivers/bcma/Kconfig
545 @@ -1,6 +1,6 @@
546 config BCMA_POSSIBLE
547 bool
548 - depends on HAS_IOMEM && HAS_DMA
549 + depends on HAS_IOMEM && HAS_DMA && PCI
550 default y
551
552 menu "Broadcom specific AMBA"
553 @@ -26,6 +26,7 @@ config BCMA_HOST_PCI_POSSIBLE
554 config BCMA_HOST_PCI
555 bool "Support for BCMA on PCI-host bus"
556 depends on BCMA_HOST_PCI_POSSIBLE
557 + select BCMA_DRIVER_PCI
558 default y
559
560 config BCMA_DRIVER_PCI_HOSTMODE
561 @@ -44,6 +45,22 @@ config BCMA_HOST_SOC
562
563 If unsure, say N
564
565 +# TODO: make it depend on PCI when ready
566 +config BCMA_DRIVER_PCI
567 + bool
568 + default y
569 + help
570 + BCMA bus may have many versions of PCIe core. This driver
571 + supports:
572 + 1) PCIe core working in clientmode
573 + 2) PCIe Gen 2 clientmode core
574 +
575 + In general PCIe (Gen 2) clientmode core is required on PCIe
576 + hosted buses. It's responsible for initialization and basic
577 + hardware management.
578 + This driver is also prerequisite for a hostmode PCIe core
579 + support.
580 +
581 config BCMA_DRIVER_MIPS
582 bool "BCMA Broadcom MIPS core driver"
583 depends on BCMA && MIPS
584 --- a/drivers/bcma/Makefile
585 +++ b/drivers/bcma/Makefile
586 @@ -3,8 +3,8 @@ bcma-y += driver_chipcommon.o driver
587 bcma-y += driver_chipcommon_b.o
588 bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o
589 bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o
590 -bcma-y += driver_pci.o
591 -bcma-y += driver_pcie2.o
592 +bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o
593 +bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pcie2.o
594 bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o
595 bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
596 bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o
597 --- a/include/linux/bcma/bcma_driver_chipcommon.h
598 +++ b/include/linux/bcma/bcma_driver_chipcommon.h
599 @@ -663,14 +663,6 @@ struct bcma_drv_cc_b {
600 #define bcma_cc_maskset32(cc, offset, mask, set) \
601 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
602
603 -extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
604 -extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
605 -
606 -extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
607 -extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
608 -
609 -void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);
610 -
611 extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks);
612
613 extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc);
614 @@ -690,9 +682,6 @@ u32 bcma_chipco_gpio_pullup(struct bcma_
615 u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
616
617 /* PMU support */
618 -extern void bcma_pmu_init(struct bcma_drv_cc *cc);
619 -extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
620 -
621 extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
622 u32 value);
623 extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset,
624 --- a/include/linux/bcma/bcma_driver_gmac_cmn.h
625 +++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
626 @@ -91,10 +91,4 @@ struct bcma_drv_gmac_cmn {
627 #define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val)
628 #define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
629
630 -#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
631 -extern void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
632 -#else
633 -static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
634 -#endif
635 -
636 #endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */
637 --- a/include/linux/bcma/bcma_driver_mips.h
638 +++ b/include/linux/bcma/bcma_driver_mips.h
639 @@ -39,21 +39,6 @@ struct bcma_drv_mips {
640 u8 early_setup_done:1;
641 };
642
643 -#ifdef CONFIG_BCMA_DRIVER_MIPS
644 -extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
645 -extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
646 -
647 -extern unsigned int bcma_core_mips_irq(struct bcma_device *dev);
648 -#else
649 -static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
650 -static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
651 -
652 -static inline unsigned int bcma_core_mips_irq(struct bcma_device *dev)
653 -{
654 - return 0;
655 -}
656 -#endif
657 -
658 extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);
659
660 #endif /* LINUX_BCMA_DRIVER_MIPS_H_ */