mv88f6281gtw_ge-setup.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /*
  2. * arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
  3. *
  4. * Marvell 88F6281 GTW GE 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/pci.h>
  14. #include <linux/irq.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/timer.h>
  17. #include <linux/mv643xx_eth.h>
  18. #include <linux/ethtool.h>
  19. #include <linux/gpio.h>
  20. #include <linux/leds.h>
  21. #include <linux/input.h>
  22. #include <linux/gpio_keys.h>
  23. #include <linux/spi/flash.h>
  24. #include <linux/spi/spi.h>
  25. #include <net/dsa.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/pci.h>
  29. #include <mach/kirkwood.h>
  30. #include "common.h"
  31. #include "mpp.h"
  32. static struct mv643xx_eth_platform_data mv88f6281gtw_ge_ge00_data = {
  33. .phy_addr = MV643XX_ETH_PHY_NONE,
  34. .speed = SPEED_1000,
  35. .duplex = DUPLEX_FULL,
  36. };
  37. static struct dsa_chip_data mv88f6281gtw_ge_switch_chip_data = {
  38. .port_names[0] = "lan1",
  39. .port_names[1] = "lan2",
  40. .port_names[2] = "lan3",
  41. .port_names[3] = "lan4",
  42. .port_names[4] = "wan",
  43. .port_names[5] = "cpu",
  44. };
  45. static struct dsa_platform_data mv88f6281gtw_ge_switch_plat_data = {
  46. .nr_chips = 1,
  47. .chip = &mv88f6281gtw_ge_switch_chip_data,
  48. };
  49. static const struct flash_platform_data mv88f6281gtw_ge_spi_slave_data = {
  50. .type = "mx25l12805d",
  51. };
  52. static struct spi_board_info __initdata mv88f6281gtw_ge_spi_slave_info[] = {
  53. {
  54. .modalias = "m25p80",
  55. .platform_data = &mv88f6281gtw_ge_spi_slave_data,
  56. .irq = -1,
  57. .max_speed_hz = 50000000,
  58. .bus_num = 0,
  59. .chip_select = 0,
  60. },
  61. };
  62. static struct gpio_keys_button mv88f6281gtw_ge_button_pins[] = {
  63. {
  64. .code = KEY_RESTART,
  65. .gpio = 47,
  66. .desc = "SWR Button",
  67. .active_low = 1,
  68. }, {
  69. .code = KEY_WPS_BUTTON,
  70. .gpio = 46,
  71. .desc = "WPS Button",
  72. .active_low = 1,
  73. },
  74. };
  75. static struct gpio_keys_platform_data mv88f6281gtw_ge_button_data = {
  76. .buttons = mv88f6281gtw_ge_button_pins,
  77. .nbuttons = ARRAY_SIZE(mv88f6281gtw_ge_button_pins),
  78. };
  79. static struct platform_device mv88f6281gtw_ge_buttons = {
  80. .name = "gpio-keys",
  81. .id = -1,
  82. .num_resources = 0,
  83. .dev = {
  84. .platform_data = &mv88f6281gtw_ge_button_data,
  85. },
  86. };
  87. static struct gpio_led mv88f6281gtw_ge_led_pins[] = {
  88. {
  89. .name = "gtw:green:Status",
  90. .gpio = 20,
  91. .active_low = 0,
  92. }, {
  93. .name = "gtw:red:Status",
  94. .gpio = 21,
  95. .active_low = 0,
  96. }, {
  97. .name = "gtw:green:USB",
  98. .gpio = 12,
  99. .active_low = 0,
  100. },
  101. };
  102. static struct gpio_led_platform_data mv88f6281gtw_ge_led_data = {
  103. .leds = mv88f6281gtw_ge_led_pins,
  104. .num_leds = ARRAY_SIZE(mv88f6281gtw_ge_led_pins),
  105. };
  106. static struct platform_device mv88f6281gtw_ge_leds = {
  107. .name = "leds-gpio",
  108. .id = -1,
  109. .dev = {
  110. .platform_data = &mv88f6281gtw_ge_led_data,
  111. },
  112. };
  113. static unsigned int mv88f6281gtw_ge_mpp_config[] __initdata = {
  114. MPP12_GPO, /* Status#_USB pin */
  115. MPP20_GPIO, /* Status#_GLED pin */
  116. MPP21_GPIO, /* Status#_RLED pin */
  117. MPP46_GPIO, /* WPS_Switch pin */
  118. MPP47_GPIO, /* SW_Init pin */
  119. 0
  120. };
  121. static void __init mv88f6281gtw_ge_init(void)
  122. {
  123. /*
  124. * Basic setup. Needs to be called early.
  125. */
  126. kirkwood_init();
  127. kirkwood_mpp_conf(mv88f6281gtw_ge_mpp_config);
  128. kirkwood_ehci_init();
  129. kirkwood_ge00_init(&mv88f6281gtw_ge_ge00_data);
  130. kirkwood_ge00_switch_init(&mv88f6281gtw_ge_switch_plat_data, NO_IRQ);
  131. spi_register_board_info(mv88f6281gtw_ge_spi_slave_info,
  132. ARRAY_SIZE(mv88f6281gtw_ge_spi_slave_info));
  133. kirkwood_spi_init();
  134. kirkwood_uart0_init();
  135. platform_device_register(&mv88f6281gtw_ge_leds);
  136. platform_device_register(&mv88f6281gtw_ge_buttons);
  137. }
  138. static int __init mv88f6281gtw_ge_pci_init(void)
  139. {
  140. if (machine_is_mv88f6281gtw_ge())
  141. kirkwood_pcie_init(KW_PCIE0);
  142. return 0;
  143. }
  144. subsys_initcall(mv88f6281gtw_ge_pci_init);
  145. MACHINE_START(MV88F6281GTW_GE, "Marvell 88F6281 GTW GE Board")
  146. /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
  147. .atag_offset = 0x100,
  148. .init_machine = mv88f6281gtw_ge_init,
  149. .map_io = kirkwood_map_io,
  150. .init_early = kirkwood_init_early,
  151. .init_irq = kirkwood_init_irq,
  152. .init_time = kirkwood_timer_init,
  153. .restart = kirkwood_restart,
  154. MACHINE_END