sheevaplug-setup.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * arch/arm/mach-kirkwood/sheevaplug-setup.c
  3. *
  4. * Marvell SheevaPlug 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/ata_platform.h>
  14. #include <linux/mtd/partitions.h>
  15. #include <linux/mv643xx_eth.h>
  16. #include <linux/gpio.h>
  17. #include <linux/leds.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <mach/kirkwood.h>
  21. #include <plat/mvsdio.h>
  22. #include "common.h"
  23. #include "mpp.h"
  24. static struct mtd_partition sheevaplug_nand_parts[] = {
  25. {
  26. .name = "u-boot",
  27. .offset = 0,
  28. .size = SZ_1M
  29. }, {
  30. .name = "uImage",
  31. .offset = MTDPART_OFS_NXTBLK,
  32. .size = SZ_4M
  33. }, {
  34. .name = "root",
  35. .offset = MTDPART_OFS_NXTBLK,
  36. .size = MTDPART_SIZ_FULL
  37. },
  38. };
  39. static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
  40. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  41. };
  42. static struct mv_sata_platform_data sheeva_esata_sata_data = {
  43. .n_ports = 2,
  44. };
  45. static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
  46. /* unfortunately the CD signal has not been connected */
  47. };
  48. static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
  49. .gpio_write_protect = 44, /* MPP44 used as SD write protect */
  50. .gpio_card_detect = 47, /* MPP47 used as SD card detect */
  51. };
  52. static struct gpio_led sheevaplug_led_pins[] = {
  53. {
  54. .name = "plug:green:health",
  55. .default_trigger = "default-on",
  56. .gpio = 49,
  57. .active_low = 1,
  58. },
  59. };
  60. static struct gpio_led_platform_data sheevaplug_led_data = {
  61. .leds = sheevaplug_led_pins,
  62. .num_leds = ARRAY_SIZE(sheevaplug_led_pins),
  63. };
  64. static struct platform_device sheevaplug_leds = {
  65. .name = "leds-gpio",
  66. .id = -1,
  67. .dev = {
  68. .platform_data = &sheevaplug_led_data,
  69. }
  70. };
  71. static unsigned int sheevaplug_mpp_config[] __initdata = {
  72. MPP29_GPIO, /* USB Power Enable */
  73. MPP49_GPIO, /* LED */
  74. 0
  75. };
  76. static unsigned int sheeva_esata_mpp_config[] __initdata = {
  77. MPP29_GPIO, /* USB Power Enable */
  78. MPP44_GPIO, /* SD Write Protect */
  79. MPP47_GPIO, /* SD Card Detect */
  80. MPP49_GPIO, /* LED Green */
  81. 0
  82. };
  83. static void __init sheevaplug_init(void)
  84. {
  85. /*
  86. * Basic setup. Needs to be called early.
  87. */
  88. kirkwood_init();
  89. /* setup gpio pin select */
  90. if (machine_is_sheeva_esata())
  91. kirkwood_mpp_conf(sheeva_esata_mpp_config);
  92. else
  93. kirkwood_mpp_conf(sheevaplug_mpp_config);
  94. kirkwood_uart0_init();
  95. kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
  96. if (gpio_request(29, "USB Power Enable") != 0 ||
  97. gpio_direction_output(29, 1) != 0)
  98. printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
  99. kirkwood_ehci_init();
  100. kirkwood_ge00_init(&sheevaplug_ge00_data);
  101. /* honor lower power consumption for plugs with out eSATA */
  102. if (machine_is_sheeva_esata())
  103. kirkwood_sata_init(&sheeva_esata_sata_data);
  104. /* enable sd wp and sd cd on plugs with esata */
  105. if (machine_is_sheeva_esata())
  106. kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
  107. else
  108. kirkwood_sdio_init(&sheevaplug_mvsdio_data);
  109. platform_device_register(&sheevaplug_leds);
  110. }
  111. #ifdef CONFIG_MACH_SHEEVAPLUG
  112. MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
  113. /* Maintainer: shadi Ammouri <shadi@marvell.com> */
  114. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  115. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  116. .boot_params = 0x00000100,
  117. .init_machine = sheevaplug_init,
  118. .map_io = kirkwood_map_io,
  119. .init_irq = kirkwood_init_irq,
  120. .timer = &kirkwood_timer,
  121. MACHINE_END
  122. #endif
  123. #ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
  124. MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
  125. .phys_io = KIRKWOOD_REGS_PHYS_BASE,
  126. .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
  127. .boot_params = 0x00000100,
  128. .init_machine = sheevaplug_init,
  129. .map_io = kirkwood_map_io,
  130. .init_irq = kirkwood_init_irq,
  131. .timer = &kirkwood_timer,
  132. MACHINE_END
  133. #endif