board-goflexnet.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
  3. *
  4. * arch/arm/mach-kirkwood/board-goflexnet.c
  5. *
  6. * Seagate GoFlext Net Board Init for drivers not converted to
  7. * flattened device tree yet.
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. *
  13. * Copied and modified for Seagate GoFlex Net support by
  14. * Joshua Coombs <josh.coombs@gmail.com> based on ArchLinux ARM's
  15. * GoFlex kernel patches.
  16. *
  17. */
  18. #include <linux/kernel.h>
  19. #include <linux/init.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/ata_platform.h>
  22. #include <linux/mv643xx_eth.h>
  23. #include <linux/of.h>
  24. #include <linux/of_address.h>
  25. #include <linux/of_fdt.h>
  26. #include <linux/of_irq.h>
  27. #include <linux/of_platform.h>
  28. #include <linux/gpio.h>
  29. #include <linux/leds.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/map.h>
  33. #include <mach/kirkwood.h>
  34. #include <mach/bridge-regs.h>
  35. #include <plat/mvsdio.h>
  36. #include "common.h"
  37. #include "mpp.h"
  38. static struct mv643xx_eth_platform_data goflexnet_ge00_data = {
  39. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  40. };
  41. static struct mv_sata_platform_data goflexnet_sata_data = {
  42. .n_ports = 2,
  43. };
  44. static struct gpio_led goflexnet_led_pins[] = {
  45. {
  46. .name = "status:green:health",
  47. .default_trigger = "default-on",
  48. .gpio = 46,
  49. .active_low = 1,
  50. },
  51. {
  52. .name = "status:orange:fault",
  53. .default_trigger = "none",
  54. .gpio = 47,
  55. .active_low = 1,
  56. },
  57. {
  58. .name = "status:white:left0",
  59. .default_trigger = "none",
  60. .gpio = 42,
  61. .active_low = 0,
  62. },
  63. {
  64. .name = "status:white:left1",
  65. .default_trigger = "none",
  66. .gpio = 43,
  67. .active_low = 0,
  68. },
  69. {
  70. .name = "status:white:left2",
  71. .default_trigger = "none",
  72. .gpio = 44,
  73. .active_low = 0,
  74. },
  75. {
  76. .name = "status:white:left3",
  77. .default_trigger = "none",
  78. .gpio = 45,
  79. .active_low = 0,
  80. },
  81. {
  82. .name = "status:white:right0",
  83. .default_trigger = "none",
  84. .gpio = 38,
  85. .active_low = 0,
  86. },
  87. {
  88. .name = "status:white:right1",
  89. .default_trigger = "none",
  90. .gpio = 39,
  91. .active_low = 0,
  92. },
  93. {
  94. .name = "status:white:right2",
  95. .default_trigger = "none",
  96. .gpio = 40,
  97. .active_low = 0,
  98. },
  99. {
  100. .name = "status:white:right3",
  101. .default_trigger = "none",
  102. .gpio = 41,
  103. .active_low = 0,
  104. },
  105. };
  106. static struct gpio_led_platform_data goflexnet_led_data = {
  107. .leds = goflexnet_led_pins,
  108. .num_leds = ARRAY_SIZE(goflexnet_led_pins),
  109. };
  110. static struct platform_device goflexnet_leds = {
  111. .name = "leds-gpio",
  112. .id = -1,
  113. .dev = {
  114. .platform_data = &goflexnet_led_data,
  115. }
  116. };
  117. static unsigned int goflexnet_mpp_config[] __initdata = {
  118. MPP29_GPIO, /* USB Power Enable */
  119. MPP47_GPIO, /* LED Orange */
  120. MPP46_GPIO, /* LED Green */
  121. MPP45_GPIO, /* LED Left Capacity 3 */
  122. MPP44_GPIO, /* LED Left Capacity 2 */
  123. MPP43_GPIO, /* LED Left Capacity 1 */
  124. MPP42_GPIO, /* LED Left Capacity 0 */
  125. MPP41_GPIO, /* LED Right Capacity 3 */
  126. MPP40_GPIO, /* LED Right Capacity 2 */
  127. MPP39_GPIO, /* LED Right Capacity 1 */
  128. MPP38_GPIO, /* LED Right Capacity 0 */
  129. 0
  130. };
  131. void __init goflexnet_init(void)
  132. {
  133. /*
  134. * Basic setup. Needs to be called early.
  135. */
  136. kirkwood_mpp_conf(goflexnet_mpp_config);
  137. if (gpio_request(29, "USB Power Enable") != 0 ||
  138. gpio_direction_output(29, 1) != 0)
  139. pr_err("can't setup GPIO 29 (USB Power Enable)\n");
  140. kirkwood_ehci_init();
  141. kirkwood_ge00_init(&goflexnet_ge00_data);
  142. kirkwood_sata_init(&goflexnet_sata_data);
  143. platform_device_register(&goflexnet_leds);
  144. }