mach-tl-wa901nd-v4.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * TP-LINK TL-WA901ND v4 board
  3. *
  4. * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
  5. * Copyright (C) 2016 Tiziano Bacocco <tizbac2@gmail.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/platform_device.h>
  13. #include <asm/mach-ath79/ath79.h>
  14. #include <asm/mach-ath79/ar71xx_regs.h>
  15. #include "common.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 "dev-wmac.h"
  21. #include "machtypes.h"
  22. #define TL_WA901ND_V4_GPIO_LED_QSS 3
  23. #define TL_WA901ND_V4_GPIO_LED_LAN 7
  24. #define TL_WA901ND_V4_GPIO_LED_WLAN 8
  25. #define TL_WA901ND_V4_GPIO_LED_SYSTEM 18
  26. #define TL_WA901ND_V4_GPIO_BTN_RESET 1
  27. #define TL_WA901ND_V4_KEYS_POLL_INTERVAL 20
  28. #define TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_V4_KEYS_POLL_INTERVAL)
  29. static struct gpio_led TL_WA901ND_V4_leds_gpio[] __initdata = {
  30. {
  31. .name = "tp-link:green:qss",
  32. .gpio = TL_WA901ND_V4_GPIO_LED_QSS,
  33. .active_low = 1,
  34. },
  35. {
  36. .name = "tp-link:green:lan",
  37. .gpio = TL_WA901ND_V4_GPIO_LED_LAN,
  38. .active_low = 1,
  39. },
  40. {
  41. .name = "tp-link:green:wlan",
  42. .gpio = TL_WA901ND_V4_GPIO_LED_WLAN,
  43. .active_low = 1,
  44. },
  45. {
  46. .name = "tp-link:green:system",
  47. .gpio = TL_WA901ND_V4_GPIO_LED_SYSTEM,
  48. .active_low = 1,
  49. },
  50. };
  51. static struct gpio_keys_button TL_WA901ND_V4_gpio_keys[] __initdata = {
  52. {
  53. .desc = "Reset button",
  54. .type = EV_KEY,
  55. .code = KEY_RESTART,
  56. .debounce_interval = TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL,
  57. .gpio = TL_WA901ND_V4_GPIO_BTN_RESET,
  58. .active_low = 1,
  59. }
  60. };
  61. static const char *tl_wa901nd_v4_part_probes[] = {
  62. "tp-link",
  63. NULL,
  64. };
  65. static struct flash_platform_data tl_wa901nd_v4_flash_data = {
  66. .part_probes = tl_wa901nd_v4_part_probes,
  67. };
  68. static void __init TL_WA901ND_V4_setup(void)
  69. {
  70. u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
  71. u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
  72. ath79_register_m25p80(&tl_wa901nd_v4_flash_data);
  73. ath79_register_leds_gpio(-1, ARRAY_SIZE(TL_WA901ND_V4_leds_gpio),
  74. TL_WA901ND_V4_leds_gpio);
  75. ath79_register_gpio_keys_polled(-1, TL_WA901ND_V4_KEYS_POLL_INTERVAL,
  76. ARRAY_SIZE(TL_WA901ND_V4_gpio_keys),
  77. TL_WA901ND_V4_gpio_keys);
  78. ath79_register_mdio(0, 0x0);
  79. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
  80. ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
  81. ath79_switch_data.phy4_mii_en = 1;
  82. ath79_register_eth(0);
  83. ath79_register_eth(1);
  84. ath79_register_wmac(ee, mac);
  85. }
  86. MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V4, "TL-WA901ND-v4", "TP-LINK TL-WA901ND v4",
  87. TL_WA901ND_V4_setup);