f9105fb0b6b5297114977d1975e0c28a8f21b764
[oweals/openwrt.git] / target / linux / ath79 / dts / ar9341_tplink_tl-wr842n-v2.dts
1 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2 /dts-v1/;
3
4 #include <dt-bindings/gpio/gpio.h>
5 #include <dt-bindings/input/input.h>
6
7 #include "ar9341.dtsi"
8
9 / {
10         model = "TP-Link TL-WR842N/ND v2";
11         compatible = "tplink,tl-wr842n-v2", "qca,ar9341";
12
13         aliases {
14                 serial0 = &uart;
15                 led-boot = &system;
16                 led-failsafe = &system;
17                 led-running = &system;
18                 led-upgrade = &system;
19         };
20
21         keys {
22                 compatible = "gpio-keys-polled";
23                 poll-interval = <20>;
24
25                 pinctrl-names = "default";
26                 pinctrl-0 = <&jtag_disable_pins>;
27
28                 reset {
29                         label = "Reset";
30                         linux,code = <KEY_RESTART>;
31                         gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
32                         debounce-interval = <60>;
33                 };
34
35                 rfkill {
36                         label = "WiFi";
37                         linux,code = <KEY_RFKILL>;
38                         gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
39                         debounce-interval = <60>;
40                 };
41         };
42
43         leds {
44                 compatible = "gpio-leds";
45
46                 system: power {
47                         label = "tp-link:green:power";
48                         gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
49                         default-state = "on";
50                 };
51
52                 wlan {
53                         label = "tp-link:green:wlan";
54                         gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
55                         default-state = "off";
56                         linux,default-trigger = "phy0tpt";
57                 };
58
59                 qss {
60                         label = "tp-link:green:qss";
61                         gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
62                         default-state = "off";
63                 };
64
65                 wan {
66                         label = "tp-link:green:wan";
67                         gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
68                         default-state = "off";
69                 };
70
71                 lan1 {
72                         label = "tp-link:green:lan1";
73                         gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
74                         default-state = "off";
75                 };
76
77                 lan2 {
78                         label = "tp-link:green:lan2";
79                         gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
80                         default-state = "off";
81                 };
82
83                 lan3 {
84                         label = "tp-link:green:lan3";
85                         gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
86                         default-state = "off";
87                 };
88
89                 lan4 {
90                         label = "tp-link:green:lan4";
91                         gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
92                         default-state = "off";
93                 };
94
95                 usb {
96                         label = "tp-link:green:usb";
97                         gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
98                         default-state = "off";
99                         trigger-sources = <&hub_port>;
100                         linux,default-trigger = "usbport";
101                 };
102         };
103
104         gpio-export {
105                 compatible = "gpio-export";
106
107                 gpio_usb_power {
108                         gpio-export,name = "tp-link:power:usb";
109                         gpio-export,output = <1>;
110                         gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
111                 };
112         };
113 };
114
115 &ref {
116         clock-frequency = <25000000>;
117 };
118
119 &uart {
120         status = "okay";
121 };
122
123 &gpio {
124         status = "okay";
125 };
126
127 &spi {
128         num-cs = <1>;
129
130         status = "okay";
131
132         flash@0 {
133                 compatible = "jedec,spi-nor";
134                 reg = <0>;
135                 spi-max-frequency = <25000000>;
136
137                 partitions {
138                         compatible = "fixed-partitions";
139                         #address-cells = <1>;
140                         #size-cells = <1>;
141
142                         uboot: partition@0 {
143                                 label = "u-boot";
144                                 reg = <0x000000 0x020000>;
145                                 read-only;
146                         };
147
148                         partition@20000 {
149                                 compatible = "tplink,firmware";
150                                 label = "firmware";
151                                 reg = <0x020000 0x7d0000>;
152                         };
153
154                         art: partition@7f0000 {
155                                 label = "art";
156                                 reg = <0x7f0000 0x010000>;
157                                 read-only;
158                         };
159                 };
160         };
161 };
162
163 &usb {
164         #address-cells = <1>;
165         #size-cells = <0>;
166         status = "okay";
167
168         hub_port: port@1 {
169                 reg = <1>;
170                 #trigger-source-cells = <0>;
171         };
172 };
173
174 &usb_phy {
175         status = "okay";
176 };
177
178 &eth0 {
179         status = "okay";
180
181         phy-handle = <&swphy0>;
182         mtd-mac-address = <&uboot 0x1fc00>;
183         mtd-mac-address-increment = <(-1)>;
184 };
185
186 &eth1 {
187         status = "okay";
188
189         phy-handle = <&swphy4>;
190         mtd-mac-address = <&uboot 0x1fc00>;
191         phy-mode = "gmii";
192         pll-data = <0x06000000 0x00000101 0x00001616>;
193
194         gmac-config {
195                 device = <&gmac>;
196                 switch-phy-swap = <1>;
197         };
198 };
199
200 &wmac {
201         status = "okay";
202
203         mtd-cal-data = <&art 0x1000>;
204         mtd-mac-address = <&uboot 0x1fc00>;
205 };