main.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. /*
  2. * Broadcom specific AMBA
  3. * Bus subsystem
  4. *
  5. * Licensed under the GNU/GPL. See COPYING for details.
  6. */
  7. #include "bcma_private.h"
  8. #include <linux/module.h>
  9. #include <linux/mmc/sdio_func.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/pci.h>
  12. #include <linux/bcma/bcma.h>
  13. #include <linux/slab.h>
  14. #include <linux/of_address.h>
  15. #include <linux/of_irq.h>
  16. #include <linux/of_platform.h>
  17. MODULE_DESCRIPTION("Broadcom's specific AMBA driver");
  18. MODULE_LICENSE("GPL");
  19. /* contains the number the next bus should get. */
  20. static unsigned int bcma_bus_next_num;
  21. /* bcma_buses_mutex locks the bcma_bus_next_num */
  22. static DEFINE_MUTEX(bcma_buses_mutex);
  23. static int bcma_bus_match(struct device *dev, struct device_driver *drv);
  24. static int bcma_device_probe(struct device *dev);
  25. static void bcma_device_remove(struct device *dev);
  26. static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env);
  27. static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, char *buf)
  28. {
  29. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  30. return sprintf(buf, "0x%03X\n", core->id.manuf);
  31. }
  32. static DEVICE_ATTR_RO(manuf);
  33. static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
  34. {
  35. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  36. return sprintf(buf, "0x%03X\n", core->id.id);
  37. }
  38. static DEVICE_ATTR_RO(id);
  39. static ssize_t rev_show(struct device *dev, struct device_attribute *attr, char *buf)
  40. {
  41. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  42. return sprintf(buf, "0x%02X\n", core->id.rev);
  43. }
  44. static DEVICE_ATTR_RO(rev);
  45. static ssize_t class_show(struct device *dev, struct device_attribute *attr, char *buf)
  46. {
  47. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  48. return sprintf(buf, "0x%X\n", core->id.class);
  49. }
  50. static DEVICE_ATTR_RO(class);
  51. static struct attribute *bcma_device_attrs[] = {
  52. &dev_attr_manuf.attr,
  53. &dev_attr_id.attr,
  54. &dev_attr_rev.attr,
  55. &dev_attr_class.attr,
  56. NULL,
  57. };
  58. ATTRIBUTE_GROUPS(bcma_device);
  59. static struct bus_type bcma_bus_type = {
  60. .name = "bcma",
  61. .match = bcma_bus_match,
  62. .probe = bcma_device_probe,
  63. .remove = bcma_device_remove,
  64. .uevent = bcma_device_uevent,
  65. .dev_groups = bcma_device_groups,
  66. };
  67. static u16 bcma_cc_core_id(struct bcma_bus *bus)
  68. {
  69. if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
  70. return BCMA_CORE_4706_CHIPCOMMON;
  71. return BCMA_CORE_CHIPCOMMON;
  72. }
  73. struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid,
  74. u8 unit)
  75. {
  76. struct bcma_device *core;
  77. list_for_each_entry(core, &bus->cores, list) {
  78. if (core->id.id == coreid && core->core_unit == unit)
  79. return core;
  80. }
  81. return NULL;
  82. }
  83. EXPORT_SYMBOL_GPL(bcma_find_core_unit);
  84. bool bcma_wait_value(struct bcma_device *core, u16 reg, u32 mask, u32 value,
  85. int timeout)
  86. {
  87. unsigned long deadline = jiffies + timeout;
  88. u32 val;
  89. do {
  90. val = bcma_read32(core, reg);
  91. if ((val & mask) == value)
  92. return true;
  93. cpu_relax();
  94. udelay(10);
  95. } while (!time_after_eq(jiffies, deadline));
  96. bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg);
  97. return false;
  98. }
  99. static void bcma_release_core_dev(struct device *dev)
  100. {
  101. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  102. if (core->io_addr)
  103. iounmap(core->io_addr);
  104. if (core->io_wrap)
  105. iounmap(core->io_wrap);
  106. kfree(core);
  107. }
  108. static bool bcma_is_core_needed_early(u16 core_id)
  109. {
  110. switch (core_id) {
  111. case BCMA_CORE_NS_NAND:
  112. case BCMA_CORE_NS_QSPI:
  113. return true;
  114. }
  115. return false;
  116. }
  117. static struct device_node *bcma_of_find_child_device(struct device *parent,
  118. struct bcma_device *core)
  119. {
  120. struct device_node *node;
  121. u64 size;
  122. const __be32 *reg;
  123. if (!parent->of_node)
  124. return NULL;
  125. for_each_child_of_node(parent->of_node, node) {
  126. reg = of_get_address(node, 0, &size, NULL);
  127. if (!reg)
  128. continue;
  129. if (of_translate_address(node, reg) == core->addr)
  130. return node;
  131. }
  132. return NULL;
  133. }
  134. static int bcma_of_irq_parse(struct device *parent,
  135. struct bcma_device *core,
  136. struct of_phandle_args *out_irq, int num)
  137. {
  138. __be32 laddr[1];
  139. int rc;
  140. if (core->dev.of_node) {
  141. rc = of_irq_parse_one(core->dev.of_node, num, out_irq);
  142. if (!rc)
  143. return rc;
  144. }
  145. out_irq->np = parent->of_node;
  146. out_irq->args_count = 1;
  147. out_irq->args[0] = num;
  148. laddr[0] = cpu_to_be32(core->addr);
  149. return of_irq_parse_raw(laddr, out_irq);
  150. }
  151. static unsigned int bcma_of_get_irq(struct device *parent,
  152. struct bcma_device *core, int num)
  153. {
  154. struct of_phandle_args out_irq;
  155. int ret;
  156. if (!IS_ENABLED(CONFIG_OF_IRQ) || !parent->of_node)
  157. return 0;
  158. ret = bcma_of_irq_parse(parent, core, &out_irq, num);
  159. if (ret) {
  160. bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n",
  161. ret);
  162. return 0;
  163. }
  164. return irq_create_of_mapping(&out_irq);
  165. }
  166. static void bcma_of_fill_device(struct device *parent,
  167. struct bcma_device *core)
  168. {
  169. struct device_node *node;
  170. node = bcma_of_find_child_device(parent, core);
  171. if (node)
  172. core->dev.of_node = node;
  173. core->irq = bcma_of_get_irq(parent, core, 0);
  174. of_dma_configure(&core->dev, node, false);
  175. }
  176. unsigned int bcma_core_irq(struct bcma_device *core, int num)
  177. {
  178. struct bcma_bus *bus = core->bus;
  179. unsigned int mips_irq;
  180. switch (bus->hosttype) {
  181. case BCMA_HOSTTYPE_PCI:
  182. return bus->host_pci->irq;
  183. case BCMA_HOSTTYPE_SOC:
  184. if (bus->drv_mips.core && num == 0) {
  185. mips_irq = bcma_core_mips_irq(core);
  186. return mips_irq <= 4 ? mips_irq + 2 : 0;
  187. }
  188. if (bus->dev)
  189. return bcma_of_get_irq(bus->dev, core, num);
  190. return 0;
  191. case BCMA_HOSTTYPE_SDIO:
  192. return 0;
  193. }
  194. return 0;
  195. }
  196. EXPORT_SYMBOL(bcma_core_irq);
  197. void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
  198. {
  199. device_initialize(&core->dev);
  200. core->dev.release = bcma_release_core_dev;
  201. core->dev.bus = &bcma_bus_type;
  202. dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
  203. core->dev.parent = bus->dev;
  204. if (bus->dev)
  205. bcma_of_fill_device(bus->dev, core);
  206. switch (bus->hosttype) {
  207. case BCMA_HOSTTYPE_PCI:
  208. core->dma_dev = bus->dev;
  209. core->irq = bus->host_pci->irq;
  210. break;
  211. case BCMA_HOSTTYPE_SOC:
  212. if (IS_ENABLED(CONFIG_OF) && bus->dev) {
  213. core->dma_dev = bus->dev;
  214. } else {
  215. core->dev.dma_mask = &core->dev.coherent_dma_mask;
  216. core->dma_dev = &core->dev;
  217. }
  218. break;
  219. case BCMA_HOSTTYPE_SDIO:
  220. break;
  221. }
  222. }
  223. void bcma_init_bus(struct bcma_bus *bus)
  224. {
  225. mutex_lock(&bcma_buses_mutex);
  226. bus->num = bcma_bus_next_num++;
  227. mutex_unlock(&bcma_buses_mutex);
  228. INIT_LIST_HEAD(&bus->cores);
  229. bus->nr_cores = 0;
  230. bcma_detect_chip(bus);
  231. }
  232. static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
  233. {
  234. int err;
  235. err = device_add(&core->dev);
  236. if (err) {
  237. bcma_err(bus, "Could not register dev for core 0x%03X\n",
  238. core->id.id);
  239. return;
  240. }
  241. core->dev_registered = true;
  242. }
  243. static int bcma_register_devices(struct bcma_bus *bus)
  244. {
  245. struct bcma_device *core;
  246. int err;
  247. list_for_each_entry(core, &bus->cores, list) {
  248. /* We support that core ourselves */
  249. switch (core->id.id) {
  250. case BCMA_CORE_4706_CHIPCOMMON:
  251. case BCMA_CORE_CHIPCOMMON:
  252. case BCMA_CORE_NS_CHIPCOMMON_B:
  253. case BCMA_CORE_PCI:
  254. case BCMA_CORE_PCIE:
  255. case BCMA_CORE_PCIE2:
  256. case BCMA_CORE_MIPS_74K:
  257. case BCMA_CORE_4706_MAC_GBIT_COMMON:
  258. continue;
  259. }
  260. /* Early cores were already registered */
  261. if (bcma_is_core_needed_early(core->id.id))
  262. continue;
  263. /* Only first GMAC core on BCM4706 is connected and working */
  264. if (core->id.id == BCMA_CORE_4706_MAC_GBIT &&
  265. core->core_unit > 0)
  266. continue;
  267. bcma_register_core(bus, core);
  268. }
  269. #ifdef CONFIG_BCMA_PFLASH
  270. if (bus->drv_cc.pflash.present) {
  271. err = platform_device_register(&bcma_pflash_dev);
  272. if (err)
  273. bcma_err(bus, "Error registering parallel flash\n");
  274. }
  275. #endif
  276. #ifdef CONFIG_BCMA_SFLASH
  277. if (bus->drv_cc.sflash.present) {
  278. err = platform_device_register(&bcma_sflash_dev);
  279. if (err)
  280. bcma_err(bus, "Error registering serial flash\n");
  281. }
  282. #endif
  283. #ifdef CONFIG_BCMA_NFLASH
  284. if (bus->drv_cc.nflash.present) {
  285. err = platform_device_register(&bcma_nflash_dev);
  286. if (err)
  287. bcma_err(bus, "Error registering NAND flash\n");
  288. }
  289. #endif
  290. err = bcma_gpio_init(&bus->drv_cc);
  291. if (err == -ENOTSUPP)
  292. bcma_debug(bus, "GPIO driver not activated\n");
  293. else if (err)
  294. bcma_err(bus, "Error registering GPIO driver: %i\n", err);
  295. if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
  296. err = bcma_chipco_watchdog_register(&bus->drv_cc);
  297. if (err)
  298. bcma_err(bus, "Error registering watchdog driver\n");
  299. }
  300. return 0;
  301. }
  302. void bcma_unregister_cores(struct bcma_bus *bus)
  303. {
  304. struct bcma_device *core, *tmp;
  305. list_for_each_entry_safe(core, tmp, &bus->cores, list) {
  306. if (!core->dev_registered)
  307. continue;
  308. list_del(&core->list);
  309. device_unregister(&core->dev);
  310. }
  311. if (bus->hosttype == BCMA_HOSTTYPE_SOC)
  312. platform_device_unregister(bus->drv_cc.watchdog);
  313. /* Now no one uses internally-handled cores, we can free them */
  314. list_for_each_entry_safe(core, tmp, &bus->cores, list) {
  315. list_del(&core->list);
  316. put_device(&core->dev);
  317. }
  318. }
  319. int bcma_bus_register(struct bcma_bus *bus)
  320. {
  321. int err;
  322. struct bcma_device *core;
  323. /* Scan for devices (cores) */
  324. err = bcma_bus_scan(bus);
  325. if (err) {
  326. bcma_err(bus, "Failed to scan: %d\n", err);
  327. return err;
  328. }
  329. /* Early init CC core */
  330. core = bcma_find_core(bus, bcma_cc_core_id(bus));
  331. if (core) {
  332. bus->drv_cc.core = core;
  333. bcma_core_chipcommon_early_init(&bus->drv_cc);
  334. }
  335. /* Early init PCIE core */
  336. core = bcma_find_core(bus, BCMA_CORE_PCIE);
  337. if (core) {
  338. bus->drv_pci[0].core = core;
  339. bcma_core_pci_early_init(&bus->drv_pci[0]);
  340. }
  341. if (bus->dev)
  342. of_platform_default_populate(bus->dev->of_node, NULL, bus->dev);
  343. /* Cores providing flash access go before SPROM init */
  344. list_for_each_entry(core, &bus->cores, list) {
  345. if (bcma_is_core_needed_early(core->id.id))
  346. bcma_register_core(bus, core);
  347. }
  348. /* Try to get SPROM */
  349. err = bcma_sprom_get(bus);
  350. if (err == -ENOENT) {
  351. bcma_err(bus, "No SPROM available\n");
  352. } else if (err)
  353. bcma_err(bus, "Failed to get SPROM: %d\n", err);
  354. /* Init CC core */
  355. core = bcma_find_core(bus, bcma_cc_core_id(bus));
  356. if (core) {
  357. bus->drv_cc.core = core;
  358. bcma_core_chipcommon_init(&bus->drv_cc);
  359. }
  360. /* Init CC core */
  361. core = bcma_find_core(bus, BCMA_CORE_NS_CHIPCOMMON_B);
  362. if (core) {
  363. bus->drv_cc_b.core = core;
  364. bcma_core_chipcommon_b_init(&bus->drv_cc_b);
  365. }
  366. /* Init MIPS core */
  367. core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
  368. if (core) {
  369. bus->drv_mips.core = core;
  370. bcma_core_mips_init(&bus->drv_mips);
  371. }
  372. /* Init PCIE core */
  373. core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);
  374. if (core) {
  375. bus->drv_pci[0].core = core;
  376. bcma_core_pci_init(&bus->drv_pci[0]);
  377. }
  378. /* Init PCIE core */
  379. core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1);
  380. if (core) {
  381. bus->drv_pci[1].core = core;
  382. bcma_core_pci_init(&bus->drv_pci[1]);
  383. }
  384. /* Init PCIe Gen 2 core */
  385. core = bcma_find_core_unit(bus, BCMA_CORE_PCIE2, 0);
  386. if (core) {
  387. bus->drv_pcie2.core = core;
  388. bcma_core_pcie2_init(&bus->drv_pcie2);
  389. }
  390. /* Init GBIT MAC COMMON core */
  391. core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
  392. if (core) {
  393. bus->drv_gmac_cmn.core = core;
  394. bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);
  395. }
  396. /* Register found cores */
  397. bcma_register_devices(bus);
  398. bcma_info(bus, "Bus registered\n");
  399. return 0;
  400. }
  401. void bcma_bus_unregister(struct bcma_bus *bus)
  402. {
  403. int err;
  404. err = bcma_gpio_unregister(&bus->drv_cc);
  405. if (err == -EBUSY)
  406. bcma_err(bus, "Some GPIOs are still in use.\n");
  407. else if (err)
  408. bcma_err(bus, "Can not unregister GPIO driver: %i\n", err);
  409. bcma_core_chipcommon_b_free(&bus->drv_cc_b);
  410. bcma_unregister_cores(bus);
  411. }
  412. /*
  413. * This is a special version of bus registration function designed for SoCs.
  414. * It scans bus and performs basic initialization of main cores only.
  415. * Please note it requires memory allocation, however it won't try to sleep.
  416. */
  417. int __init bcma_bus_early_register(struct bcma_bus *bus)
  418. {
  419. int err;
  420. struct bcma_device *core;
  421. /* Scan for devices (cores) */
  422. err = bcma_bus_scan(bus);
  423. if (err) {
  424. bcma_err(bus, "Failed to scan bus: %d\n", err);
  425. return -1;
  426. }
  427. /* Early init CC core */
  428. core = bcma_find_core(bus, bcma_cc_core_id(bus));
  429. if (core) {
  430. bus->drv_cc.core = core;
  431. bcma_core_chipcommon_early_init(&bus->drv_cc);
  432. }
  433. /* Early init MIPS core */
  434. core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
  435. if (core) {
  436. bus->drv_mips.core = core;
  437. bcma_core_mips_early_init(&bus->drv_mips);
  438. }
  439. bcma_info(bus, "Early bus registered\n");
  440. return 0;
  441. }
  442. #ifdef CONFIG_PM
  443. int bcma_bus_suspend(struct bcma_bus *bus)
  444. {
  445. struct bcma_device *core;
  446. list_for_each_entry(core, &bus->cores, list) {
  447. struct device_driver *drv = core->dev.driver;
  448. if (drv) {
  449. struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
  450. if (adrv->suspend)
  451. adrv->suspend(core);
  452. }
  453. }
  454. return 0;
  455. }
  456. int bcma_bus_resume(struct bcma_bus *bus)
  457. {
  458. struct bcma_device *core;
  459. /* Init CC core */
  460. if (bus->drv_cc.core) {
  461. bus->drv_cc.setup_done = false;
  462. bcma_core_chipcommon_init(&bus->drv_cc);
  463. }
  464. list_for_each_entry(core, &bus->cores, list) {
  465. struct device_driver *drv = core->dev.driver;
  466. if (drv) {
  467. struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
  468. if (adrv->resume)
  469. adrv->resume(core);
  470. }
  471. }
  472. return 0;
  473. }
  474. #endif
  475. int __bcma_driver_register(struct bcma_driver *drv, struct module *owner)
  476. {
  477. drv->drv.name = drv->name;
  478. drv->drv.bus = &bcma_bus_type;
  479. drv->drv.owner = owner;
  480. return driver_register(&drv->drv);
  481. }
  482. EXPORT_SYMBOL_GPL(__bcma_driver_register);
  483. void bcma_driver_unregister(struct bcma_driver *drv)
  484. {
  485. driver_unregister(&drv->drv);
  486. }
  487. EXPORT_SYMBOL_GPL(bcma_driver_unregister);
  488. static int bcma_bus_match(struct device *dev, struct device_driver *drv)
  489. {
  490. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  491. struct bcma_driver *adrv = container_of(drv, struct bcma_driver, drv);
  492. const struct bcma_device_id *cid = &core->id;
  493. const struct bcma_device_id *did;
  494. for (did = adrv->id_table; did->manuf || did->id || did->rev; did++) {
  495. if ((did->manuf == cid->manuf || did->manuf == BCMA_ANY_MANUF) &&
  496. (did->id == cid->id || did->id == BCMA_ANY_ID) &&
  497. (did->rev == cid->rev || did->rev == BCMA_ANY_REV) &&
  498. (did->class == cid->class || did->class == BCMA_ANY_CLASS))
  499. return 1;
  500. }
  501. return 0;
  502. }
  503. static int bcma_device_probe(struct device *dev)
  504. {
  505. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  506. struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver,
  507. drv);
  508. int err = 0;
  509. get_device(dev);
  510. if (adrv->probe)
  511. err = adrv->probe(core);
  512. if (err)
  513. put_device(dev);
  514. return err;
  515. }
  516. static void bcma_device_remove(struct device *dev)
  517. {
  518. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  519. struct bcma_driver *adrv = container_of(dev->driver, struct bcma_driver,
  520. drv);
  521. if (adrv->remove)
  522. adrv->remove(core);
  523. put_device(dev);
  524. }
  525. static int bcma_device_uevent(struct device *dev, struct kobj_uevent_env *env)
  526. {
  527. struct bcma_device *core = container_of(dev, struct bcma_device, dev);
  528. return add_uevent_var(env,
  529. "MODALIAS=bcma:m%04Xid%04Xrev%02Xcl%02X",
  530. core->id.manuf, core->id.id,
  531. core->id.rev, core->id.class);
  532. }
  533. static unsigned int bcma_bus_registered;
  534. /*
  535. * If built-in, bus has to be registered early, before any driver calls
  536. * bcma_driver_register.
  537. * Otherwise registering driver would trigger BUG in driver_register.
  538. */
  539. static int __init bcma_init_bus_register(void)
  540. {
  541. int err;
  542. if (bcma_bus_registered)
  543. return 0;
  544. err = bus_register(&bcma_bus_type);
  545. if (!err)
  546. bcma_bus_registered = 1;
  547. return err;
  548. }
  549. #ifndef MODULE
  550. fs_initcall(bcma_init_bus_register);
  551. #endif
  552. /* Main initialization has to be done with SPI/mtd/NAND/SPROM available */
  553. static int __init bcma_modinit(void)
  554. {
  555. int err;
  556. err = bcma_init_bus_register();
  557. if (err)
  558. return err;
  559. err = bcma_host_soc_register_driver();
  560. if (err) {
  561. pr_err("SoC host initialization failed\n");
  562. err = 0;
  563. }
  564. #ifdef CONFIG_BCMA_HOST_PCI
  565. err = bcma_host_pci_init();
  566. if (err) {
  567. pr_err("PCI host initialization failed\n");
  568. err = 0;
  569. }
  570. #endif
  571. return err;
  572. }
  573. module_init(bcma_modinit);
  574. static void __exit bcma_modexit(void)
  575. {
  576. #ifdef CONFIG_BCMA_HOST_PCI
  577. bcma_host_pci_exit();
  578. #endif
  579. bcma_host_soc_unregister_driver();
  580. bus_unregister(&bcma_bus_type);
  581. }
  582. module_exit(bcma_modexit)