main.c 16 KB

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