board_bcm963xx.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
  7. * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
  8. */
  9. #include <linux/init.h>
  10. #include <linux/kernel.h>
  11. #include <linux/string.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/ssb/ssb.h>
  14. #include <asm/addrspace.h>
  15. #include <bcm63xx_board.h>
  16. #include <bcm63xx_cpu.h>
  17. #include <bcm63xx_dev_uart.h>
  18. #include <bcm63xx_regs.h>
  19. #include <bcm63xx_io.h>
  20. #include <bcm63xx_dev_pci.h>
  21. #include <bcm63xx_dev_enet.h>
  22. #include <bcm63xx_dev_dsp.h>
  23. #include <bcm63xx_dev_flash.h>
  24. #include <bcm63xx_dev_pcmcia.h>
  25. #include <bcm63xx_dev_spi.h>
  26. #include <board_bcm963xx.h>
  27. #define PFX "board_bcm963xx: "
  28. static struct bcm963xx_nvram nvram;
  29. static unsigned int mac_addr_used;
  30. static struct board_info board;
  31. /*
  32. * known 6338 boards
  33. */
  34. #ifdef CONFIG_BCM63XX_CPU_6338
  35. static struct board_info __initdata board_96338gw = {
  36. .name = "96338GW",
  37. .expected_cpu_id = 0x6338,
  38. .has_uart0 = 1,
  39. .has_enet0 = 1,
  40. .enet0 = {
  41. .force_speed_100 = 1,
  42. .force_duplex_full = 1,
  43. },
  44. .has_ohci0 = 1,
  45. .leds = {
  46. {
  47. .name = "adsl",
  48. .gpio = 3,
  49. .active_low = 1,
  50. },
  51. {
  52. .name = "ses",
  53. .gpio = 5,
  54. .active_low = 1,
  55. },
  56. {
  57. .name = "ppp-fail",
  58. .gpio = 4,
  59. .active_low = 1,
  60. },
  61. {
  62. .name = "power",
  63. .gpio = 0,
  64. .active_low = 1,
  65. .default_trigger = "default-on",
  66. },
  67. {
  68. .name = "stop",
  69. .gpio = 1,
  70. .active_low = 1,
  71. }
  72. },
  73. };
  74. static struct board_info __initdata board_96338w = {
  75. .name = "96338W",
  76. .expected_cpu_id = 0x6338,
  77. .has_uart0 = 1,
  78. .has_enet0 = 1,
  79. .enet0 = {
  80. .force_speed_100 = 1,
  81. .force_duplex_full = 1,
  82. },
  83. .leds = {
  84. {
  85. .name = "adsl",
  86. .gpio = 3,
  87. .active_low = 1,
  88. },
  89. {
  90. .name = "ses",
  91. .gpio = 5,
  92. .active_low = 1,
  93. },
  94. {
  95. .name = "ppp-fail",
  96. .gpio = 4,
  97. .active_low = 1,
  98. },
  99. {
  100. .name = "power",
  101. .gpio = 0,
  102. .active_low = 1,
  103. .default_trigger = "default-on",
  104. },
  105. {
  106. .name = "stop",
  107. .gpio = 1,
  108. .active_low = 1,
  109. },
  110. },
  111. };
  112. #endif
  113. /*
  114. * known 6345 boards
  115. */
  116. #ifdef CONFIG_BCM63XX_CPU_6345
  117. static struct board_info __initdata board_96345gw2 = {
  118. .name = "96345GW2",
  119. .expected_cpu_id = 0x6345,
  120. .has_uart0 = 1,
  121. };
  122. #endif
  123. /*
  124. * known 6348 boards
  125. */
  126. #ifdef CONFIG_BCM63XX_CPU_6348
  127. static struct board_info __initdata board_96348r = {
  128. .name = "96348R",
  129. .expected_cpu_id = 0x6348,
  130. .has_uart0 = 1,
  131. .has_enet0 = 1,
  132. .has_pci = 1,
  133. .enet0 = {
  134. .has_phy = 1,
  135. .use_internal_phy = 1,
  136. },
  137. .leds = {
  138. {
  139. .name = "adsl-fail",
  140. .gpio = 2,
  141. .active_low = 1,
  142. },
  143. {
  144. .name = "ppp",
  145. .gpio = 3,
  146. .active_low = 1,
  147. },
  148. {
  149. .name = "ppp-fail",
  150. .gpio = 4,
  151. .active_low = 1,
  152. },
  153. {
  154. .name = "power",
  155. .gpio = 0,
  156. .active_low = 1,
  157. .default_trigger = "default-on",
  158. },
  159. {
  160. .name = "stop",
  161. .gpio = 1,
  162. .active_low = 1,
  163. },
  164. },
  165. };
  166. static struct board_info __initdata board_96348gw_10 = {
  167. .name = "96348GW-10",
  168. .expected_cpu_id = 0x6348,
  169. .has_uart0 = 1,
  170. .has_enet0 = 1,
  171. .has_enet1 = 1,
  172. .has_pci = 1,
  173. .enet0 = {
  174. .has_phy = 1,
  175. .use_internal_phy = 1,
  176. },
  177. .enet1 = {
  178. .force_speed_100 = 1,
  179. .force_duplex_full = 1,
  180. },
  181. .has_ohci0 = 1,
  182. .has_pccard = 1,
  183. .has_ehci0 = 1,
  184. .has_dsp = 1,
  185. .dsp = {
  186. .gpio_rst = 6,
  187. .gpio_int = 34,
  188. .cs = 2,
  189. .ext_irq = 2,
  190. },
  191. .leds = {
  192. {
  193. .name = "adsl-fail",
  194. .gpio = 2,
  195. .active_low = 1,
  196. },
  197. {
  198. .name = "ppp",
  199. .gpio = 3,
  200. .active_low = 1,
  201. },
  202. {
  203. .name = "ppp-fail",
  204. .gpio = 4,
  205. .active_low = 1,
  206. },
  207. {
  208. .name = "power",
  209. .gpio = 0,
  210. .active_low = 1,
  211. .default_trigger = "default-on",
  212. },
  213. {
  214. .name = "stop",
  215. .gpio = 1,
  216. .active_low = 1,
  217. },
  218. },
  219. };
  220. static struct board_info __initdata board_96348gw_11 = {
  221. .name = "96348GW-11",
  222. .expected_cpu_id = 0x6348,
  223. .has_uart0 = 1,
  224. .has_enet0 = 1,
  225. .has_enet1 = 1,
  226. .has_pci = 1,
  227. .enet0 = {
  228. .has_phy = 1,
  229. .use_internal_phy = 1,
  230. },
  231. .enet1 = {
  232. .force_speed_100 = 1,
  233. .force_duplex_full = 1,
  234. },
  235. .has_ohci0 = 1,
  236. .has_pccard = 1,
  237. .has_ehci0 = 1,
  238. .leds = {
  239. {
  240. .name = "adsl-fail",
  241. .gpio = 2,
  242. .active_low = 1,
  243. },
  244. {
  245. .name = "ppp",
  246. .gpio = 3,
  247. .active_low = 1,
  248. },
  249. {
  250. .name = "ppp-fail",
  251. .gpio = 4,
  252. .active_low = 1,
  253. },
  254. {
  255. .name = "power",
  256. .gpio = 0,
  257. .active_low = 1,
  258. .default_trigger = "default-on",
  259. },
  260. {
  261. .name = "stop",
  262. .gpio = 1,
  263. .active_low = 1,
  264. },
  265. },
  266. };
  267. static struct board_info __initdata board_96348gw = {
  268. .name = "96348GW",
  269. .expected_cpu_id = 0x6348,
  270. .has_uart0 = 1,
  271. .has_enet0 = 1,
  272. .has_enet1 = 1,
  273. .has_pci = 1,
  274. .enet0 = {
  275. .has_phy = 1,
  276. .use_internal_phy = 1,
  277. },
  278. .enet1 = {
  279. .force_speed_100 = 1,
  280. .force_duplex_full = 1,
  281. },
  282. .has_ohci0 = 1,
  283. .has_dsp = 1,
  284. .dsp = {
  285. .gpio_rst = 6,
  286. .gpio_int = 34,
  287. .ext_irq = 2,
  288. .cs = 2,
  289. },
  290. .leds = {
  291. {
  292. .name = "adsl-fail",
  293. .gpio = 2,
  294. .active_low = 1,
  295. },
  296. {
  297. .name = "ppp",
  298. .gpio = 3,
  299. .active_low = 1,
  300. },
  301. {
  302. .name = "ppp-fail",
  303. .gpio = 4,
  304. .active_low = 1,
  305. },
  306. {
  307. .name = "power",
  308. .gpio = 0,
  309. .active_low = 1,
  310. .default_trigger = "default-on",
  311. },
  312. {
  313. .name = "stop",
  314. .gpio = 1,
  315. .active_low = 1,
  316. },
  317. },
  318. };
  319. static struct board_info __initdata board_FAST2404 = {
  320. .name = "F@ST2404",
  321. .expected_cpu_id = 0x6348,
  322. .has_uart0 = 1,
  323. .has_enet0 = 1,
  324. .has_enet1 = 1,
  325. .has_pci = 1,
  326. .enet0 = {
  327. .has_phy = 1,
  328. .use_internal_phy = 1,
  329. },
  330. .enet1 = {
  331. .force_speed_100 = 1,
  332. .force_duplex_full = 1,
  333. },
  334. .has_ohci0 = 1,
  335. .has_pccard = 1,
  336. .has_ehci0 = 1,
  337. };
  338. static struct board_info __initdata board_rta1025w_16 = {
  339. .name = "RTA1025W_16",
  340. .expected_cpu_id = 0x6348,
  341. .has_enet0 = 1,
  342. .has_enet1 = 1,
  343. .has_pci = 1,
  344. .enet0 = {
  345. .has_phy = 1,
  346. .use_internal_phy = 1,
  347. },
  348. .enet1 = {
  349. .force_speed_100 = 1,
  350. .force_duplex_full = 1,
  351. },
  352. };
  353. static struct board_info __initdata board_DV201AMR = {
  354. .name = "DV201AMR",
  355. .expected_cpu_id = 0x6348,
  356. .has_uart0 = 1,
  357. .has_pci = 1,
  358. .has_ohci0 = 1,
  359. .has_enet0 = 1,
  360. .has_enet1 = 1,
  361. .enet0 = {
  362. .has_phy = 1,
  363. .use_internal_phy = 1,
  364. },
  365. .enet1 = {
  366. .force_speed_100 = 1,
  367. .force_duplex_full = 1,
  368. },
  369. };
  370. static struct board_info __initdata board_96348gw_a = {
  371. .name = "96348GW-A",
  372. .expected_cpu_id = 0x6348,
  373. .has_uart0 = 1,
  374. .has_enet0 = 1,
  375. .has_enet1 = 1,
  376. .has_pci = 1,
  377. .enet0 = {
  378. .has_phy = 1,
  379. .use_internal_phy = 1,
  380. },
  381. .enet1 = {
  382. .force_speed_100 = 1,
  383. .force_duplex_full = 1,
  384. },
  385. .has_ohci0 = 1,
  386. };
  387. #endif
  388. /*
  389. * known 6358 boards
  390. */
  391. #ifdef CONFIG_BCM63XX_CPU_6358
  392. static struct board_info __initdata board_96358vw = {
  393. .name = "96358VW",
  394. .expected_cpu_id = 0x6358,
  395. .has_uart0 = 1,
  396. .has_enet0 = 1,
  397. .has_enet1 = 1,
  398. .has_pci = 1,
  399. .enet0 = {
  400. .has_phy = 1,
  401. .use_internal_phy = 1,
  402. },
  403. .enet1 = {
  404. .force_speed_100 = 1,
  405. .force_duplex_full = 1,
  406. },
  407. .has_ohci0 = 1,
  408. .has_pccard = 1,
  409. .has_ehci0 = 1,
  410. .leds = {
  411. {
  412. .name = "adsl-fail",
  413. .gpio = 15,
  414. .active_low = 1,
  415. },
  416. {
  417. .name = "ppp",
  418. .gpio = 22,
  419. .active_low = 1,
  420. },
  421. {
  422. .name = "ppp-fail",
  423. .gpio = 23,
  424. .active_low = 1,
  425. },
  426. {
  427. .name = "power",
  428. .gpio = 4,
  429. .default_trigger = "default-on",
  430. },
  431. {
  432. .name = "stop",
  433. .gpio = 5,
  434. },
  435. },
  436. };
  437. static struct board_info __initdata board_96358vw2 = {
  438. .name = "96358VW2",
  439. .expected_cpu_id = 0x6358,
  440. .has_uart0 = 1,
  441. .has_enet0 = 1,
  442. .has_enet1 = 1,
  443. .has_pci = 1,
  444. .enet0 = {
  445. .has_phy = 1,
  446. .use_internal_phy = 1,
  447. },
  448. .enet1 = {
  449. .force_speed_100 = 1,
  450. .force_duplex_full = 1,
  451. },
  452. .has_ohci0 = 1,
  453. .has_pccard = 1,
  454. .has_ehci0 = 1,
  455. .leds = {
  456. {
  457. .name = "adsl",
  458. .gpio = 22,
  459. .active_low = 1,
  460. },
  461. {
  462. .name = "ppp-fail",
  463. .gpio = 23,
  464. },
  465. {
  466. .name = "power",
  467. .gpio = 5,
  468. .active_low = 1,
  469. .default_trigger = "default-on",
  470. },
  471. {
  472. .name = "stop",
  473. .gpio = 4,
  474. .active_low = 1,
  475. },
  476. },
  477. };
  478. static struct board_info __initdata board_AGPFS0 = {
  479. .name = "AGPF-S0",
  480. .expected_cpu_id = 0x6358,
  481. .has_uart0 = 1,
  482. .has_enet0 = 1,
  483. .has_enet1 = 1,
  484. .has_pci = 1,
  485. .enet0 = {
  486. .has_phy = 1,
  487. .use_internal_phy = 1,
  488. },
  489. .enet1 = {
  490. .force_speed_100 = 1,
  491. .force_duplex_full = 1,
  492. },
  493. .has_ohci0 = 1,
  494. .has_ehci0 = 1,
  495. };
  496. static struct board_info __initdata board_DWVS0 = {
  497. .name = "DWV-S0",
  498. .expected_cpu_id = 0x6358,
  499. .has_enet0 = 1,
  500. .has_enet1 = 1,
  501. .has_pci = 1,
  502. .enet0 = {
  503. .has_phy = 1,
  504. .use_internal_phy = 1,
  505. },
  506. .enet1 = {
  507. .force_speed_100 = 1,
  508. .force_duplex_full = 1,
  509. },
  510. .has_ohci0 = 1,
  511. };
  512. #endif
  513. /*
  514. * all boards
  515. */
  516. static const struct board_info __initdata *bcm963xx_boards[] = {
  517. #ifdef CONFIG_BCM63XX_CPU_6338
  518. &board_96338gw,
  519. &board_96338w,
  520. #endif
  521. #ifdef CONFIG_BCM63XX_CPU_6345
  522. &board_96345gw2,
  523. #endif
  524. #ifdef CONFIG_BCM63XX_CPU_6348
  525. &board_96348r,
  526. &board_96348gw,
  527. &board_96348gw_10,
  528. &board_96348gw_11,
  529. &board_FAST2404,
  530. &board_DV201AMR,
  531. &board_96348gw_a,
  532. &board_rta1025w_16,
  533. #endif
  534. #ifdef CONFIG_BCM63XX_CPU_6358
  535. &board_96358vw,
  536. &board_96358vw2,
  537. &board_AGPFS0,
  538. &board_DWVS0,
  539. #endif
  540. };
  541. /*
  542. * Register a sane SPROMv2 to make the on-board
  543. * bcm4318 WLAN work
  544. */
  545. #ifdef CONFIG_SSB_PCIHOST
  546. static struct ssb_sprom bcm63xx_sprom = {
  547. .revision = 0x02,
  548. .board_rev = 0x17,
  549. .country_code = 0x0,
  550. .ant_available_bg = 0x3,
  551. .pa0b0 = 0x15ae,
  552. .pa0b1 = 0xfa85,
  553. .pa0b2 = 0xfe8d,
  554. .pa1b0 = 0xffff,
  555. .pa1b1 = 0xffff,
  556. .pa1b2 = 0xffff,
  557. .gpio0 = 0xff,
  558. .gpio1 = 0xff,
  559. .gpio2 = 0xff,
  560. .gpio3 = 0xff,
  561. .maxpwr_bg = 0x004c,
  562. .itssi_bg = 0x00,
  563. .boardflags_lo = 0x2848,
  564. .boardflags_hi = 0x0000,
  565. };
  566. int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
  567. {
  568. if (bus->bustype == SSB_BUSTYPE_PCI) {
  569. memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
  570. return 0;
  571. } else {
  572. printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
  573. return -EINVAL;
  574. }
  575. }
  576. #endif
  577. /*
  578. * return board name for /proc/cpuinfo
  579. */
  580. const char *board_get_name(void)
  581. {
  582. return board.name;
  583. }
  584. /*
  585. * register & return a new board mac address
  586. */
  587. static int board_get_mac_address(u8 *mac)
  588. {
  589. u8 *p;
  590. int count;
  591. if (mac_addr_used >= nvram.mac_addr_count) {
  592. printk(KERN_ERR PFX "not enough mac address\n");
  593. return -ENODEV;
  594. }
  595. memcpy(mac, nvram.mac_addr_base, ETH_ALEN);
  596. p = mac + ETH_ALEN - 1;
  597. count = mac_addr_used;
  598. while (count--) {
  599. do {
  600. (*p)++;
  601. if (*p != 0)
  602. break;
  603. p--;
  604. } while (p != mac);
  605. }
  606. if (p == mac) {
  607. printk(KERN_ERR PFX "unable to fetch mac address\n");
  608. return -ENODEV;
  609. }
  610. mac_addr_used++;
  611. return 0;
  612. }
  613. /*
  614. * early init callback, read nvram data from flash and checksum it
  615. */
  616. void __init board_prom_init(void)
  617. {
  618. unsigned int check_len, i;
  619. u8 *boot_addr, *cfe, *p;
  620. char cfe_version[32];
  621. u32 val;
  622. /* read base address of boot chip select (0) */
  623. val = bcm_mpi_readl(MPI_CSBASE_REG(0));
  624. val &= MPI_CSBASE_BASE_MASK;
  625. boot_addr = (u8 *)KSEG1ADDR(val);
  626. /* dump cfe version */
  627. cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET;
  628. if (!memcmp(cfe, "cfe-v", 5))
  629. snprintf(cfe_version, sizeof(cfe_version), "%u.%u.%u-%u.%u",
  630. cfe[5], cfe[6], cfe[7], cfe[8], cfe[9]);
  631. else
  632. strcpy(cfe_version, "unknown");
  633. printk(KERN_INFO PFX "CFE version: %s\n", cfe_version);
  634. /* extract nvram data */
  635. memcpy(&nvram, boot_addr + BCM963XX_NVRAM_OFFSET, sizeof(nvram));
  636. /* check checksum before using data */
  637. if (nvram.version <= 4)
  638. check_len = offsetof(struct bcm963xx_nvram, checksum_old);
  639. else
  640. check_len = sizeof(nvram);
  641. val = 0;
  642. p = (u8 *)&nvram;
  643. while (check_len--)
  644. val += *p;
  645. if (val) {
  646. printk(KERN_ERR PFX "invalid nvram checksum\n");
  647. return;
  648. }
  649. /* find board by name */
  650. for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
  651. if (strncmp(nvram.name, bcm963xx_boards[i]->name,
  652. sizeof(nvram.name)))
  653. continue;
  654. /* copy, board desc array is marked initdata */
  655. memcpy(&board, bcm963xx_boards[i], sizeof(board));
  656. break;
  657. }
  658. /* bail out if board is not found, will complain later */
  659. if (!board.name[0]) {
  660. char name[17];
  661. memcpy(name, nvram.name, 16);
  662. name[16] = 0;
  663. printk(KERN_ERR PFX "unknown bcm963xx board: %s\n",
  664. name);
  665. return;
  666. }
  667. /* setup pin multiplexing depending on board enabled device,
  668. * this has to be done this early since PCI init is done
  669. * inside arch_initcall */
  670. val = 0;
  671. #ifdef CONFIG_PCI
  672. if (board.has_pci) {
  673. bcm63xx_pci_enabled = 1;
  674. if (BCMCPU_IS_6348())
  675. val |= GPIO_MODE_6348_G2_PCI;
  676. }
  677. #endif
  678. if (board.has_pccard) {
  679. if (BCMCPU_IS_6348())
  680. val |= GPIO_MODE_6348_G1_MII_PCCARD;
  681. }
  682. if (board.has_enet0 && !board.enet0.use_internal_phy) {
  683. if (BCMCPU_IS_6348())
  684. val |= GPIO_MODE_6348_G3_EXT_MII |
  685. GPIO_MODE_6348_G0_EXT_MII;
  686. }
  687. if (board.has_enet1 && !board.enet1.use_internal_phy) {
  688. if (BCMCPU_IS_6348())
  689. val |= GPIO_MODE_6348_G3_EXT_MII |
  690. GPIO_MODE_6348_G0_EXT_MII;
  691. }
  692. bcm_gpio_writel(val, GPIO_MODE_REG);
  693. }
  694. /*
  695. * second stage init callback, good time to panic if we couldn't
  696. * identify on which board we're running since early printk is working
  697. */
  698. void __init board_setup(void)
  699. {
  700. if (!board.name[0])
  701. panic("unable to detect bcm963xx board");
  702. printk(KERN_INFO PFX "board name: %s\n", board.name);
  703. /* make sure we're running on expected cpu */
  704. if (bcm63xx_get_cpu_id() != board.expected_cpu_id)
  705. panic("unexpected CPU for bcm963xx board");
  706. }
  707. static struct gpio_led_platform_data bcm63xx_led_data;
  708. static struct platform_device bcm63xx_gpio_leds = {
  709. .name = "leds-gpio",
  710. .id = 0,
  711. .dev.platform_data = &bcm63xx_led_data,
  712. };
  713. /*
  714. * third stage init callback, register all board devices.
  715. */
  716. int __init board_register_devices(void)
  717. {
  718. if (board.has_uart0)
  719. bcm63xx_uart_register(0);
  720. if (board.has_uart1)
  721. bcm63xx_uart_register(1);
  722. if (board.has_pccard)
  723. bcm63xx_pcmcia_register();
  724. if (board.has_enet0 &&
  725. !board_get_mac_address(board.enet0.mac_addr))
  726. bcm63xx_enet_register(0, &board.enet0);
  727. if (board.has_enet1 &&
  728. !board_get_mac_address(board.enet1.mac_addr))
  729. bcm63xx_enet_register(1, &board.enet1);
  730. if (board.has_dsp)
  731. bcm63xx_dsp_register(&board.dsp);
  732. /* Generate MAC address for WLAN and register our SPROM,
  733. * do this after registering enet devices
  734. */
  735. #ifdef CONFIG_SSB_PCIHOST
  736. if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
  737. memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
  738. memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
  739. if (ssb_arch_register_fallback_sprom(
  740. &bcm63xx_get_fallback_sprom) < 0)
  741. pr_err(PFX "failed to register fallback SPROM\n");
  742. }
  743. #endif
  744. bcm63xx_spi_register();
  745. bcm63xx_flash_register();
  746. bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
  747. bcm63xx_led_data.leds = board.leds;
  748. platform_device_register(&bcm63xx_gpio_leds);
  749. return 0;
  750. }