board_bcm963xx.c 16 KB

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