Guest User

Untitled

a guest
Nov 19th, 2011
216
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * arch/arm/mach-kirkwood/iconnect-setup.c
  3. *
  4. * Iomega iConnect Wireless
  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.  
  11. #include <linux/kernel.h>
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/irq.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/mv643xx_eth.h>
  17. #include <linux/ethtool.h>
  18. #include <linux/gpio.h>
  19. #include <linux/gpio_keys.h>
  20. #include <linux/input.h>
  21. #include <linux/i2c.h>
  22. #include <linux/leds.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <mach/kirkwood.h>
  26. #include "common.h"
  27. #include "mpp.h"
  28.  
  29. static struct mtd_partition iconnect_nand_parts[] = {
  30. /*
  31. {
  32. .name = "u-boot",
  33. .offset = 0,
  34. .size = SZ_1M
  35. }, {
  36. .name = "uImage",
  37. .offset = MTDPART_OFS_NXTBLK,
  38. .size = SZ_1M + SZ_2M
  39. }, {
  40. .name = "rootfs",
  41. .offset = MTDPART_OFS_NXTBLK,
  42. .size = SZ_32M,
  43. }, {
  44. .name = "data",
  45. .offset = MTDPART_OFS_NXTBLK,
  46. .size = MTDPART_SIZ_FULL
  47. },
  48. */
  49. {
  50. .name = "u-boot",
  51. .offset = 0,
  52. .size = SZ_1M
  53. }, {
  54. .name = "uImage",
  55. .offset = MTDPART_OFS_NXTBLK,
  56. .size = SZ_2M
  57. }, {
  58. .name = "root",
  59. .offset = MTDPART_OFS_NXTBLK,
  60. .size = MTDPART_SIZ_FULL
  61. },
  62. };
  63.  
  64. static struct mv643xx_eth_platform_data iconnect_ge00_data = {
  65. .phy_addr = MV643XX_ETH_PHY_ADDR(11),
  66. };
  67.  
  68. static struct gpio_led iconnect_led_pins[] = {
  69. {
  70. .name = "iconnect:blue:power",
  71. .default_trigger = "default-on",
  72. .gpio = 42,
  73. },
  74. {
  75. .name = "iconnect:red:power",
  76. .gpio = 43,
  77. },
  78. {
  79. .name = "iconnect:blue:usb1",
  80. .gpio = 44,
  81. },
  82. {
  83. .name = "iconnect:blue:usb2",
  84. .gpio = 45,
  85. },
  86. {
  87. .name = "iconnect:blue:usb3",
  88. .gpio = 46,
  89. },
  90. {
  91. .name = "iconnect:blue:usb4",
  92. .gpio = 47,
  93. },
  94. {
  95. .name = "iconnect:blue:otb",
  96. .gpio = 48,
  97. },
  98. };
  99.  
  100. static struct gpio_led_platform_data iconnect_led_data = {
  101. .leds = iconnect_led_pins,
  102. .num_leds = ARRAY_SIZE(iconnect_led_pins),
  103. };
  104.  
  105. static struct platform_device iconnect_leds = {
  106. .name = "leds-gpio",
  107. .id = -1,
  108. .dev = {
  109. .platform_data = &iconnect_led_data,
  110. }
  111. };
  112.  
  113. #define ICONNECT_GPIO_KEY_RESET 12
  114. #define ICONNECT_GPIO_KEY_OTB 35
  115.  
  116. #define ICONNECT_SW_RESET 0x00
  117. #define ICONNECT_SW_OTB 0x01
  118.  
  119. static struct gpio_keys_button iconnect_buttons[] = {
  120. {
  121. .type = EV_SW,
  122. .code = ICONNECT_SW_RESET,
  123. .gpio = ICONNECT_GPIO_KEY_RESET,
  124. .desc = "Reset Button",
  125. .active_low = 1,
  126. .debounce_interval = 100,
  127. },
  128. {
  129. .type = EV_SW,
  130. .code = ICONNECT_SW_OTB,
  131. .gpio = ICONNECT_GPIO_KEY_OTB,
  132. .desc = "OTB Button",
  133. .active_low = 1,
  134. .debounce_interval = 100,
  135. },
  136. };
  137.  
  138. static struct gpio_keys_platform_data iconnect_button_data = {
  139. .buttons = iconnect_buttons,
  140. .nbuttons = ARRAY_SIZE(iconnect_buttons),
  141. };
  142.  
  143. static struct platform_device iconnect_button_device = {
  144. .name = "gpio-keys",
  145. .id = -1,
  146. .num_resources = 0,
  147. .dev = {
  148. .platform_data = &iconnect_button_data,
  149. },
  150. };
  151.  
  152. static unsigned int iconnect_mpp_config[] __initdata = {
  153. MPP12_GPIO, /*Input for reset button*/
  154. MPP35_GPIO, /*Input for OTB button*/
  155. MPP42_GPIO,
  156. MPP43_GPIO,
  157. MPP44_GPIO,
  158. MPP45_GPIO,
  159. MPP46_GPIO,
  160. MPP47_GPIO,
  161. MPP48_GPIO,
  162. 0
  163. };
  164.  
  165. static struct i2c_board_info __initdata iconnect_i2c_rtc = {
  166. I2C_BOARD_INFO("lm63", 0x4c),
  167. };
  168. static void __init iconnect_init(void)
  169. {
  170. u32 dev, rev;
  171.  
  172. /*
  173. * Basic setup. Needs to be called early.
  174. */
  175. kirkwood_init();
  176. kirkwood_mpp_conf(iconnect_mpp_config);
  177.  
  178. kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
  179. kirkwood_ehci_init();
  180.  
  181. kirkwood_ge00_init(&iconnect_ge00_data);
  182. kirkwood_pcie_id(&dev, &rev);
  183.  
  184. kirkwood_uart0_init();
  185.  
  186. platform_device_register(&iconnect_leds);
  187. platform_device_register(&iconnect_button_device);
  188.  
  189. kirkwood_i2c_init();
  190. i2c_register_board_info(0, &iconnect_i2c_rtc, 1);
  191. }
  192.  
  193. static int __init iconnect_pci_init(void)
  194. {
  195. if (machine_is_iconnect())
  196. kirkwood_pcie_init(KW_PCIE0);
  197.  
  198. return 0;
  199. }
  200. subsys_initcall(iconnect_pci_init);
  201.  
  202.  
  203. MACHINE_START(ICONNECT, "Iomega iConnect Wireless")
  204. .boot_params = 0x00000100,
  205. .init_machine = iconnect_init,
  206. .map_io = kirkwood_map_io,
  207. .init_irq = kirkwood_init_irq,
  208. .timer = &kirkwood_timer,
  209. MACHINE_END
  210.  
  211.  
RAW Paste Data