ramips: convert MT7603 EEPROM to NVMEM format
[openwrt/openwrt.git] / target / linux / ramips / dts / mt7621_tplink_deco-m4r-v4.dts
1 // SPDX-License-Identifier: GPL-2.0-only
2
3 #include "mt7621.dtsi"
4
5 #include <dt-bindings/gpio/gpio.h>
6 #include <dt-bindings/input/input.h>
7
8 / {
9 compatible = "tplink,deco-m4r-v4", "mediatek,mt7621-soc";
10 model = "TP-Link Deco M4R v4";
11
12 aliases {
13 label-mac-device = &gmac0;
14 led-boot = &led_power;
15 led-failsafe = &led_power;
16 led-running = &led_power;
17 led-upgrade = &led_power;
18 };
19
20 chosen {
21 bootargs = "console=ttyS0,115200n8";
22 };
23
24 keys {
25 compatible = "gpio-keys";
26
27 wps {
28 label = "wps";
29 gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
30 debounce-interval = <60>;
31 linux,code = <KEY_WPS_BUTTON>;
32 };
33
34 led {
35 label = "led";
36 gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
37 debounce_interval = <60>;
38 linux,code = <KEY_BRIGHTNESS_TOGGLE>;
39 };
40
41 reset {
42 label = "reset";
43 gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
44 debounce-interval = <60>;
45 linux,code = <KEY_RESTART>;
46 };
47 };
48
49 leds {
50 compatible = "gpio-leds";
51
52 rssi {
53 label = "green:rssi";
54 gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
55 };
56
57 lan {
58 label = "green:lan";
59 gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
60 };
61
62 sys {
63 label = "green:sys";
64 gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
65 };
66
67 wifi2g {
68 label = "green:wifi2g";
69 gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
70 linux,default-trigger = "phy0tpt";
71 };
72
73 logo_red {
74 label = "red:logo";
75 gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
76 /* match usage in v1 and v2 */
77 linux,default-trigger = "phy0tpt";
78 };
79
80 logo_blue {
81 label = "blue:logo";
82 gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
83 /* match usage in v1 and v2 */
84 linux,default-trigger = "phy1tpt";
85
86 };
87
88 led_power: logo_green {
89 label = "green:logo";
90 gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
91 /* match usage in v1 and v2 */
92 default_state = "on";
93 };
94 };
95 };
96
97 &state_default {
98 gpio {
99 groups = "i2c", "uart2", "uart3", "jtag", "wdt";
100 function = "gpio";
101 };
102 };
103
104 &spi0 {
105 status = "okay";
106
107 flash@0 {
108 compatible = "jedec,spi-nor";
109 reg = <0>;
110 spi-max-frequency = <40000000>;
111
112 partitions {
113 compatible = "fixed-partitions";
114 #address-cells = <1>;
115 #size-cells = <1>;
116
117 partition@0 {
118 label = "u-boot";
119 reg = <0x0 0x40000>;
120 read-only;
121 };
122
123 partition@40000 {
124 label = "firmware";
125 compatible = "denx,uimage";
126 reg = <0x40000 0xf60000>;
127 };
128
129 config: partition@fa0000 {
130 label = "config";
131 reg = <0xfa0000 0x010000>;
132 read-only;
133
134 compatible = "nvmem-cells";
135 #address-cells = <1>;
136 #size-cells = <1>;
137
138 macaddr_config_8: macaddr@8 {
139 reg = <0x8 0x6>;
140 };
141 };
142
143 partition@fb0000 {
144 label = "tplink";
145 reg = <0xfb0000 0x040000>;
146 read-only;
147 };
148
149 radio: partition@ff0000 {
150 compatible = "nvmem-cells";
151 label = "radio";
152 reg = <0xff0000 0x10000>;
153 #address-cells = <1>;
154 #size-cells = <1>;
155 read-only;
156
157 eeprom_radio_0: eeprom@0 {
158 reg = <0x0 0x400>;
159 };
160 };
161 };
162 };
163 };
164
165 &ethernet {
166 pinctrl-names = "default";
167 pinctrl-0 = <&rgmii1_pins &mdio_pins>;
168 };
169
170 &gmac0 {
171 nvmem-cells = <&macaddr_config_8>;
172 nvmem-cell-names = "mac-address";
173 label = "dsa";
174 };
175
176 &switch0 {
177 ports {
178 port@0 {
179 status = "okay";
180 label = "eth0";
181 };
182
183 port@1 {
184 status = "okay";
185 label = "eth1";
186 };
187 };
188 };
189
190 &pcie {
191 status = "okay";
192 };
193
194 &pcie0 {
195 wifi@0,0 {
196 compatible = "mediatek,mt76";
197 reg = <0x0000 0 0 0 0>;
198 nvmem-cells = <&eeprom_radio_0>;
199 nvmem-cell-names = "eeprom";
200 ieee80211-freq-limit = <2400000 2500000>;
201 };
202 };
203
204 &pcie1 {
205 wifi@0,0 {
206 compatible = "mediatek,mt76";
207 reg = <0x0000 0 0 0 0>;
208 mediatek,mtd-eeprom = <&radio 0x8000>;
209 ieee80211-freq-limit = <5000000 6000000>;
210 };
211 };