board_bcm963xx.c 15 KB

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