mach-tl-wa901nd-v2.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * TP-LINK TL-WA901N/ND v2 board support
  3. *
  4. * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
  5. * Copyright (C) 2010 Pieter Hollants <pieter@hollants.com>
  6. * Copyright (C) 2011 Jonathan Bennett <jbscience87@gmail.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published
  10. * by the Free Software Foundation.
  11. */
  12. #include <asm/mach-ath79/ath79.h>
  13. #include <asm/mach-ath79/ar71xx_regs.h>
  14. #include "dev-eth.h"
  15. #include "dev-m25p80.h"
  16. #include "dev-gpio-buttons.h"
  17. #include "dev-leds-gpio.h"
  18. #include "dev-wmac.h"
  19. #include "machtypes.h"
  20. #define TL_WA901ND_V2_GPIO_LED_QSS 4
  21. #define TL_WA901ND_V2_GPIO_LED_SYSTEM 2
  22. #define TL_WA901ND_V2_GPIO_LED_WLAN 9
  23. #define TL_WA901ND_V2_GPIO_BTN_RESET 3
  24. #define TL_WA901ND_V2_GPIO_BTN_QSS 7
  25. #define TL_WA901ND_V2_KEYS_POLL_INTERVAL 20 /* msecs */
  26. #define TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL \
  27. (3 * TL_WA901ND_V2_KEYS_POLL_INTERVAL)
  28. static const char *tl_wa901nd_v2_part_probes[] = {
  29. "tp-link",
  30. NULL,
  31. };
  32. static struct flash_platform_data tl_wa901nd_v2_flash_data = {
  33. .part_probes = tl_wa901nd_v2_part_probes,
  34. };
  35. static struct gpio_led tl_wa901nd_v2_leds_gpio[] __initdata = {
  36. {
  37. .name = "tp-link:green:system",
  38. .gpio = TL_WA901ND_V2_GPIO_LED_SYSTEM,
  39. .active_low = 1,
  40. }, {
  41. .name = "tp-link:green:qss",
  42. .gpio = TL_WA901ND_V2_GPIO_LED_QSS,
  43. }, {
  44. .name = "tp-link:green:wlan",
  45. .gpio = TL_WA901ND_V2_GPIO_LED_WLAN,
  46. .active_low = 1,
  47. }
  48. };
  49. static struct gpio_keys_button tl_wa901nd_v2_gpio_keys[] __initdata = {
  50. {
  51. .desc = "reset",
  52. .type = EV_KEY,
  53. .code = KEY_RESTART,
  54. .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL,
  55. .gpio = TL_WA901ND_V2_GPIO_BTN_RESET,
  56. .active_low = 1,
  57. }, {
  58. .desc = "qss",
  59. .type = EV_KEY,
  60. .code = KEY_WPS_BUTTON,
  61. .debounce_interval = TL_WA901ND_V2_KEYS_DEBOUNCE_INTERVAL,
  62. .gpio = TL_WA901ND_V2_GPIO_BTN_QSS,
  63. .active_low = 1,
  64. }
  65. };
  66. static void __init tl_wa901nd_v2_setup(void)
  67. {
  68. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  69. u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
  70. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
  71. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  72. ath79_eth0_data.phy_mask = 0x00001000;
  73. ath79_register_mdio(0, 0x0);
  74. ath79_eth0_data.reset_bit = AR71XX_RESET_GE0_MAC |
  75. AR71XX_RESET_GE0_PHY;
  76. ath79_register_eth(0);
  77. ath79_register_m25p80(&tl_wa901nd_v2_flash_data);
  78. ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_v2_leds_gpio),
  79. tl_wa901nd_v2_leds_gpio);
  80. ath79_register_gpio_keys_polled(-1, TL_WA901ND_V2_KEYS_POLL_INTERVAL,
  81. ARRAY_SIZE(tl_wa901nd_v2_gpio_keys),
  82. tl_wa901nd_v2_gpio_keys);
  83. ath79_register_wmac(eeprom, mac);
  84. }
  85. MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V2, "TL-WA901ND-v2",
  86. "TP-LINK TL-WA901ND v2", tl_wa901nd_v2_setup);