scan.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. /*
  2. * Broadcom specific AMBA
  3. * Bus scanning
  4. *
  5. * Licensed under the GNU/GPL. See COPYING for details.
  6. */
  7. #include "scan.h"
  8. #include "bcma_private.h"
  9. #include <linux/bcma/bcma.h>
  10. #include <linux/bcma/bcma_regs.h>
  11. #include <linux/pci.h>
  12. #include <linux/io.h>
  13. #include <linux/dma-mapping.h>
  14. #include <linux/slab.h>
  15. struct bcma_device_id_name {
  16. u16 id;
  17. const char *name;
  18. };
  19. static const struct bcma_device_id_name bcma_arm_device_names[] = {
  20. { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
  21. { BCMA_CORE_ARM_1176, "ARM 1176" },
  22. { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
  23. { BCMA_CORE_ARM_CM3, "ARM CM3" },
  24. };
  25. static const struct bcma_device_id_name bcma_bcm_device_names[] = {
  26. { BCMA_CORE_OOB_ROUTER, "OOB Router" },
  27. { BCMA_CORE_4706_CHIPCOMMON, "BCM4706 ChipCommon" },
  28. { BCMA_CORE_4706_SOC_RAM, "BCM4706 SOC RAM" },
  29. { BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" },
  30. { BCMA_CORE_AMEMC, "AMEMC (DDR)" },
  31. { BCMA_CORE_ALTA, "ALTA (I2S)" },
  32. { BCMA_CORE_INVALID, "Invalid" },
  33. { BCMA_CORE_CHIPCOMMON, "ChipCommon" },
  34. { BCMA_CORE_ILINE20, "ILine 20" },
  35. { BCMA_CORE_SRAM, "SRAM" },
  36. { BCMA_CORE_SDRAM, "SDRAM" },
  37. { BCMA_CORE_PCI, "PCI" },
  38. { BCMA_CORE_ETHERNET, "Fast Ethernet" },
  39. { BCMA_CORE_V90, "V90" },
  40. { BCMA_CORE_USB11_HOSTDEV, "USB 1.1 Hostdev" },
  41. { BCMA_CORE_ADSL, "ADSL" },
  42. { BCMA_CORE_ILINE100, "ILine 100" },
  43. { BCMA_CORE_IPSEC, "IPSEC" },
  44. { BCMA_CORE_UTOPIA, "UTOPIA" },
  45. { BCMA_CORE_PCMCIA, "PCMCIA" },
  46. { BCMA_CORE_INTERNAL_MEM, "Internal Memory" },
  47. { BCMA_CORE_MEMC_SDRAM, "MEMC SDRAM" },
  48. { BCMA_CORE_OFDM, "OFDM" },
  49. { BCMA_CORE_EXTIF, "EXTIF" },
  50. { BCMA_CORE_80211, "IEEE 802.11" },
  51. { BCMA_CORE_PHY_A, "PHY A" },
  52. { BCMA_CORE_PHY_B, "PHY B" },
  53. { BCMA_CORE_PHY_G, "PHY G" },
  54. { BCMA_CORE_USB11_HOST, "USB 1.1 Host" },
  55. { BCMA_CORE_USB11_DEV, "USB 1.1 Device" },
  56. { BCMA_CORE_USB20_HOST, "USB 2.0 Host" },
  57. { BCMA_CORE_USB20_DEV, "USB 2.0 Device" },
  58. { BCMA_CORE_SDIO_HOST, "SDIO Host" },
  59. { BCMA_CORE_ROBOSWITCH, "Roboswitch" },
  60. { BCMA_CORE_PARA_ATA, "PATA" },
  61. { BCMA_CORE_SATA_XORDMA, "SATA XOR-DMA" },
  62. { BCMA_CORE_ETHERNET_GBIT, "GBit Ethernet" },
  63. { BCMA_CORE_PCIE, "PCIe" },
  64. { BCMA_CORE_PHY_N, "PHY N" },
  65. { BCMA_CORE_SRAM_CTL, "SRAM Controller" },
  66. { BCMA_CORE_MINI_MACPHY, "Mini MACPHY" },
  67. { BCMA_CORE_PHY_LP, "PHY LP" },
  68. { BCMA_CORE_PMU, "PMU" },
  69. { BCMA_CORE_PHY_SSN, "PHY SSN" },
  70. { BCMA_CORE_SDIO_DEV, "SDIO Device" },
  71. { BCMA_CORE_PHY_HT, "PHY HT" },
  72. { BCMA_CORE_MAC_GBIT, "GBit MAC" },
  73. { BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
  74. { BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
  75. { BCMA_CORE_OCP_OCP_BRIDGE, "OCP to OCP Bridge" },
  76. { BCMA_CORE_SHARED_COMMON, "Common Shared" },
  77. { BCMA_CORE_OCP_AHB_BRIDGE, "OCP to AHB Bridge" },
  78. { BCMA_CORE_SPI_HOST, "SPI Host" },
  79. { BCMA_CORE_I2S, "I2S" },
  80. { BCMA_CORE_SDR_DDR1_MEM_CTL, "SDR/DDR1 Memory Controller" },
  81. { BCMA_CORE_SHIM, "SHIM" },
  82. { BCMA_CORE_PCIE2, "PCIe Gen2" },
  83. { BCMA_CORE_ARM_CR4, "ARM CR4" },
  84. { BCMA_CORE_DEFAULT, "Default" },
  85. };
  86. static const struct bcma_device_id_name bcma_mips_device_names[] = {
  87. { BCMA_CORE_MIPS, "MIPS" },
  88. { BCMA_CORE_MIPS_3302, "MIPS 3302" },
  89. { BCMA_CORE_MIPS_74K, "MIPS 74K" },
  90. };
  91. static const char *bcma_device_name(const struct bcma_device_id *id)
  92. {
  93. const struct bcma_device_id_name *names;
  94. int size, i;
  95. /* search manufacturer specific names */
  96. switch (id->manuf) {
  97. case BCMA_MANUF_ARM:
  98. names = bcma_arm_device_names;
  99. size = ARRAY_SIZE(bcma_arm_device_names);
  100. break;
  101. case BCMA_MANUF_BCM:
  102. names = bcma_bcm_device_names;
  103. size = ARRAY_SIZE(bcma_bcm_device_names);
  104. break;
  105. case BCMA_MANUF_MIPS:
  106. names = bcma_mips_device_names;
  107. size = ARRAY_SIZE(bcma_mips_device_names);
  108. break;
  109. default:
  110. return "UNKNOWN";
  111. }
  112. for (i = 0; i < size; i++) {
  113. if (names[i].id == id->id)
  114. return names[i].name;
  115. }
  116. return "UNKNOWN";
  117. }
  118. static u32 bcma_scan_read32(struct bcma_bus *bus, u8 current_coreidx,
  119. u16 offset)
  120. {
  121. return readl(bus->mmio + offset);
  122. }
  123. static void bcma_scan_switch_core(struct bcma_bus *bus, u32 addr)
  124. {
  125. if (bus->hosttype == BCMA_HOSTTYPE_PCI)
  126. pci_write_config_dword(bus->host_pci, BCMA_PCI_BAR0_WIN,
  127. addr);
  128. }
  129. static u32 bcma_erom_get_ent(struct bcma_bus *bus, u32 __iomem **eromptr)
  130. {
  131. u32 ent = readl(*eromptr);
  132. (*eromptr)++;
  133. return ent;
  134. }
  135. static void bcma_erom_push_ent(u32 __iomem **eromptr)
  136. {
  137. (*eromptr)--;
  138. }
  139. static s32 bcma_erom_get_ci(struct bcma_bus *bus, u32 __iomem **eromptr)
  140. {
  141. u32 ent = bcma_erom_get_ent(bus, eromptr);
  142. if (!(ent & SCAN_ER_VALID))
  143. return -ENOENT;
  144. if ((ent & SCAN_ER_TAG) != SCAN_ER_TAG_CI)
  145. return -ENOENT;
  146. return ent;
  147. }
  148. static bool bcma_erom_is_end(struct bcma_bus *bus, u32 __iomem **eromptr)
  149. {
  150. u32 ent = bcma_erom_get_ent(bus, eromptr);
  151. bcma_erom_push_ent(eromptr);
  152. return (ent == (SCAN_ER_TAG_END | SCAN_ER_VALID));
  153. }
  154. static bool bcma_erom_is_bridge(struct bcma_bus *bus, u32 __iomem **eromptr)
  155. {
  156. u32 ent = bcma_erom_get_ent(bus, eromptr);
  157. bcma_erom_push_ent(eromptr);
  158. return (((ent & SCAN_ER_VALID)) &&
  159. ((ent & SCAN_ER_TAGX) == SCAN_ER_TAG_ADDR) &&
  160. ((ent & SCAN_ADDR_TYPE) == SCAN_ADDR_TYPE_BRIDGE));
  161. }
  162. static void bcma_erom_skip_component(struct bcma_bus *bus, u32 __iomem **eromptr)
  163. {
  164. u32 ent;
  165. while (1) {
  166. ent = bcma_erom_get_ent(bus, eromptr);
  167. if ((ent & SCAN_ER_VALID) &&
  168. ((ent & SCAN_ER_TAG) == SCAN_ER_TAG_CI))
  169. break;
  170. if (ent == (SCAN_ER_TAG_END | SCAN_ER_VALID))
  171. break;
  172. }
  173. bcma_erom_push_ent(eromptr);
  174. }
  175. static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 __iomem **eromptr)
  176. {
  177. u32 ent = bcma_erom_get_ent(bus, eromptr);
  178. if (!(ent & SCAN_ER_VALID))
  179. return -ENOENT;
  180. if ((ent & SCAN_ER_TAG) != SCAN_ER_TAG_MP)
  181. return -ENOENT;
  182. return ent;
  183. }
  184. static s32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 __iomem **eromptr,
  185. u32 type, u8 port)
  186. {
  187. u32 addrl, addrh, sizel, sizeh = 0;
  188. u32 size;
  189. u32 ent = bcma_erom_get_ent(bus, eromptr);
  190. if ((!(ent & SCAN_ER_VALID)) ||
  191. ((ent & SCAN_ER_TAGX) != SCAN_ER_TAG_ADDR) ||
  192. ((ent & SCAN_ADDR_TYPE) != type) ||
  193. (((ent & SCAN_ADDR_PORT) >> SCAN_ADDR_PORT_SHIFT) != port)) {
  194. bcma_erom_push_ent(eromptr);
  195. return -EINVAL;
  196. }
  197. addrl = ent & SCAN_ADDR_ADDR;
  198. if (ent & SCAN_ADDR_AG32)
  199. addrh = bcma_erom_get_ent(bus, eromptr);
  200. else
  201. addrh = 0;
  202. if ((ent & SCAN_ADDR_SZ) == SCAN_ADDR_SZ_SZD) {
  203. size = bcma_erom_get_ent(bus, eromptr);
  204. sizel = size & SCAN_SIZE_SZ;
  205. if (size & SCAN_SIZE_SG32)
  206. sizeh = bcma_erom_get_ent(bus, eromptr);
  207. } else
  208. sizel = SCAN_ADDR_SZ_BASE <<
  209. ((ent & SCAN_ADDR_SZ) >> SCAN_ADDR_SZ_SHIFT);
  210. return addrl;
  211. }
  212. static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus,
  213. u16 index)
  214. {
  215. struct bcma_device *core;
  216. list_for_each_entry(core, &bus->cores, list) {
  217. if (core->core_index == index)
  218. return core;
  219. }
  220. return NULL;
  221. }
  222. static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid)
  223. {
  224. struct bcma_device *core;
  225. list_for_each_entry_reverse(core, &bus->cores, list) {
  226. if (core->id.id == coreid)
  227. return core;
  228. }
  229. return NULL;
  230. }
  231. static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
  232. struct bcma_device_id *match, int core_num,
  233. struct bcma_device *core)
  234. {
  235. s32 tmp;
  236. u8 i, j;
  237. s32 cia, cib;
  238. u8 ports[2], wrappers[2];
  239. /* get CIs */
  240. cia = bcma_erom_get_ci(bus, eromptr);
  241. if (cia < 0) {
  242. bcma_erom_push_ent(eromptr);
  243. if (bcma_erom_is_end(bus, eromptr))
  244. return -ESPIPE;
  245. return -EILSEQ;
  246. }
  247. cib = bcma_erom_get_ci(bus, eromptr);
  248. if (cib < 0)
  249. return -EILSEQ;
  250. /* parse CIs */
  251. core->id.class = (cia & SCAN_CIA_CLASS) >> SCAN_CIA_CLASS_SHIFT;
  252. core->id.id = (cia & SCAN_CIA_ID) >> SCAN_CIA_ID_SHIFT;
  253. core->id.manuf = (cia & SCAN_CIA_MANUF) >> SCAN_CIA_MANUF_SHIFT;
  254. ports[0] = (cib & SCAN_CIB_NMP) >> SCAN_CIB_NMP_SHIFT;
  255. ports[1] = (cib & SCAN_CIB_NSP) >> SCAN_CIB_NSP_SHIFT;
  256. wrappers[0] = (cib & SCAN_CIB_NMW) >> SCAN_CIB_NMW_SHIFT;
  257. wrappers[1] = (cib & SCAN_CIB_NSW) >> SCAN_CIB_NSW_SHIFT;
  258. core->id.rev = (cib & SCAN_CIB_REV) >> SCAN_CIB_REV_SHIFT;
  259. if (((core->id.manuf == BCMA_MANUF_ARM) &&
  260. (core->id.id == 0xFFF)) ||
  261. (ports[1] == 0)) {
  262. bcma_erom_skip_component(bus, eromptr);
  263. return -ENXIO;
  264. }
  265. /* check if component is a core at all */
  266. if (wrappers[0] + wrappers[1] == 0) {
  267. /* Some specific cores don't need wrappers */
  268. switch (core->id.id) {
  269. case BCMA_CORE_4706_MAC_GBIT_COMMON:
  270. /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
  271. break;
  272. default:
  273. bcma_erom_skip_component(bus, eromptr);
  274. return -ENXIO;
  275. }
  276. }
  277. if (bcma_erom_is_bridge(bus, eromptr)) {
  278. bcma_erom_skip_component(bus, eromptr);
  279. return -ENXIO;
  280. }
  281. if (bcma_find_core_by_index(bus, core_num)) {
  282. bcma_erom_skip_component(bus, eromptr);
  283. return -ENODEV;
  284. }
  285. if (match && ((match->manuf != BCMA_ANY_MANUF &&
  286. match->manuf != core->id.manuf) ||
  287. (match->id != BCMA_ANY_ID && match->id != core->id.id) ||
  288. (match->rev != BCMA_ANY_REV && match->rev != core->id.rev) ||
  289. (match->class != BCMA_ANY_CLASS && match->class != core->id.class)
  290. )) {
  291. bcma_erom_skip_component(bus, eromptr);
  292. return -ENODEV;
  293. }
  294. /* get & parse master ports */
  295. for (i = 0; i < ports[0]; i++) {
  296. s32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr);
  297. if (mst_port_d < 0)
  298. return -EILSEQ;
  299. }
  300. /* First Slave Address Descriptor should be port 0:
  301. * the main register space for the core
  302. */
  303. tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0);
  304. if (tmp <= 0) {
  305. /* Try again to see if it is a bridge */
  306. tmp = bcma_erom_get_addr_desc(bus, eromptr,
  307. SCAN_ADDR_TYPE_BRIDGE, 0);
  308. if (tmp <= 0) {
  309. return -EILSEQ;
  310. } else {
  311. bcma_info(bus, "Bridge found\n");
  312. return -ENXIO;
  313. }
  314. }
  315. core->addr = tmp;
  316. /* get & parse slave ports */
  317. for (i = 0; i < ports[1]; i++) {
  318. for (j = 0; ; j++) {
  319. tmp = bcma_erom_get_addr_desc(bus, eromptr,
  320. SCAN_ADDR_TYPE_SLAVE, i);
  321. if (tmp < 0) {
  322. /* no more entries for port _i_ */
  323. /* pr_debug("erom: slave port %d "
  324. * "has %d descriptors\n", i, j); */
  325. break;
  326. } else {
  327. if (i == 0 && j == 0)
  328. core->addr1 = tmp;
  329. }
  330. }
  331. }
  332. /* get & parse master wrappers */
  333. for (i = 0; i < wrappers[0]; i++) {
  334. for (j = 0; ; j++) {
  335. tmp = bcma_erom_get_addr_desc(bus, eromptr,
  336. SCAN_ADDR_TYPE_MWRAP, i);
  337. if (tmp < 0) {
  338. /* no more entries for port _i_ */
  339. /* pr_debug("erom: master wrapper %d "
  340. * "has %d descriptors\n", i, j); */
  341. break;
  342. } else {
  343. if (i == 0 && j == 0)
  344. core->wrap = tmp;
  345. }
  346. }
  347. }
  348. /* get & parse slave wrappers */
  349. for (i = 0; i < wrappers[1]; i++) {
  350. u8 hack = (ports[1] == 1) ? 0 : 1;
  351. for (j = 0; ; j++) {
  352. tmp = bcma_erom_get_addr_desc(bus, eromptr,
  353. SCAN_ADDR_TYPE_SWRAP, i + hack);
  354. if (tmp < 0) {
  355. /* no more entries for port _i_ */
  356. /* pr_debug("erom: master wrapper %d "
  357. * has %d descriptors\n", i, j); */
  358. break;
  359. } else {
  360. if (wrappers[0] == 0 && !i && !j)
  361. core->wrap = tmp;
  362. }
  363. }
  364. }
  365. if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
  366. core->io_addr = ioremap_nocache(core->addr, BCMA_CORE_SIZE);
  367. if (!core->io_addr)
  368. return -ENOMEM;
  369. core->io_wrap = ioremap_nocache(core->wrap, BCMA_CORE_SIZE);
  370. if (!core->io_wrap) {
  371. iounmap(core->io_addr);
  372. return -ENOMEM;
  373. }
  374. }
  375. return 0;
  376. }
  377. void bcma_init_bus(struct bcma_bus *bus)
  378. {
  379. s32 tmp;
  380. struct bcma_chipinfo *chipinfo = &(bus->chipinfo);
  381. if (bus->init_done)
  382. return;
  383. INIT_LIST_HEAD(&bus->cores);
  384. bus->nr_cores = 0;
  385. bcma_scan_switch_core(bus, BCMA_ADDR_BASE);
  386. tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID);
  387. chipinfo->id = (tmp & BCMA_CC_ID_ID) >> BCMA_CC_ID_ID_SHIFT;
  388. chipinfo->rev = (tmp & BCMA_CC_ID_REV) >> BCMA_CC_ID_REV_SHIFT;
  389. chipinfo->pkg = (tmp & BCMA_CC_ID_PKG) >> BCMA_CC_ID_PKG_SHIFT;
  390. bcma_info(bus, "Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n",
  391. chipinfo->id, chipinfo->rev, chipinfo->pkg);
  392. bus->init_done = true;
  393. }
  394. int bcma_bus_scan(struct bcma_bus *bus)
  395. {
  396. u32 erombase;
  397. u32 __iomem *eromptr, *eromend;
  398. int err, core_num = 0;
  399. bcma_init_bus(bus);
  400. erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
  401. if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
  402. eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
  403. if (!eromptr)
  404. return -ENOMEM;
  405. } else {
  406. eromptr = bus->mmio;
  407. }
  408. eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32);
  409. bcma_scan_switch_core(bus, erombase);
  410. while (eromptr < eromend) {
  411. struct bcma_device *other_core;
  412. struct bcma_device *core = kzalloc(sizeof(*core), GFP_KERNEL);
  413. if (!core) {
  414. err = -ENOMEM;
  415. goto out;
  416. }
  417. INIT_LIST_HEAD(&core->list);
  418. core->bus = bus;
  419. err = bcma_get_next_core(bus, &eromptr, NULL, core_num, core);
  420. if (err < 0) {
  421. kfree(core);
  422. if (err == -ENODEV) {
  423. core_num++;
  424. continue;
  425. } else if (err == -ENXIO) {
  426. continue;
  427. } else if (err == -ESPIPE) {
  428. break;
  429. }
  430. goto out;
  431. }
  432. core->core_index = core_num++;
  433. bus->nr_cores++;
  434. other_core = bcma_find_core_reverse(bus, core->id.id);
  435. core->core_unit = (other_core == NULL) ? 0 : other_core->core_unit + 1;
  436. bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
  437. core->core_index, bcma_device_name(&core->id),
  438. core->id.manuf, core->id.id, core->id.rev,
  439. core->id.class);
  440. list_add_tail(&core->list, &bus->cores);
  441. }
  442. err = 0;
  443. out:
  444. if (bus->hosttype == BCMA_HOSTTYPE_SOC)
  445. iounmap(eromptr);
  446. return err;
  447. }
  448. int __init bcma_bus_scan_early(struct bcma_bus *bus,
  449. struct bcma_device_id *match,
  450. struct bcma_device *core)
  451. {
  452. u32 erombase;
  453. u32 __iomem *eromptr, *eromend;
  454. int err = -ENODEV;
  455. int core_num = 0;
  456. erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM);
  457. if (bus->hosttype == BCMA_HOSTTYPE_SOC) {
  458. eromptr = ioremap_nocache(erombase, BCMA_CORE_SIZE);
  459. if (!eromptr)
  460. return -ENOMEM;
  461. } else {
  462. eromptr = bus->mmio;
  463. }
  464. eromend = eromptr + BCMA_CORE_SIZE / sizeof(u32);
  465. bcma_scan_switch_core(bus, erombase);
  466. while (eromptr < eromend) {
  467. memset(core, 0, sizeof(*core));
  468. INIT_LIST_HEAD(&core->list);
  469. core->bus = bus;
  470. err = bcma_get_next_core(bus, &eromptr, match, core_num, core);
  471. if (err == -ENODEV) {
  472. core_num++;
  473. continue;
  474. } else if (err == -ENXIO)
  475. continue;
  476. else if (err == -ESPIPE)
  477. break;
  478. else if (err < 0)
  479. goto out;
  480. core->core_index = core_num++;
  481. bus->nr_cores++;
  482. bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n",
  483. core->core_index, bcma_device_name(&core->id),
  484. core->id.manuf, core->id.id, core->id.rev,
  485. core->id.class);
  486. list_add_tail(&core->list, &bus->cores);
  487. err = 0;
  488. break;
  489. }
  490. out:
  491. if (bus->hosttype == BCMA_HOSTTYPE_SOC)
  492. iounmap(eromptr);
  493. return err;
  494. }