mv88f6281gtw_ge-setup.c 4.2 KB

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