board-iconnect.c 3.5 KB

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