f2dbac3c7ca87dd7b6361533de69fd660cfe51b1
[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";
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                                 label = "firmware";
150                                 reg = <0x020000 0x7d0000>;
151                         };
152
153                         art: partition@7f0000 {
154                                 label = "art";
155                                 reg = <0x7f0000 0x010000>;
156                                 read-only;
157                         };
158                 };
159         };
160 };
161
162 &usb {
163         #address-cells = <1>;
164         #size-cells = <0>;
165         status = "okay";
166
167         hub_port: port@1 {
168                 reg = <1>;
169                 #trigger-source-cells = <0>;
170         };
171 };
172
173 &usb_phy {
174         status = "okay";
175 };
176
177 &eth0 {
178         status = "okay";
179
180         phy-handle = <&swphy0>;
181         mtd-mac-address = <&uboot 0x1fc00>;
182         mtd-mac-address-increment = <(-1)>;
183 };
184
185 &eth1 {
186         status = "okay";
187
188         phy-handle = <&swphy4>;
189         mtd-mac-address = <&uboot 0x1fc00>;
190         phy-mode = "gmii";
191         pll-data = <0x06000000 0x00000101 0x00001616>;
192
193         gmac-config {
194                 device = <&gmac>;
195                 switch-phy-swap = <1>;
196         };
197 };
198
199 &wmac {
200         status = "okay";
201
202         mtd-cal-data = <&art 0x1000>;
203         mtd-mac-address = <&uboot 0x1fc00>;
204 };