2 * TP-LINK TL-WA901ND v4, v5 board
4 * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
5 * Copyright (C) 2016 Tiziano Bacocco <tizbac2@gmail.com>
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.
12 #include <linux/gpio.h>
13 #include <linux/platform_device.h>
15 #include <asm/mach-ath79/ath79.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
20 #include "dev-gpio-buttons.h"
21 #include "dev-leds-gpio.h"
22 #include "dev-m25p80.h"
24 #include "machtypes.h"
27 #define TL_WA901ND_V4_GPIO_LED_QSS 3
28 #define TL_WA901ND_V4_GPIO_LED_LAN 7
29 #define TL_WA901ND_V4_GPIO_LED_WLAN 8
30 #define TL_WA901ND_V4_GPIO_LED_SYSTEM 18
32 #define TL_WA901ND_V4_GPIO_BTN_RESET 1
34 #define TL_WA901ND_V4_KEYS_POLL_INTERVAL 20
35 #define TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_V4_KEYS_POLL_INTERVAL)
38 static struct gpio_led TL_WA901ND_V4_leds_gpio[] __initdata = {
40 .name = "tp-link:green:qss",
41 .gpio = TL_WA901ND_V4_GPIO_LED_QSS,
45 .name = "tp-link:green:lan",
46 .gpio = TL_WA901ND_V4_GPIO_LED_LAN,
50 .name = "tp-link:green:wlan",
51 .gpio = TL_WA901ND_V4_GPIO_LED_WLAN,
55 .name = "tp-link:green:system",
56 .gpio = TL_WA901ND_V4_GPIO_LED_SYSTEM,
61 static struct gpio_keys_button TL_WA901ND_V4_gpio_keys[] __initdata = {
63 .desc = "Reset button",
66 .debounce_interval = TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL,
67 .gpio = TL_WA901ND_V4_GPIO_BTN_RESET,
73 static const char *tl_wa901nd_v4_part_probes[] = {
78 static struct flash_platform_data tl_wa901nd_v4_flash_data = {
79 .part_probes = tl_wa901nd_v4_part_probes,
83 static void __init TL_WA901ND_V4_setup(void)
85 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
86 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
88 ath79_register_m25p80(&tl_wa901nd_v4_flash_data);
90 ath79_register_leds_gpio(-1, ARRAY_SIZE(TL_WA901ND_V4_leds_gpio),
91 TL_WA901ND_V4_leds_gpio);
93 ath79_register_gpio_keys_polled(-1, TL_WA901ND_V4_KEYS_POLL_INTERVAL,
94 ARRAY_SIZE(TL_WA901ND_V4_gpio_keys),
95 TL_WA901ND_V4_gpio_keys);
97 ath79_register_mdio(0, 0x0);
99 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
100 ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
102 ath79_switch_data.phy4_mii_en = 1;
104 ath79_register_eth(0);
105 ath79_register_eth(1);
107 ath79_register_wmac(ee, mac);
111 MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V4, "TL-WA901ND-v4", "TP-LINK TL-WA901ND v4",
112 TL_WA901ND_V4_setup);
114 MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V5, "TL-WA901ND-v5", "TP-LINK TL-WA901ND v5",
115 TL_WA901ND_V4_setup);