rd88f6281-setup.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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_chip_data rd88f6281_switch_chip_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 dsa_platform_data rd88f6281_switch_plat_data = {
  78. .nr_chips = 1,
  79. .chip = &rd88f6281_switch_chip_data,
  80. };
  81. static struct mv643xx_eth_platform_data rd88f6281_ge01_data = {
  82. .phy_addr = MV643XX_ETH_PHY_ADDR(11),
  83. };
  84. static struct mv_sata_platform_data rd88f6281_sata_data = {
  85. .n_ports = 2,
  86. };
  87. static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
  88. .gpio_card_detect = 28,
  89. };
  90. static unsigned int rd88f6281_mpp_config[] __initdata = {
  91. MPP28_GPIO,
  92. 0
  93. };
  94. static void __init rd88f6281_init(void)
  95. {
  96. u32 dev, rev;
  97. /*
  98. * Basic setup. Needs to be called early.
  99. */
  100. kirkwood_init();
  101. kirkwood_mpp_conf(rd88f6281_mpp_config);
  102. kirkwood_ehci_init();
  103. kirkwood_ge00_init(&rd88f6281_ge00_data);
  104. kirkwood_pcie_id(&dev, &rev);
  105. if (rev == MV88F6281_REV_A0) {
  106. rd88f6281_switch_chip_data.sw_addr = 10;
  107. kirkwood_ge01_init(&rd88f6281_ge01_data);
  108. } else {
  109. rd88f6281_switch_chip_data.port_names[4] = "wan";
  110. }
  111. kirkwood_ge00_switch_init(&rd88f6281_switch_plat_data, NO_IRQ);
  112. kirkwood_sata_init(&rd88f6281_sata_data);
  113. kirkwood_sdio_init(&rd88f6281_mvsdio_data);
  114. kirkwood_uart0_init();
  115. platform_device_register(&rd88f6281_nand_flash);
  116. }
  117. static int __init rd88f6281_pci_init(void)
  118. {
  119. if (machine_is_rd88f6281())
  120. kirkwood_pcie_init();
  121. return 0;
  122. }
  123. subsys_initcall(rd88f6281_pci_init);
  124. MACHINE_START(RD88F6281, "Marvell RD-88F6281 Reference Board")
  125. /* Maintainer: Saeed Bishara <saeed@marvell.com> */
  126. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  127. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  128. .boot_params = 0x00000100,
  129. .init_machine = rd88f6281_init,
  130. .map_io = kirkwood_map_io,
  131. .init_irq = kirkwood_init_irq,
  132. .timer = &kirkwood_timer,
  133. MACHINE_END