Revert "ar71xx: Allow to set the RXDV, RXD, TXD, TXE delays for QCA955x"
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-tl-wa701nd-v2.c
1 /*
2  *  TP-LINK TL-WA701ND v2 board support
3  *
4  *  Copyright (C) 2015 Luigi Tarenga <luigi.tarenga@gmail.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify it
7  *  under the terms of the GNU General Public License version 2 as published
8  *  by the Free Software Foundation.
9  */
10
11 #include <linux/gpio.h>
12
13 #include <asm/mach-ath79/ath79.h>
14
15 #include "dev-eth.h"
16 #include "dev-gpio-buttons.h"
17 #include "dev-leds-gpio.h"
18 #include "dev-m25p80.h"
19 #include "dev-usb.h"
20 #include "dev-wmac.h"
21 #include "machtypes.h"
22
23 #define TL_WA701NDV2_GPIO_LED_WLAN      0
24 #define TL_WA701NDV2_GPIO_LED_QSS       1
25 #define TL_WA701NDV2_GPIO_LED_LAN       17
26 #define TL_WA701NDV2_GPIO_LED_SYSTEM    27
27
28 #define TL_WA701NDV2_GPIO_BTN_RESET     11
29 #define TL_WA701NDV2_GPIO_BTN_QSS       26
30
31 #define TL_WA701NDV2_GPIO_USB_POWER     8
32
33 #define TL_WA701NDV2_KEYS_POLL_INTERVAL 20      /* msecs */
34 #define TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL     (3 * TL_WA701NDV2_KEYS_POLL_INTERVAL)
35
36 static const char *tl_wa701ndv2_part_probes[] = {
37         "tp-link",
38         NULL,
39 };
40
41 static struct flash_platform_data tl_wa701ndv2_flash_data = {
42         .part_probes    = tl_wa701ndv2_part_probes,
43 };
44
45 static struct gpio_led tl_wa701ndv2_leds_gpio[] __initdata = {
46         {
47                 .name           = "tp-link:green:wlan",
48                 .gpio           = TL_WA701NDV2_GPIO_LED_WLAN,
49                 .active_low     = 0,
50         }, {
51                 .name           = "tp-link:green:qss",
52                 .gpio           = TL_WA701NDV2_GPIO_LED_QSS,
53                 .active_low     = 0,
54         }, {
55                 .name           = "tp-link:green:lan",
56                 .gpio           = TL_WA701NDV2_GPIO_LED_LAN,
57                 .active_low     = 1,
58         }, {
59                 .name           = "tp-link:green:system",
60                 .gpio           = TL_WA701NDV2_GPIO_LED_SYSTEM,
61                 .active_low     = 1,
62         }
63 };
64
65 static struct gpio_keys_button tl_wa701ndv2_gpio_keys[] __initdata = {
66         {
67                 .desc           = "reset",
68                 .type           = EV_KEY,
69                 .code           = KEY_RESTART,
70                 .debounce_interval = TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL,
71                 .gpio           = TL_WA701NDV2_GPIO_BTN_RESET,
72                 .active_low     = 0,
73         } , {
74                 .desc           = "qss",
75                 .type           = EV_KEY,
76                 .code           = KEY_WPS_BUTTON,
77                 .debounce_interval = TL_WA701NDV2_KEYS_DEBOUNCE_INTERVAL,
78                 .gpio           = TL_WA701NDV2_GPIO_BTN_QSS,
79                 .active_low     = 0,
80         }
81
82 };
83
84 static void __init tl_wa701ndv2_setup(void)
85 {
86         u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
87         u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
88
89         /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
90         ath79_setup_ar933x_phy4_switch(false, false);
91
92         ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wa701ndv2_leds_gpio),
93                                  tl_wa701ndv2_leds_gpio);
94
95         ath79_register_gpio_keys_polled(-1, TL_WA701NDV2_KEYS_POLL_INTERVAL,
96                                         ARRAY_SIZE(tl_wa701ndv2_gpio_keys),
97                                         tl_wa701ndv2_gpio_keys);
98
99         gpio_request_one(TL_WA701NDV2_GPIO_USB_POWER,
100                          GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
101                          "USB power");
102         ath79_register_usb();
103
104         ath79_register_m25p80(&tl_wa701ndv2_flash_data);
105         ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
106         /* ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); */
107
108         ath79_register_mdio(0, 0x0);
109         ath79_register_eth(0);
110         ath79_register_eth(1);
111
112         ath79_register_wmac(ee, mac);
113 }
114
115 MIPS_MACHINE(ATH79_MACH_TL_WA701ND_V2, "TL-WA701ND-v2",
116              "TP-LINK TL-WA701ND v2", tl_wa701ndv2_setup);