common.c 16 KB

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