027-bcma-from-4.1.patch 21 KB

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