rd88f6281-setup.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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/mvsdio.h>
  27. #include <plat/orion_nand.h>
  28. #include "common.h"
  29. #include "mpp.h"
  30. static struct mtd_partition rd88f6281_nand_parts[] = {
  31. {
  32. .name = "u-boot",
  33. .offset = 0,
  34. .size = SZ_1M
  35. }, {
  36. .name = "uImage",
  37. .offset = MTDPART_OFS_NXTBLK,
  38. .size = SZ_2M
  39. }, {
  40. .name = "root",
  41. .offset = MTDPART_OFS_NXTBLK,
  42. .size = MTDPART_SIZ_FULL
  43. },
  44. };
  45. static struct resource rd88f6281_nand_resource = {
  46. .flags = IORESOURCE_MEM,
  47. .start = KIRKWOOD_NAND_MEM_PHYS_BASE,
  48. .end = KIRKWOOD_NAND_MEM_PHYS_BASE +
  49. KIRKWOOD_NAND_MEM_SIZE - 1,
  50. };
  51. static struct orion_nand_data rd88f6281_nand_data = {
  52. .parts = rd88f6281_nand_parts,
  53. .nr_parts = ARRAY_SIZE(rd88f6281_nand_parts),
  54. .cle = 0,
  55. .ale = 1,
  56. .width = 8,
  57. .chip_delay = 25,
  58. };
  59. static struct platform_device rd88f6281_nand_flash = {
  60. .name = "orion_nand",
  61. .id = -1,
  62. .dev = {
  63. .platform_data = &rd88f6281_nand_data,
  64. },
  65. .resource = &rd88f6281_nand_resource,
  66. .num_resources = 1,
  67. };
  68. static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
  69. .phy_addr = MV643XX_ETH_PHY_NONE,
  70. .speed = SPEED_1000,
  71. .duplex = DUPLEX_FULL,
  72. };
  73. static struct dsa_platform_data rd88f6281_switch_data = {
  74. .port_names[0] = "lan1",
  75. .port_names[1] = "lan2",
  76. .port_names[2] = "lan3",
  77. .port_names[3] = "lan4",
  78. .port_names[5] = "cpu",
  79. };
  80. static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
  81. .phy_addr = MV643XX_ETH_PHY_ADDR(11),
  82. };
  83. static struct mv_sata_platform_data rd88f6281_sata_data = {
  84. .n_ports = 2,
  85. };
  86. static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
  87. .gpio_card_detect = 28,
  88. };
  89. static unsigned int rd88f6281_mpp_config[] __initdata = {
  90. MPP28_GPIO,
  91. 0
  92. };
  93. static void __init rd88f6281_init(void)
  94. {
  95. u32 dev, rev;
  96. /*
  97. * Basic setup. Needs to be called early.
  98. */
  99. kirkwood_init();
  100. kirkwood_mpp_conf(rd88f6281_mpp_config);
  101. kirkwood_ehci_init();
  102. kirkwood_ge00_init(&rd88f6281_ge00_data);
  103. kirkwood_pcie_id(&dev, &rev);
  104. if (rev == MV88F6281_REV_A0) {
  105. rd88f6281_switch_data.sw_addr = 10;
  106. kirkwood_ge01_init(&rd88f6281_ge01_data);
  107. } else {
  108. rd88f6281_switch_data.port_names[4] = "wan";
  109. }
  110. kirkwood_ge00_switch_init(&rd88f6281_switch_data, NO_IRQ);
  111. kirkwood_rtc_init();
  112. kirkwood_sata_init(&rd88f6281_sata_data);
  113. kirkwood_sdio_init(&rd88f6281_mvsdio_data);
  114. kirkwood_uart0_init();
  115. kirkwood_xor0_init();
  116. kirkwood_xor1_init();
  117. platform_device_register(&rd88f6281_nand_flash);
  118. }
  119. static int __init rd88f6281_pci_init(void)
  120. {
  121. if (machine_is_rd88f6281())
  122. kirkwood_pcie_init();
  123. return 0;
  124. }
  125. subsys_initcall(rd88f6281_pci_init);
  126. MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
  127. /* Maintainer: Saeed Bishara <saeed@marvell.com> */
  128. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  129. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  130. .boot_params = 0x00000100,
  131. .init_machine = rd88f6281_init,
  132. .map_io = kirkwood_map_io,
  133. .init_irq = kirkwood_init_irq,
  134. .timer = &kirkwood_timer,
  135. MACHINE_END