common.c 17 KB

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