mach-wlae-ag300n.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Buffalo WLAE-AG300N board support
  3. */
  4. #include <linux/gpio.h>
  5. #include <linux/mtd/mtd.h>
  6. #include <linux/mtd/partitions.h>
  7. #include <asm/mach-ath79/ath79.h>
  8. #include "dev-eth.h"
  9. #include "dev-ap9x-pci.h"
  10. #include "dev-gpio-buttons.h"
  11. #include "dev-leds-gpio.h"
  12. #include "dev-m25p80.h"
  13. #include "dev-usb.h"
  14. #include "machtypes.h"
  15. #define WLAEAG300N_MAC_OFFSET 0x20c
  16. #define WLAEAG300N_KEYS_POLL_INTERVAL 20 /* msecs */
  17. #define WLAEAG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLAEAG300N_KEYS_POLL_INTERVAL)
  18. static struct gpio_led wlaeag300n_leds_gpio[] __initdata = {
  19. /*
  20. * Note: Writing 1 into GPIO 13 will power down the device.
  21. */
  22. {
  23. .name = "buffalo:green:wireless",
  24. .gpio = 14,
  25. .active_low = 1,
  26. }, {
  27. .name = "buffalo:red:wireless",
  28. .gpio = 15,
  29. .active_low = 1,
  30. }, {
  31. .name = "buffalo:green:status",
  32. .gpio = 16,
  33. .active_low = 1,
  34. }, {
  35. .name = "buffalo:red:status",
  36. .gpio = 17,
  37. .active_low = 1,
  38. }
  39. };
  40. static struct gpio_keys_button wlaeag300n_gpio_keys[] __initdata = {
  41. {
  42. .desc = "function",
  43. .type = EV_KEY,
  44. .code = KEY_MODE,
  45. .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
  46. .gpio = 0,
  47. .active_low = 1,
  48. }, {
  49. .desc = "reset",
  50. .type = EV_KEY,
  51. .code = KEY_RESTART,
  52. .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
  53. .gpio = 1,
  54. .active_low = 1,
  55. }, {
  56. .desc = "power",
  57. .type = EV_KEY,
  58. .code = KEY_POWER,
  59. .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
  60. .gpio = 11,
  61. .active_low = 1,
  62. }, {
  63. .desc = "aoss",
  64. .type = EV_KEY,
  65. .code = KEY_WPS_BUTTON,
  66. .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
  67. .gpio = 12,
  68. .active_low = 1,
  69. }
  70. };
  71. static void __init wlaeag300n_setup(void)
  72. {
  73. u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1fff1000);
  74. u8 *mac1 = eeprom1 + WLAEAG300N_MAC_OFFSET;
  75. ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
  76. ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 1);
  77. ath79_register_mdio(0, ~(BIT(0) | BIT(4)));
  78. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  79. ath79_eth0_data.speed = SPEED_1000;
  80. ath79_eth0_data.duplex = DUPLEX_FULL;
  81. ath79_eth0_data.phy_mask = BIT(0);
  82. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  83. ath79_eth1_data.phy_mask = BIT(4);
  84. ath79_register_eth(0);
  85. ath79_register_eth(1);
  86. ath79_register_leds_gpio(-1, ARRAY_SIZE(wlaeag300n_leds_gpio),
  87. wlaeag300n_leds_gpio);
  88. ath79_register_gpio_keys_polled(-1, WLAEAG300N_KEYS_POLL_INTERVAL,
  89. ARRAY_SIZE(wlaeag300n_gpio_keys),
  90. wlaeag300n_gpio_keys);
  91. ath79_register_m25p80(NULL);
  92. ap91_pci_init(eeprom1, mac1);
  93. }
  94. MIPS_MACHINE(ATH79_MACH_WLAE_AG300N, "WLAE-AG300N",
  95. "Buffalo WLAE-AG300N", wlaeag300n_setup);