mach-tl-wa7210n-v2.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * TP-LINK TL-WA7210N v2.1 board support
  3. *
  4. * Copyright (C) 2011 dongyuqi <729650915@qq.com>
  5. * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
  6. * Copyright (C) 2014 Nicolas Braud-Santoni <nicolas@braud-santoni.eu>
  7. * Copyright (C) 2014 Alexander List <alex@graz.funkfeuer.at>
  8. * Copyright (C) 2015 Hendrik Frenzel <hfrenzel@scunc.net>
  9. *
  10. * rebased on TL-WA7510Nv1 support,
  11. * Copyright (C) 2012 Stefan Helmert <helst_listen@aol.de>
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License version 2 as published
  15. * by the Free Software Foundation.
  16. */
  17. #include <linux/mtd/mtd.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/gpio.h>
  21. #include <asm/mach-ath79/ar71xx_regs.h>
  22. #include <asm/mach-ath79/ath79.h>
  23. #include "dev-dsa.h"
  24. #include "dev-eth.h"
  25. #include "dev-gpio-buttons.h"
  26. #include "dev-leds-gpio.h"
  27. #include "dev-m25p80.h"
  28. #include "dev-wmac.h"
  29. #include "machtypes.h"
  30. #include "pci.h"
  31. #include "common.h"
  32. #define TL_WA7210N_V2_GPIO_BTN_RESET 11
  33. #define TL_WA7210N_V2_KEYS_POLL_INT 20
  34. #define TL_WA7210N_V2_KEYS_DEBOUNCE_INT (3 * TL_WA7210N_V2_KEYS_POLL_INT)
  35. #define TL_WA7210N_V2_GPIO_LED_LAN 17
  36. #define TL_WA7210N_V2_GPIO_LED_SIG1 0
  37. #define TL_WA7210N_V2_GPIO_LED_SIG2 1
  38. #define TL_WA7210N_V2_GPIO_LED_SIG3 27
  39. #define TL_WA7210N_V2_GPIO_LED_SIG4 26
  40. #define TL_WA7210N_V2_GPIO_LNA_EN 28
  41. static const char *tl_wa7210n_v2_part_probes[] = {
  42. "tp-link",
  43. NULL,
  44. };
  45. static struct gpio_keys_button tl_wa7210n_v2_gpio_keys[] __initdata = {
  46. {
  47. .desc = "reset",
  48. .type = EV_KEY,
  49. .code = KEY_RESTART,
  50. .debounce_interval = TL_WA7210N_V2_KEYS_DEBOUNCE_INT,
  51. .gpio = TL_WA7210N_V2_GPIO_BTN_RESET,
  52. .active_low = 0,
  53. },
  54. };
  55. static struct gpio_led tl_wa7210n_v2_leds_gpio[] __initdata = {
  56. {
  57. .name = "tp-link:green:lan",
  58. .gpio = TL_WA7210N_V2_GPIO_LED_LAN,
  59. .active_low = 1,
  60. }, {
  61. .name = "tp-link:green:signal1",
  62. .gpio = TL_WA7210N_V2_GPIO_LED_SIG1,
  63. .active_low = 0,
  64. }, {
  65. .name = "tp-link:green:signal2",
  66. .gpio = TL_WA7210N_V2_GPIO_LED_SIG2,
  67. .active_low = 0,
  68. }, {
  69. .name = "tp-link:green:signal3",
  70. .gpio = TL_WA7210N_V2_GPIO_LED_SIG3,
  71. .active_low = 1,
  72. }, {
  73. .name = "tp-link:green:signal4",
  74. .gpio = TL_WA7210N_V2_GPIO_LED_SIG4,
  75. .active_low = 1,
  76. },
  77. };
  78. static struct flash_platform_data tl_wa7210n_v2_flash_data = {
  79. .part_probes = tl_wa7210n_v2_part_probes,
  80. };
  81. static void __init tl_wa7210n_v2_setup(void)
  82. {
  83. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  84. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  85. ath79_register_gpio_keys_polled(-1, TL_WA7210N_V2_KEYS_POLL_INT,
  86. ARRAY_SIZE(tl_wa7210n_v2_gpio_keys),
  87. tl_wa7210n_v2_gpio_keys);
  88. ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa7210n_v2_leds_gpio),
  89. tl_wa7210n_v2_leds_gpio);
  90. ath79_gpio_function_enable(TL_WA7210N_V2_GPIO_LNA_EN);
  91. ath79_setup_ar933x_phy4_switch(false, false);
  92. ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1);
  93. ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
  94. ath79_register_eth(0);
  95. ath79_register_eth(1);
  96. ath79_register_mdio(0, 0x0);
  97. ath79_register_wmac(ee, mac);
  98. ath79_register_m25p80(&tl_wa7210n_v2_flash_data);
  99. ath79_register_pci();
  100. }
  101. MIPS_MACHINE(ATH79_MACH_TL_WA7210N_V2, "TL-WA7210N-v2", "TP-LINK TL-WA7210N v2",
  102. tl_wa7210n_v2_setup);