rd88f6281-setup.c 3.5 KB

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