board-iconnect.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. * arch/arm/mach-kirkwood/board-iconnect.c
  3. *
  4. * Iomega i-connect 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/of.h>
  14. #include <linux/of_address.h>
  15. #include <linux/of_fdt.h>
  16. #include <linux/of_irq.h>
  17. #include <linux/of_platform.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <linux/mv643xx_eth.h>
  20. #include <linux/gpio.h>
  21. #include <linux/leds.h>
  22. #include <linux/input.h>
  23. #include <linux/gpio_keys.h>
  24. #include <asm/mach/arch.h>
  25. #include <mach/kirkwood.h>
  26. #include "common.h"
  27. #include "mpp.h"
  28. static struct mv643xx_eth_platform_data iconnect_ge00_data = {
  29. .phy_addr = MV643XX_ETH_PHY_ADDR(11),
  30. };
  31. static struct gpio_led iconnect_led_pins[] = {
  32. {
  33. .name = "led_level",
  34. .gpio = 41,
  35. .default_trigger = "default-on",
  36. }, {
  37. .name = "power:blue",
  38. .gpio = 42,
  39. .default_trigger = "timer",
  40. }, {
  41. .name = "power:red",
  42. .gpio = 43,
  43. }, {
  44. .name = "usb1:blue",
  45. .gpio = 44,
  46. }, {
  47. .name = "usb2:blue",
  48. .gpio = 45,
  49. }, {
  50. .name = "usb3:blue",
  51. .gpio = 46,
  52. }, {
  53. .name = "usb4:blue",
  54. .gpio = 47,
  55. }, {
  56. .name = "otb:blue",
  57. .gpio = 48,
  58. },
  59. };
  60. static struct gpio_led_platform_data iconnect_led_data = {
  61. .leds = iconnect_led_pins,
  62. .num_leds = ARRAY_SIZE(iconnect_led_pins),
  63. .gpio_blink_set = orion_gpio_led_blink_set,
  64. };
  65. static struct platform_device iconnect_leds = {
  66. .name = "leds-gpio",
  67. .id = -1,
  68. .dev = {
  69. .platform_data = &iconnect_led_data,
  70. }
  71. };
  72. static unsigned int iconnect_mpp_config[] __initdata = {
  73. MPP12_GPIO,
  74. MPP35_GPIO,
  75. MPP41_GPIO,
  76. MPP42_GPIO,
  77. MPP43_GPIO,
  78. MPP44_GPIO,
  79. MPP45_GPIO,
  80. MPP46_GPIO,
  81. MPP47_GPIO,
  82. MPP48_GPIO,
  83. 0
  84. };
  85. static struct mtd_partition iconnect_nand_parts[] = {
  86. {
  87. .name = "flash",
  88. .offset = 0,
  89. .size = MTDPART_SIZ_FULL,
  90. },
  91. };
  92. /* yikes... theses are the original input buttons */
  93. /* but I'm not convinced by the sw event choices */
  94. static struct gpio_keys_button iconnect_buttons[] = {
  95. {
  96. .type = EV_SW,
  97. .code = SW_LID,
  98. .gpio = 12,
  99. .desc = "Reset Button",
  100. .active_low = 1,
  101. .debounce_interval = 100,
  102. }, {
  103. .type = EV_SW,
  104. .code = SW_TABLET_MODE,
  105. .gpio = 35,
  106. .desc = "OTB Button",
  107. .active_low = 1,
  108. .debounce_interval = 100,
  109. },
  110. };
  111. static struct gpio_keys_platform_data iconnect_button_data = {
  112. .buttons = iconnect_buttons,
  113. .nbuttons = ARRAY_SIZE(iconnect_buttons),
  114. };
  115. static struct platform_device iconnect_button_device = {
  116. .name = "gpio-keys",
  117. .id = -1,
  118. .num_resources = 0,
  119. .dev = {
  120. .platform_data = &iconnect_button_data,
  121. },
  122. };
  123. void __init iconnect_init(void)
  124. {
  125. kirkwood_mpp_conf(iconnect_mpp_config);
  126. kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
  127. kirkwood_ehci_init();
  128. kirkwood_ge00_init(&iconnect_ge00_data);
  129. platform_device_register(&iconnect_button_device);
  130. platform_device_register(&iconnect_leds);
  131. }
  132. static int __init iconnect_pci_init(void)
  133. {
  134. if (of_machine_is_compatible("iom,iconnect"))
  135. kirkwood_pcie_init(KW_PCIE0);
  136. return 0;
  137. }
  138. subsys_initcall(iconnect_pci_init);