Revert "ar71xx: Allow to set the RXDV, RXD, TXD, TXE delays for QCA955x"
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-tl-wr941nd-v6.c
1 /*
2  *  TP-LINK TL-WR941N/ND v6 board support
3  *
4  *  Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
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 #include <linux/platform_device.h>
13
14 #include <asm/mach-ath79/ath79.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
16
17 #include "common.h"
18 #include "dev-eth.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
22 #include "dev-wmac.h"
23 #include "machtypes.h"
24
25
26 #define TL_WR941ND_V6_GPIO_LED_QSS              3
27 #define TL_WR941ND_V6_GPIO_LED_WAN              14
28 #define TL_WR941ND_V6_GPIO_LED_WAN_RED          15
29 #define TL_WR941ND_V6_GPIO_LED_LAN1             7
30 #define TL_WR941ND_V6_GPIO_LED_LAN2             6
31 #define TL_WR941ND_V6_GPIO_LED_LAN3             5
32 #define TL_WR941ND_V6_GPIO_LED_LAN4             4
33 #define TL_WR941ND_V6_GPIO_LED_WLAN             8
34 #define TL_WR941ND_V6_GPIO_LED_SYSTEM           18
35
36 #define TL_WR941ND_V6_GPIO_BTN_RESET            1
37 #define TL_WR941ND_V6_GPIO_BTN_RFKILL           2
38
39 #define TL_WR941ND_V6_KEYS_POLL_INTERVAL        20
40 #define TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL    (3 * TL_WR941ND_V6_KEYS_POLL_INTERVAL)
41
42
43 static struct gpio_led tl_wr941nd_v6_leds_gpio[] __initdata = {
44         {
45                 .name           = "tp-link:blue:qss",
46                 .gpio           = TL_WR941ND_V6_GPIO_LED_QSS,
47                 .active_low     = 1,
48         },
49         {
50                 .name           = "tp-link:blue:wan",
51                 .gpio           = TL_WR941ND_V6_GPIO_LED_WAN,
52                 .active_low     = 1,
53         },
54         {
55                 .name           = "tp-link:red:wan",
56                 .gpio           = TL_WR941ND_V6_GPIO_LED_WAN_RED,
57                 .active_low     = 0,
58         },
59         {
60                 .name           = "tp-link:blue:lan1",
61                 .gpio           = TL_WR941ND_V6_GPIO_LED_LAN1,
62                 .active_low     = 1,
63         },
64         {
65                 .name           = "tp-link:blue:lan2",
66                 .gpio           = TL_WR941ND_V6_GPIO_LED_LAN2,
67                 .active_low     = 1,
68         },
69         {
70                 .name           = "tp-link:blue:lan3",
71                 .gpio           = TL_WR941ND_V6_GPIO_LED_LAN3,
72                 .active_low     = 1,
73         },
74         {
75                 .name           = "tp-link:blue:lan4",
76                 .gpio           = TL_WR941ND_V6_GPIO_LED_LAN4,
77                 .active_low     = 1,
78         },
79         {
80                 .name           = "tp-link:blue:wlan",
81                 .gpio           = TL_WR941ND_V6_GPIO_LED_WLAN,
82                 .active_low     = 1,
83         },
84         {
85                 .name           = "tp-link:blue:system",
86                 .gpio           = TL_WR941ND_V6_GPIO_LED_SYSTEM,
87                 .active_low     = 1,
88         },
89 };
90
91 static struct gpio_keys_button tl_wr941nd_v6_gpio_keys[] __initdata = {
92         {
93                 .desc           = "Reset button",
94                 .type           = EV_KEY,
95                 .code           = KEY_RESTART,
96                 .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL,
97                 .gpio           = TL_WR941ND_V6_GPIO_BTN_RESET,
98                 .active_low     = 1,
99         }, {
100                 .desc           = "RFKILL button",
101                 .type           = EV_KEY,
102                 .code           = KEY_RFKILL,
103                 .debounce_interval = TL_WR941ND_V6_KEYS_DEBOUNCE_INTERVAL,
104                 .gpio           = TL_WR941ND_V6_GPIO_BTN_RFKILL,
105                 .active_low     = 1,
106         }
107 };
108
109
110 static const char *tl_wr941n_v6_part_probes[] = {
111         "tp-link",
112         NULL,
113 };
114
115 static struct flash_platform_data tl_wr941n_v6_flash_data = {
116         .part_probes    = tl_wr941n_v6_part_probes,
117 };
118
119
120 static void __init tl_wr941nd_v6_setup(void)
121 {
122         u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
123         u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
124
125         ath79_register_m25p80(&tl_wr941n_v6_flash_data);
126
127         ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr941nd_v6_leds_gpio),
128                                  tl_wr941nd_v6_leds_gpio);
129
130         ath79_register_gpio_keys_polled(-1, TL_WR941ND_V6_KEYS_POLL_INTERVAL,
131                                         ARRAY_SIZE(tl_wr941nd_v6_gpio_keys),
132                                         tl_wr941nd_v6_gpio_keys);
133
134         ath79_register_mdio(0, 0x0);
135
136         ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
137         ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
138
139         ath79_switch_data.phy4_mii_en = 1;
140
141         ath79_register_eth(0);
142         ath79_register_eth(1);
143
144         ath79_register_wmac(ee, mac);
145
146 }
147
148 MIPS_MACHINE(ATH79_MACH_TL_WR941ND_V6, "TL-WR941ND-v6", "TP-LINK TL-WR941N/ND v6",
149              tl_wr941nd_v6_setup);