mach-tl-wa901nd.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * TP-LINK TL-WA901N/ND v1, TL-WA7510N v1 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) 2012 Stefan Helmert <helst_listen@aol.de>
  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/ar71xx_regs.h>
  13. #include <asm/mach-ath79/ath79.h>
  14. #include "common.h"
  15. #include "dev-ap9x-pci.h"
  16. #include "dev-eth.h"
  17. #include "dev-gpio-buttons.h"
  18. #include "dev-leds-gpio.h"
  19. #include "dev-m25p80.h"
  20. #include "machtypes.h"
  21. #include "pci.h"
  22. #define TL_WA901ND_GPIO_LED_QSS 0
  23. #define TL_WA901ND_GPIO_LED_SYSTEM 1
  24. #define TL_WA901ND_GPIO_LED_LAN 13
  25. #define TL_WA901ND_GPIO_BTN_RESET 11
  26. #define TL_WA901ND_GPIO_BTN_QSS 12
  27. #define TL_WA901ND_KEYS_POLL_INTERVAL 20 /* msecs */
  28. #define TL_WA901ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_KEYS_POLL_INTERVAL)
  29. static const char *tl_wa901nd_part_probes[] = {
  30. "tp-link",
  31. NULL,
  32. };
  33. static struct flash_platform_data tl_wa901nd_flash_data = {
  34. .part_probes = tl_wa901nd_part_probes,
  35. };
  36. static struct gpio_led tl_wa901nd_leds_gpio[] __initdata = {
  37. {
  38. .name = "tp-link:green:lan",
  39. .gpio = TL_WA901ND_GPIO_LED_LAN,
  40. .active_low = 1,
  41. }, {
  42. .name = "tp-link:green:system",
  43. .gpio = TL_WA901ND_GPIO_LED_SYSTEM,
  44. .active_low = 1,
  45. }, {
  46. .name = "tp-link:green:qss",
  47. .gpio = TL_WA901ND_GPIO_LED_QSS,
  48. .active_low = 1,
  49. }
  50. };
  51. static struct gpio_keys_button tl_wa901nd_gpio_keys[] __initdata = {
  52. {
  53. .desc = "reset",
  54. .type = EV_KEY,
  55. .code = KEY_RESTART,
  56. .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL,
  57. .gpio = TL_WA901ND_GPIO_BTN_RESET,
  58. .active_low = 1,
  59. }, {
  60. .desc = "qss",
  61. .type = EV_KEY,
  62. .code = KEY_WPS_BUTTON,
  63. .debounce_interval = TL_WA901ND_KEYS_DEBOUNCE_INTERVAL,
  64. .gpio = TL_WA901ND_GPIO_BTN_QSS,
  65. .active_low = 1,
  66. }
  67. };
  68. static void __init common_setup(void)
  69. {
  70. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  71. /*
  72. * ath79_eth0 would be the WAN port, but is not connected.
  73. * ath79_eth1 connects to the internal switch chip, however
  74. * we have a single LAN port only.
  75. */
  76. ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
  77. ath79_register_mdio(0, 0x0);
  78. ath79_register_eth(1);
  79. ath79_register_m25p80(&tl_wa901nd_flash_data);
  80. }
  81. static void __init tl_wa901nd_setup(void)
  82. {
  83. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  84. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  85. ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
  86. AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
  87. AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
  88. AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
  89. AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
  90. common_setup();
  91. ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa901nd_leds_gpio),
  92. tl_wa901nd_leds_gpio);
  93. ath79_register_gpio_keys_polled(-1, TL_WA901ND_KEYS_POLL_INTERVAL,
  94. ARRAY_SIZE(tl_wa901nd_gpio_keys),
  95. tl_wa901nd_gpio_keys);
  96. ap91_pci_init(ee, mac);
  97. }
  98. MIPS_MACHINE(ATH79_MACH_TL_WA901ND, "TL-WA901ND", "TP-LINK TL-WA901ND",
  99. tl_wa901nd_setup);
  100. static void __init tl_wa7510n_v1_setup(void)
  101. {
  102. common_setup();
  103. ath79_register_pci();
  104. }
  105. MIPS_MACHINE(ATH79_MACH_TL_WA7510N_V1, "TL-WA7510N", "TP-LINK TL-WA7510N v1",
  106. tl_wa7510n_v1_setup);