rd88f6281-setup.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * arch/arm/mach-kirkwood/rd88f6281-setup.c
  3. *
  4. * Marvell RD-88F6281 Reference Board Setup
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/pci.h>
  14. #include <linux/irq.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/mtd/nand.h>
  17. #include <linux/timer.h>
  18. #include <linux/ata_platform.h>
  19. #include <linux/mv643xx_eth.h>
  20. #include <linux/ethtool.h>
  21. #include <net/dsa.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/pci.h>
  25. #include <mach/kirkwood.h>
  26. #include <plat/orion_nand.h>
  27. #include "common.h"
  28. static struct mtd_partition rd88f6281_nand_parts[] = {
  29. {
  30. .name = "u-boot",
  31. .offset = 0,
  32. .size = SZ_1M
  33. }, {
  34. .name = "uImage",
  35. .offset = MTDPART_OFS_NXTBLK,
  36. .size = SZ_2M
  37. }, {
  38. .name = "root",
  39. .offset = MTDPART_OFS_NXTBLK,
  40. .size = MTDPART_SIZ_FULL
  41. },
  42. };
  43. static struct resource rd88f6281_nand_resource = {
  44. .flags = IORESOURCE_MEM,
  45. .start = KIRKWOOD_NAND_MEM_PHYS_BASE,
  46. .end = KIRKWOOD_NAND_MEM_PHYS_BASE +
  47. KIRKWOOD_NAND_MEM_SIZE - 1,
  48. };
  49. static struct orion_nand_data rd88f6281_nand_data = {
  50. .parts = rd88f6281_nand_parts,
  51. .nr_parts = ARRAY_SIZE(rd88f6281_nand_parts),
  52. .cle = 0,
  53. .ale = 1,
  54. .width = 8,
  55. .chip_delay = 25,
  56. };
  57. static struct platform_device rd88f6281_nand_flash = {
  58. .name = "orion_nand",
  59. .id = -1,
  60. .dev = {
  61. .platform_data = &rd88f6281_nand_data,
  62. },
  63. .resource = &rd88f6281_nand_resource,
  64. .num_resources = 1,
  65. };
  66. static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
  67. .phy_addr = MV643XX_ETH_PHY_NONE,
  68. .speed = SPEED_1000,
  69. .duplex = DUPLEX_FULL,
  70. };
  71. static struct dsa_platform_data rd88f6281_switch_data = {
  72. .port_names[0] = "lan1",
  73. .port_names[1] = "lan2",
  74. .port_names[2] = "lan3",
  75. .port_names[3] = "lan4",
  76. .port_names[5] = "cpu",
  77. };
  78. static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
  79. .phy_addr = MV643XX_ETH_PHY_ADDR(11),
  80. };
  81. static struct mv_sata_platform_data rd88f6281_sata_data = {
  82. .n_ports = 2,
  83. };
  84. static void __init rd88f6281_init(void)
  85. {
  86. u32 dev, rev;
  87. /*
  88. * Basic setup. Needs to be called early.
  89. */
  90. kirkwood_init();
  91. kirkwood_ehci_init();
  92. kirkwood_ge00_init(&rd88f6281_ge00_data);
  93. kirkwood_pcie_id(&dev, &rev);
  94. if (rev == MV88F6281_REV_A0) {
  95. rd88f6281_switch_data.sw_addr = 10;
  96. kirkwood_ge01_init(&rd88f6281_ge01_data);
  97. } else {
  98. rd88f6281_switch_data.port_names[4] = "wan";
  99. }
  100. kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ);
  101. kirkwood_rtc_init();
  102. kirkwood_sata_init(&rd88f6281_sata_data);
  103. kirkwood_uart0_init();
  104. platform_device_register(&rd88f6281_nand_flash);
  105. }
  106. static int __init rd88f6281_pci_init(void)
  107. {
  108. if (machine_is_rd88f6281())
  109. kirkwood_pcie_init();
  110. return 0;
  111. }
  112. subsys_initcall(rd88f6281_pci_init);
  113. MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
  114. /* Maintainer: Saeed Bishara <saeed@marvell.com> */
  115. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  116. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  117. .boot_params = 0x00000100,
  118. .init_machine = rd88f6281_init,
  119. .map_io = kirkwood_map_io,
  120. .init_irq = kirkwood_init_irq,
  121. .timer = &kirkwood_timer,
  122. MACHINE_END