sheevaplug-setup.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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:red:misc",
  55. .default_trigger = "none",
  56. .gpio = 46,
  57. .active_low = 1,
  58. },
  59. {
  60. .name = "plug:green:health",
  61. .default_trigger = "default-on",
  62. .gpio = 49,
  63. .active_low = 1,
  64. },
  65. };
  66. static struct gpio_led_platform_data sheevaplug_led_data = {
  67. .leds = sheevaplug_led_pins,
  68. .num_leds = ARRAY_SIZE(sheevaplug_led_pins),
  69. };
  70. static struct platform_device sheevaplug_leds = {
  71. .name = "leds-gpio",
  72. .id = -1,
  73. .dev = {
  74. .platform_data = &sheevaplug_led_data,
  75. }
  76. };
  77. static unsigned int sheevaplug_mpp_config[] __initdata = {
  78. MPP29_GPIO, /* USB Power Enable */
  79. MPP46_GPIO, /* LED Red */
  80. MPP49_GPIO, /* LED */
  81. 0
  82. };
  83. static unsigned int sheeva_esata_mpp_config[] __initdata = {
  84. MPP29_GPIO, /* USB Power Enable */
  85. MPP44_GPIO, /* SD Write Protect */
  86. MPP47_GPIO, /* SD Card Detect */
  87. MPP49_GPIO, /* LED Green */
  88. 0
  89. };
  90. static void __init sheevaplug_init(void)
  91. {
  92. /*
  93. * Basic setup. Needs to be called early.
  94. */
  95. kirkwood_init();
  96. /* setup gpio pin select */
  97. if (machine_is_esata_sheevaplug())
  98. kirkwood_mpp_conf(sheeva_esata_mpp_config);
  99. else
  100. kirkwood_mpp_conf(sheevaplug_mpp_config);
  101. kirkwood_uart0_init();
  102. kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
  103. if (gpio_request(29, "USB Power Enable") != 0 ||
  104. gpio_direction_output(29, 1) != 0)
  105. printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
  106. kirkwood_ehci_init();
  107. kirkwood_ge00_init(&sheevaplug_ge00_data);
  108. /* honor lower power consumption for plugs with out eSATA */
  109. if (machine_is_esata_sheevaplug())
  110. kirkwood_sata_init(&sheeva_esata_sata_data);
  111. /* enable sd wp and sd cd on plugs with esata */
  112. if (machine_is_esata_sheevaplug())
  113. kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
  114. else
  115. kirkwood_sdio_init(&sheevaplug_mvsdio_data);
  116. platform_device_register(&sheevaplug_leds);
  117. }
  118. #ifdef CONFIG_MACH_SHEEVAPLUG
  119. MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
  120. /* Maintainer: shadi Ammouri <shadi@marvell.com> */
  121. .atag_offset = 0x100,
  122. .init_machine = sheevaplug_init,
  123. .map_io = kirkwood_map_io,
  124. .init_early = kirkwood_init_early,
  125. .init_irq = kirkwood_init_irq,
  126. .timer = &kirkwood_timer,
  127. .restart = kirkwood_restart,
  128. MACHINE_END
  129. #endif
  130. #ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
  131. MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
  132. .atag_offset = 0x100,
  133. .init_machine = sheevaplug_init,
  134. .map_io = kirkwood_map_io,
  135. .init_early = kirkwood_init_early,
  136. .init_irq = kirkwood_init_irq,
  137. .timer = &kirkwood_timer,
  138. .restart = kirkwood_restart,
  139. MACHINE_END
  140. #endif