dockstar-setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * arch/arm/mach-kirkwood/dockstar-setup.c
  3. *
  4. * Seagate FreeAgent DockStar 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 dockstar_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 dockstar_ge00_data = {
  40. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  41. };
  42. static struct gpio_led dockstar_led_pins[] = {
  43. {
  44. .name = "dockstar:green:health",
  45. .default_trigger = "default-on",
  46. .gpio = 46,
  47. .active_low = 1,
  48. },
  49. {
  50. .name = "dockstar:orange:misc",
  51. .default_trigger = "none",
  52. .gpio = 47,
  53. .active_low = 1,
  54. },
  55. };
  56. static struct gpio_led_platform_data dockstar_led_data = {
  57. .leds = dockstar_led_pins,
  58. .num_leds = ARRAY_SIZE(dockstar_led_pins),
  59. };
  60. static struct platform_device dockstar_leds = {
  61. .name = "leds-gpio",
  62. .id = -1,
  63. .dev = {
  64. .platform_data = &dockstar_led_data,
  65. }
  66. };
  67. static unsigned int dockstar_mpp_config[] __initdata = {
  68. MPP29_GPIO, /* USB Power Enable */
  69. MPP46_GPIO, /* LED green */
  70. MPP47_GPIO, /* LED orange */
  71. 0
  72. };
  73. static void __init dockstar_init(void)
  74. {
  75. /*
  76. * Basic setup. Needs to be called early.
  77. */
  78. kirkwood_init();
  79. /* setup gpio pin select */
  80. kirkwood_mpp_conf(dockstar_mpp_config);
  81. kirkwood_uart0_init();
  82. kirkwood_nand_init(ARRAY_AND_SIZE(dockstar_nand_parts), 25);
  83. if (gpio_request(29, "USB Power Enable") != 0 ||
  84. gpio_direction_output(29, 1) != 0)
  85. printk(KERN_ERR "can't set up GPIO 29 (USB Power Enable)\n");
  86. kirkwood_ehci_init();
  87. kirkwood_ge00_init(&dockstar_ge00_data);
  88. platform_device_register(&dockstar_leds);
  89. }
  90. MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
  91. .boot_params = 0x00000100,
  92. .init_machine = dockstar_init,
  93. .map_io = kirkwood_map_io,
  94. .init_early = kirkwood_init_early,
  95. .init_irq = kirkwood_init_irq,
  96. .timer = &kirkwood_timer,
  97. MACHINE_END