common.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. /*
  2. * arch/arm/mach-orion5x/common.c
  3. *
  4. * Core functions for Marvell Orion 5x SoCs
  5. *
  6. * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/serial_8250.h>
  16. #include <linux/mbus.h>
  17. #include <linux/mv643xx_eth.h>
  18. #include <linux/mv643xx_i2c.h>
  19. #include <linux/ata_platform.h>
  20. #include <linux/spi/orion_spi.h>
  21. #include <net/dsa.h>
  22. #include <asm/page.h>
  23. #include <asm/setup.h>
  24. #include <asm/timex.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/time.h>
  28. #include <mach/bridge-regs.h>
  29. #include <mach/hardware.h>
  30. #include <mach/orion5x.h>
  31. #include <plat/ehci-orion.h>
  32. #include <plat/mv_xor.h>
  33. #include <plat/orion_nand.h>
  34. #include <plat/orion_wdt.h>
  35. #include <plat/time.h>
  36. #include "common.h"
  37. /*****************************************************************************
  38. * I/O Address Mapping
  39. ****************************************************************************/
  40. static struct map_desc orion5x_io_desc[] __initdata = {
  41. {
  42. .virtual = ORION5X_REGS_VIRT_BASE,
  43. .pfn = __phys_to_pfn(ORION5X_REGS_PHYS_BASE),
  44. .length = ORION5X_REGS_SIZE,
  45. .type = MT_DEVICE,
  46. }, {
  47. .virtual = ORION5X_PCIE_IO_VIRT_BASE,
  48. .pfn = __phys_to_pfn(ORION5X_PCIE_IO_PHYS_BASE),
  49. .length = ORION5X_PCIE_IO_SIZE,
  50. .type = MT_DEVICE,
  51. }, {
  52. .virtual = ORION5X_PCI_IO_VIRT_BASE,
  53. .pfn = __phys_to_pfn(ORION5X_PCI_IO_PHYS_BASE),
  54. .length = ORION5X_PCI_IO_SIZE,
  55. .type = MT_DEVICE,
  56. }, {
  57. .virtual = ORION5X_PCIE_WA_VIRT_BASE,
  58. .pfn = __phys_to_pfn(ORION5X_PCIE_WA_PHYS_BASE),
  59. .length = ORION5X_PCIE_WA_SIZE,
  60. .type = MT_DEVICE,
  61. },
  62. };
  63. void __init orion5x_map_io(void)
  64. {
  65. iotable_init(orion5x_io_desc, ARRAY_SIZE(orion5x_io_desc));
  66. }
  67. /*****************************************************************************
  68. * EHCI
  69. ****************************************************************************/
  70. static struct orion_ehci_data orion5x_ehci_data = {
  71. .dram = &orion5x_mbus_dram_info,
  72. .phy_version = EHCI_PHY_ORION,
  73. };
  74. static u64 ehci_dmamask = 0xffffffffUL;
  75. /*****************************************************************************
  76. * EHCI0
  77. ****************************************************************************/
  78. static struct resource orion5x_ehci0_resources[] = {
  79. {
  80. .start = ORION5X_USB0_PHYS_BASE,
  81. .end = ORION5X_USB0_PHYS_BASE + SZ_4K - 1,
  82. .flags = IORESOURCE_MEM,
  83. }, {
  84. .start = IRQ_ORION5X_USB0_CTRL,
  85. .end = IRQ_ORION5X_USB0_CTRL,
  86. .flags = IORESOURCE_IRQ,
  87. },
  88. };
  89. static struct platform_device orion5x_ehci0 = {
  90. .name = "orion-ehci",
  91. .id = 0,
  92. .dev = {
  93. .dma_mask = &ehci_dmamask,
  94. .coherent_dma_mask = 0xffffffff,
  95. .platform_data = &orion5x_ehci_data,
  96. },
  97. .resource = orion5x_ehci0_resources,
  98. .num_resources = ARRAY_SIZE(orion5x_ehci0_resources),
  99. };
  100. void __init orion5x_ehci0_init(void)
  101. {
  102. platform_device_register(&orion5x_ehci0);
  103. }
  104. /*****************************************************************************
  105. * EHCI1
  106. ****************************************************************************/
  107. static struct resource orion5x_ehci1_resources[] = {
  108. {
  109. .start = ORION5X_USB1_PHYS_BASE,
  110. .end = ORION5X_USB1_PHYS_BASE + SZ_4K - 1,
  111. .flags = IORESOURCE_MEM,
  112. }, {
  113. .start = IRQ_ORION5X_USB1_CTRL,
  114. .end = IRQ_ORION5X_USB1_CTRL,
  115. .flags = IORESOURCE_IRQ,
  116. },
  117. };
  118. static struct platform_device orion5x_ehci1 = {
  119. .name = "orion-ehci",
  120. .id = 1,
  121. .dev = {
  122. .dma_mask = &ehci_dmamask,
  123. .coherent_dma_mask = 0xffffffff,
  124. .platform_data = &orion5x_ehci_data,
  125. },
  126. .resource = orion5x_ehci1_resources,
  127. .num_resources = ARRAY_SIZE(orion5x_ehci1_resources),
  128. };
  129. void __init orion5x_ehci1_init(void)
  130. {
  131. platform_device_register(&orion5x_ehci1);
  132. }
  133. /*****************************************************************************
  134. * GigE
  135. ****************************************************************************/
  136. struct mv643xx_eth_shared_platform_data orion5x_eth_shared_data = {
  137. .dram = &orion5x_mbus_dram_info,
  138. };
  139. static struct resource orion5x_eth_shared_resources[] = {
  140. {
  141. .start = ORION5X_ETH_PHYS_BASE + 0x2000,
  142. .end = ORION5X_ETH_PHYS_BASE + 0x3fff,
  143. .flags = IORESOURCE_MEM,
  144. }, {
  145. .start = IRQ_ORION5X_ETH_ERR,
  146. .end = IRQ_ORION5X_ETH_ERR,
  147. .flags = IORESOURCE_IRQ,
  148. },
  149. };
  150. static struct platform_device orion5x_eth_shared = {
  151. .name = MV643XX_ETH_SHARED_NAME,
  152. .id = 0,
  153. .dev = {
  154. .platform_data = &orion5x_eth_shared_data,
  155. },
  156. .num_resources = ARRAY_SIZE(orion5x_eth_shared_resources),
  157. .resource = orion5x_eth_shared_resources,
  158. };
  159. static struct resource orion5x_eth_resources[] = {
  160. {
  161. .name = "eth irq",
  162. .start = IRQ_ORION5X_ETH_SUM,
  163. .end = IRQ_ORION5X_ETH_SUM,
  164. .flags = IORESOURCE_IRQ,
  165. },
  166. };
  167. static struct platform_device orion5x_eth = {
  168. .name = MV643XX_ETH_NAME,
  169. .id = 0,
  170. .num_resources = 1,
  171. .resource = orion5x_eth_resources,
  172. .dev = {
  173. .coherent_dma_mask = 0xffffffff,
  174. },
  175. };
  176. void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
  177. {
  178. eth_data->shared = &orion5x_eth_shared;
  179. orion5x_eth.dev.platform_data = eth_data;
  180. platform_device_register(&orion5x_eth_shared);
  181. platform_device_register(&orion5x_eth);
  182. }
  183. /*****************************************************************************
  184. * Ethernet switch
  185. ****************************************************************************/
  186. static struct resource orion5x_switch_resources[] = {
  187. {
  188. .start = 0,
  189. .end = 0,
  190. .flags = IORESOURCE_IRQ,
  191. },
  192. };
  193. static struct platform_device orion5x_switch_device = {
  194. .name = "dsa",
  195. .id = 0,
  196. .num_resources = 0,
  197. .resource = orion5x_switch_resources,
  198. };
  199. void __init orion5x_eth_switch_init(struct dsa_platform_data *d, int irq)
  200. {
  201. int i;
  202. if (irq != NO_IRQ) {
  203. orion5x_switch_resources[0].start = irq;
  204. orion5x_switch_resources[0].end = irq;
  205. orion5x_switch_device.num_resources = 1;
  206. }
  207. d->netdev = &orion5x_eth.dev;
  208. for (i = 0; i < d->nr_chips; i++)
  209. d->chip[i].mii_bus = &orion5x_eth_shared.dev;
  210. orion5x_switch_device.dev.platform_data = d;
  211. platform_device_register(&orion5x_switch_device);
  212. }
  213. /*****************************************************************************
  214. * I2C
  215. ****************************************************************************/
  216. static struct mv64xxx_i2c_pdata orion5x_i2c_pdata = {
  217. .freq_m = 8, /* assumes 166 MHz TCLK */
  218. .freq_n = 3,
  219. .timeout = 1000, /* Default timeout of 1 second */
  220. };
  221. static struct resource orion5x_i2c_resources[] = {
  222. {
  223. .start = I2C_PHYS_BASE,
  224. .end = I2C_PHYS_BASE + 0x1f,
  225. .flags = IORESOURCE_MEM,
  226. }, {
  227. .start = IRQ_ORION5X_I2C,
  228. .end = IRQ_ORION5X_I2C,
  229. .flags = IORESOURCE_IRQ,
  230. },
  231. };
  232. static struct platform_device orion5x_i2c = {
  233. .name = MV64XXX_I2C_CTLR_NAME,
  234. .id = 0,
  235. .num_resources = ARRAY_SIZE(orion5x_i2c_resources),
  236. .resource = orion5x_i2c_resources,
  237. .dev = {
  238. .platform_data = &orion5x_i2c_pdata,
  239. },
  240. };
  241. void __init orion5x_i2c_init(void)
  242. {
  243. platform_device_register(&orion5x_i2c);
  244. }
  245. /*****************************************************************************
  246. * SATA
  247. ****************************************************************************/
  248. static struct resource orion5x_sata_resources[] = {
  249. {
  250. .name = "sata base",
  251. .start = ORION5X_SATA_PHYS_BASE,
  252. .end = ORION5X_SATA_PHYS_BASE + 0x5000 - 1,
  253. .flags = IORESOURCE_MEM,
  254. }, {
  255. .name = "sata irq",
  256. .start = IRQ_ORION5X_SATA,
  257. .end = IRQ_ORION5X_SATA,
  258. .flags = IORESOURCE_IRQ,
  259. },
  260. };
  261. static struct platform_device orion5x_sata = {
  262. .name = "sata_mv",
  263. .id = 0,
  264. .dev = {
  265. .coherent_dma_mask = 0xffffffff,
  266. },
  267. .num_resources = ARRAY_SIZE(orion5x_sata_resources),
  268. .resource = orion5x_sata_resources,
  269. };
  270. void __init orion5x_sata_init(struct mv_sata_platform_data *sata_data)
  271. {
  272. sata_data->dram = &orion5x_mbus_dram_info;
  273. orion5x_sata.dev.platform_data = sata_data;
  274. platform_device_register(&orion5x_sata);
  275. }
  276. /*****************************************************************************
  277. * SPI
  278. ****************************************************************************/
  279. static struct orion_spi_info orion5x_spi_plat_data = {
  280. .tclk = 0,
  281. .enable_clock_fix = 1,
  282. };
  283. static struct resource orion5x_spi_resources[] = {
  284. {
  285. .name = "spi base",
  286. .start = SPI_PHYS_BASE,
  287. .end = SPI_PHYS_BASE + 0x1f,
  288. .flags = IORESOURCE_MEM,
  289. },
  290. };
  291. static struct platform_device orion5x_spi = {
  292. .name = "orion_spi",
  293. .id = 0,
  294. .dev = {
  295. .platform_data = &orion5x_spi_plat_data,
  296. },
  297. .num_resources = ARRAY_SIZE(orion5x_spi_resources),
  298. .resource = orion5x_spi_resources,
  299. };
  300. void __init orion5x_spi_init()
  301. {
  302. platform_device_register(&orion5x_spi);
  303. }
  304. /*****************************************************************************
  305. * UART0
  306. ****************************************************************************/
  307. static struct plat_serial8250_port orion5x_uart0_data[] = {
  308. {
  309. .mapbase = UART0_PHYS_BASE,
  310. .membase = (char *)UART0_VIRT_BASE,
  311. .irq = IRQ_ORION5X_UART0,
  312. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  313. .iotype = UPIO_MEM,
  314. .regshift = 2,
  315. .uartclk = 0,
  316. }, {
  317. },
  318. };
  319. static struct resource orion5x_uart0_resources[] = {
  320. {
  321. .start = UART0_PHYS_BASE,
  322. .end = UART0_PHYS_BASE + 0xff,
  323. .flags = IORESOURCE_MEM,
  324. }, {
  325. .start = IRQ_ORION5X_UART0,
  326. .end = IRQ_ORION5X_UART0,
  327. .flags = IORESOURCE_IRQ,
  328. },
  329. };
  330. static struct platform_device orion5x_uart0 = {
  331. .name = "serial8250",
  332. .id = PLAT8250_DEV_PLATFORM,
  333. .dev = {
  334. .platform_data = orion5x_uart0_data,
  335. },
  336. .resource = orion5x_uart0_resources,
  337. .num_resources = ARRAY_SIZE(orion5x_uart0_resources),
  338. };
  339. void __init orion5x_uart0_init(void)
  340. {
  341. platform_device_register(&orion5x_uart0);
  342. }
  343. /*****************************************************************************
  344. * UART1
  345. ****************************************************************************/
  346. static struct plat_serial8250_port orion5x_uart1_data[] = {
  347. {
  348. .mapbase = UART1_PHYS_BASE,
  349. .membase = (char *)UART1_VIRT_BASE,
  350. .irq = IRQ_ORION5X_UART1,
  351. .flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF,
  352. .iotype = UPIO_MEM,
  353. .regshift = 2,
  354. .uartclk = 0,
  355. }, {
  356. },
  357. };
  358. static struct resource orion5x_uart1_resources[] = {
  359. {
  360. .start = UART1_PHYS_BASE,
  361. .end = UART1_PHYS_BASE + 0xff,
  362. .flags = IORESOURCE_MEM,
  363. }, {
  364. .start = IRQ_ORION5X_UART1,
  365. .end = IRQ_ORION5X_UART1,
  366. .flags = IORESOURCE_IRQ,
  367. },
  368. };
  369. static struct platform_device orion5x_uart1 = {
  370. .name = "serial8250",
  371. .id = PLAT8250_DEV_PLATFORM1,
  372. .dev = {
  373. .platform_data = orion5x_uart1_data,
  374. },
  375. .resource = orion5x_uart1_resources,
  376. .num_resources = ARRAY_SIZE(orion5x_uart1_resources),
  377. };
  378. void __init orion5x_uart1_init(void)
  379. {
  380. platform_device_register(&orion5x_uart1);
  381. }
  382. /*****************************************************************************
  383. * XOR engine
  384. ****************************************************************************/
  385. struct mv_xor_platform_shared_data orion5x_xor_shared_data = {
  386. .dram = &orion5x_mbus_dram_info,
  387. };
  388. static struct resource orion5x_xor_shared_resources[] = {
  389. {
  390. .name = "xor low",
  391. .start = ORION5X_XOR_PHYS_BASE,
  392. .end = ORION5X_XOR_PHYS_BASE + 0xff,
  393. .flags = IORESOURCE_MEM,
  394. }, {
  395. .name = "xor high",
  396. .start = ORION5X_XOR_PHYS_BASE + 0x200,
  397. .end = ORION5X_XOR_PHYS_BASE + 0x2ff,
  398. .flags = IORESOURCE_MEM,
  399. },
  400. };
  401. static struct platform_device orion5x_xor_shared = {
  402. .name = MV_XOR_SHARED_NAME,
  403. .id = 0,
  404. .dev = {
  405. .platform_data = &orion5x_xor_shared_data,
  406. },
  407. .num_resources = ARRAY_SIZE(orion5x_xor_shared_resources),
  408. .resource = orion5x_xor_shared_resources,
  409. };
  410. static u64 orion5x_xor_dmamask = DMA_BIT_MASK(32);
  411. static struct resource orion5x_xor0_resources[] = {
  412. [0] = {
  413. .start = IRQ_ORION5X_XOR0,
  414. .end = IRQ_ORION5X_XOR0,
  415. .flags = IORESOURCE_IRQ,
  416. },
  417. };
  418. static struct mv_xor_platform_data orion5x_xor0_data = {
  419. .shared = &orion5x_xor_shared,
  420. .hw_id = 0,
  421. .pool_size = PAGE_SIZE,
  422. };
  423. static struct platform_device orion5x_xor0_channel = {
  424. .name = MV_XOR_NAME,
  425. .id = 0,
  426. .num_resources = ARRAY_SIZE(orion5x_xor0_resources),
  427. .resource = orion5x_xor0_resources,
  428. .dev = {
  429. .dma_mask = &orion5x_xor_dmamask,
  430. .coherent_dma_mask = DMA_BIT_MASK(64),
  431. .platform_data = &orion5x_xor0_data,
  432. },
  433. };
  434. static struct resource orion5x_xor1_resources[] = {
  435. [0] = {
  436. .start = IRQ_ORION5X_XOR1,
  437. .end = IRQ_ORION5X_XOR1,
  438. .flags = IORESOURCE_IRQ,
  439. },
  440. };
  441. static struct mv_xor_platform_data orion5x_xor1_data = {
  442. .shared = &orion5x_xor_shared,
  443. .hw_id = 1,
  444. .pool_size = PAGE_SIZE,
  445. };
  446. static struct platform_device orion5x_xor1_channel = {
  447. .name = MV_XOR_NAME,
  448. .id = 1,
  449. .num_resources = ARRAY_SIZE(orion5x_xor1_resources),
  450. .resource = orion5x_xor1_resources,
  451. .dev = {
  452. .dma_mask = &orion5x_xor_dmamask,
  453. .coherent_dma_mask = DMA_BIT_MASK(64),
  454. .platform_data = &orion5x_xor1_data,
  455. },
  456. };
  457. void __init orion5x_xor_init(void)
  458. {
  459. platform_device_register(&orion5x_xor_shared);
  460. /*
  461. * two engines can't do memset simultaneously, this limitation
  462. * satisfied by removing memset support from one of the engines.
  463. */
  464. dma_cap_set(DMA_MEMCPY, orion5x_xor0_data.cap_mask);
  465. dma_cap_set(DMA_XOR, orion5x_xor0_data.cap_mask);
  466. platform_device_register(&orion5x_xor0_channel);
  467. dma_cap_set(DMA_MEMCPY, orion5x_xor1_data.cap_mask);
  468. dma_cap_set(DMA_MEMSET, orion5x_xor1_data.cap_mask);
  469. dma_cap_set(DMA_XOR, orion5x_xor1_data.cap_mask);
  470. platform_device_register(&orion5x_xor1_channel);
  471. }
  472. static struct resource orion5x_crypto_res[] = {
  473. {
  474. .name = "regs",
  475. .start = ORION5X_CRYPTO_PHYS_BASE,
  476. .end = ORION5X_CRYPTO_PHYS_BASE + 0xffff,
  477. .flags = IORESOURCE_MEM,
  478. }, {
  479. .name = "sram",
  480. .start = ORION5X_SRAM_PHYS_BASE,
  481. .end = ORION5X_SRAM_PHYS_BASE + SZ_8K - 1,
  482. .flags = IORESOURCE_MEM,
  483. }, {
  484. .name = "crypto interrupt",
  485. .start = IRQ_ORION5X_CESA,
  486. .end = IRQ_ORION5X_CESA,
  487. .flags = IORESOURCE_IRQ,
  488. },
  489. };
  490. static struct platform_device orion5x_crypto_device = {
  491. .name = "mv_crypto",
  492. .id = -1,
  493. .num_resources = ARRAY_SIZE(orion5x_crypto_res),
  494. .resource = orion5x_crypto_res,
  495. };
  496. static int __init orion5x_crypto_init(void)
  497. {
  498. int ret;
  499. ret = orion5x_setup_sram_win();
  500. if (ret)
  501. return ret;
  502. return platform_device_register(&orion5x_crypto_device);
  503. }
  504. /*****************************************************************************
  505. * Watchdog
  506. ****************************************************************************/
  507. static struct orion_wdt_platform_data orion5x_wdt_data = {
  508. .tclk = 0,
  509. };
  510. static struct platform_device orion5x_wdt_device = {
  511. .name = "orion_wdt",
  512. .id = -1,
  513. .dev = {
  514. .platform_data = &orion5x_wdt_data,
  515. },
  516. .num_resources = 0,
  517. };
  518. void __init orion5x_wdt_init(void)
  519. {
  520. orion5x_wdt_data.tclk = orion5x_tclk;
  521. platform_device_register(&orion5x_wdt_device);
  522. }
  523. /*****************************************************************************
  524. * Time handling
  525. ****************************************************************************/
  526. void __init orion5x_init_early(void)
  527. {
  528. orion_time_set_base(TIMER_VIRT_BASE);
  529. }
  530. int orion5x_tclk;
  531. int __init orion5x_find_tclk(void)
  532. {
  533. u32 dev, rev;
  534. orion5x_pcie_id(&dev, &rev);
  535. if (dev == MV88F6183_DEV_ID &&
  536. (readl(MPP_RESET_SAMPLE) & 0x00000200) == 0)
  537. return 133333333;
  538. return 166666667;
  539. }
  540. static void orion5x_timer_init(void)
  541. {
  542. orion5x_tclk = orion5x_find_tclk();
  543. orion_time_init(ORION5X_BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
  544. IRQ_ORION5X_BRIDGE, orion5x_tclk);
  545. }
  546. struct sys_timer orion5x_timer = {
  547. .init = orion5x_timer_init,
  548. };
  549. /*****************************************************************************
  550. * General
  551. ****************************************************************************/
  552. /*
  553. * Identify device ID and rev from PCIe configuration header space '0'.
  554. */
  555. static void __init orion5x_id(u32 *dev, u32 *rev, char **dev_name)
  556. {
  557. orion5x_pcie_id(dev, rev);
  558. if (*dev == MV88F5281_DEV_ID) {
  559. if (*rev == MV88F5281_REV_D2) {
  560. *dev_name = "MV88F5281-D2";
  561. } else if (*rev == MV88F5281_REV_D1) {
  562. *dev_name = "MV88F5281-D1";
  563. } else if (*rev == MV88F5281_REV_D0) {
  564. *dev_name = "MV88F5281-D0";
  565. } else {
  566. *dev_name = "MV88F5281-Rev-Unsupported";
  567. }
  568. } else if (*dev == MV88F5182_DEV_ID) {
  569. if (*rev == MV88F5182_REV_A2) {
  570. *dev_name = "MV88F5182-A2";
  571. } else {
  572. *dev_name = "MV88F5182-Rev-Unsupported";
  573. }
  574. } else if (*dev == MV88F5181_DEV_ID) {
  575. if (*rev == MV88F5181_REV_B1) {
  576. *dev_name = "MV88F5181-Rev-B1";
  577. } else if (*rev == MV88F5181L_REV_A1) {
  578. *dev_name = "MV88F5181L-Rev-A1";
  579. } else {
  580. *dev_name = "MV88F5181(L)-Rev-Unsupported";
  581. }
  582. } else if (*dev == MV88F6183_DEV_ID) {
  583. if (*rev == MV88F6183_REV_B0) {
  584. *dev_name = "MV88F6183-Rev-B0";
  585. } else {
  586. *dev_name = "MV88F6183-Rev-Unsupported";
  587. }
  588. } else {
  589. *dev_name = "Device-Unknown";
  590. }
  591. }
  592. void __init orion5x_init(void)
  593. {
  594. char *dev_name;
  595. u32 dev, rev;
  596. orion5x_id(&dev, &rev, &dev_name);
  597. printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
  598. orion5x_eth_shared_data.t_clk = orion5x_tclk;
  599. orion5x_spi_plat_data.tclk = orion5x_tclk;
  600. orion5x_uart0_data[0].uartclk = orion5x_tclk;
  601. orion5x_uart1_data[0].uartclk = orion5x_tclk;
  602. /*
  603. * Setup Orion address map
  604. */
  605. orion5x_setup_cpu_mbus_bridge();
  606. /*
  607. * Don't issue "Wait for Interrupt" instruction if we are
  608. * running on D0 5281 silicon.
  609. */
  610. if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) {
  611. printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n");
  612. disable_hlt();
  613. }
  614. /*
  615. * The 5082/5181l/5182/6082/6082l/6183 have crypto
  616. * while 5180n/5181/5281 don't have crypto.
  617. */
  618. if ((dev == MV88F5181_DEV_ID && rev >= MV88F5181L_REV_A0) ||
  619. dev == MV88F5182_DEV_ID || dev == MV88F6183_DEV_ID)
  620. orion5x_crypto_init();
  621. /*
  622. * Register watchdog driver
  623. */
  624. orion5x_wdt_init();
  625. }
  626. /*
  627. * Many orion-based systems have buggy bootloader implementations.
  628. * This is a common fixup for bogus memory tags.
  629. */
  630. void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t,
  631. char **from, struct meminfo *meminfo)
  632. {
  633. for (; t->hdr.size; t = tag_next(t))
  634. if (t->hdr.tag == ATAG_MEM &&
  635. (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
  636. t->u.mem.start & ~PAGE_MASK)) {
  637. printk(KERN_WARNING
  638. "Clearing invalid memory bank %dKB@0x%08x\n",
  639. t->u.mem.size / 1024, t->u.mem.start);
  640. t->hdr.tag = 0;
  641. }
  642. }