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 "common.h"
  22. #include "mpp.h"
  23. static struct mtd_partition dockstar_nand_parts[] = {
  24. {
  25. .name = "u-boot",
  26. .offset = 0,
  27. .size = SZ_1M
  28. }, {
  29. .name = "uImage",
  30. .offset = MTDPART_OFS_NXTBLK,
  31. .size = SZ_4M
  32. }, {
  33. .name = "root",
  34. .offset = MTDPART_OFS_NXTBLK,
  35. .size = MTDPART_SIZ_FULL
  36. },
  37. };
  38. static struct mv643xx_eth_platform_data dockstar_ge00_data = {
  39. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  40. };
  41. static struct gpio_led dockstar_led_pins[] = {
  42. {
  43. .name = "dockstar:green:health",
  44. .default_trigger = "default-on",
  45. .gpio = 46,
  46. .active_low = 1,
  47. },
  48. {
  49. .name = "dockstar:orange:misc",
  50. .default_trigger = "none",
  51. .gpio = 47,
  52. .active_low = 1,
  53. },
  54. };
  55. static struct gpio_led_platform_data dockstar_led_data = {
  56. .leds = dockstar_led_pins,
  57. .num_leds = ARRAY_SIZE(dockstar_led_pins),
  58. };
  59. static struct platform_device dockstar_leds = {
  60. .name = "leds-gpio",
  61. .id = -1,
  62. .dev = {
  63. .platform_data = &dockstar_led_data,
  64. }
  65. };
  66. static unsigned int dockstar_mpp_config[] __initdata = {
  67. MPP29_GPIO, /* USB Power Enable */
  68. MPP46_GPIO, /* LED green */
  69. MPP47_GPIO, /* LED orange */
  70. 0
  71. };
  72. static void __init dockstar_init(void)
  73. {
  74. /*
  75. * Basic setup. Needs to be called early.
  76. */
  77. kirkwood_init();
  78. /* setup gpio pin select */
  79. kirkwood_mpp_conf(dockstar_mpp_config);
  80. kirkwood_uart0_init();
  81. kirkwood_nand_init(ARRAY_AND_SIZE(dockstar_nand_parts), 25);
  82. if (gpio_request(29, "USB Power Enable") != 0 ||
  83. gpio_direction_output(29, 1) != 0)
  84. pr_err("can't set up GPIO 29 (USB Power Enable)\n");
  85. kirkwood_ehci_init();
  86. kirkwood_ge00_init(&dockstar_ge00_data);
  87. platform_device_register(&dockstar_leds);
  88. }
  89. MACHINE_START(DOCKSTAR, "Seagate FreeAgent DockStar")
  90. .atag_offset = 0x100,
  91. .init_machine = dockstar_init,
  92. .map_io = kirkwood_map_io,
  93. .init_early = kirkwood_init_early,
  94. .init_irq = kirkwood_init_irq,
  95. .init_time = kirkwood_timer_init,
  96. .restart = kirkwood_restart,
  97. MACHINE_END