board-iconnect.c 3.4 KB

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