ramips: mt7620a: convert to nvmem-layout
[openwrt/staging/jow.git] / target / linux / ramips / dts / mt7620a_edimax_br-6208ac-v2.dts
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2023 Stefan Weil <sw@weilnetz.de>
4 */
5
6 #include "mt7620a.dtsi"
7
8 #include <dt-bindings/gpio/gpio.h>
9 #include <dt-bindings/input/input.h>
10 #include <dt-bindings/leds/common.h>
11 #include <dt-bindings/mtd/partitions/uimage.h>
12
13 / {
14 compatible = "edimax,br-6208ac-v2", "ralink,mt7620a-soc";
15 model = "Edimax BR-6208AC v2";
16
17 aliases {
18 led-boot = &led_power;
19 led-failsafe = &led_power;
20 led-running = &led_power;
21 led-upgrade = &led_firmware;
22 };
23
24 keys {
25 compatible = "gpio-keys";
26
27 // Vendor firmware: /proc/RESET_BUTTON
28 reset_wps {
29 label = "reset_wps";
30 gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
31 linux,code = <KEY_RESTART>;
32 };
33 };
34
35 // Vendor firmware: /proc/driver/led
36 leds {
37 compatible = "gpio-leds";
38
39 led_power: power {
40 label = "green:power";
41 color = <LED_COLOR_ID_GREEN>;
42 function = LED_FUNCTION_POWER;
43 gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
44 };
45
46 // RALINK_REG_PIO3924DATA 39-24
47 led_internet: internet {
48 label = "green:internet";
49 color = <LED_COLOR_ID_GREEN>;
50 gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
51 };
52
53 // RALINK_REG_PIO7140DATA 44-40
54 led_wlan_2_4ghz: wlan_2_4ghz {
55 label = "green:wlan2g";
56 color = <LED_COLOR_ID_GREEN>;
57 function = LED_FUNCTION_WLAN;
58 gpios = <&gpio2 4 GPIO_ACTIVE_LOW>;
59 linux,default-trigger = "phy1tpt";
60 };
61
62 // RALINK_REG_PIO7140DATA 43-40
63 led_wlan_5ghz: wlan_5ghz {
64 label = "green:wlan5g";
65 color = <LED_COLOR_ID_GREEN>;
66 function = LED_FUNCTION_WLAN;
67 gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
68 linux,default-trigger = "phy0tpt";
69 };
70
71 // RALINK_REG_PIO7140DATA 42-40
72 led_firmware: firmware {
73 label = "green:firmware";
74 color = <LED_COLOR_ID_GREEN>;
75 gpios = <&gpio2 2 GPIO_ACTIVE_LOW>;
76 // default-state = "keep";
77 };
78
79 // RALINK_REG_PIO7140DATA 41-40
80 led_vpn: vpn {
81 label = "green:vpn";
82 color = <LED_COLOR_ID_GREEN>;
83 gpios = <&gpio2 1 GPIO_ACTIVE_LOW>;
84 };
85 };
86 };
87
88 &gdma {
89 status = "okay";
90 };
91
92 // Vendor firmware: RALINK_REG_PIO7140 - gpio0: gpio@600
93 // Vendor firmware: RALINK_REG_PIO3924 - gpio1: gpio@638
94 // Vendor firmware: RALINK_REG_PIO7140 - gpio2: gpio@660
95 // Vendor firmware: RALINK_REG_PIO72 - gpio3: gpio@688
96
97 &gpio1 {
98 status = "okay";
99 };
100
101 &gpio2 {
102 status = "okay";
103 };
104
105 &spi0 {
106 status = "okay";
107
108 flash@0 {
109 compatible = "jedec,spi-nor";
110 reg = <0>;
111 spi-max-frequency = <10000000>;
112
113 partitions {
114 compatible = "fixed-partitions";
115 #address-cells = <1>;
116 #size-cells = <1>;
117
118 // Vendor partitions:
119 // 0x000000000000-0x000000030000 : "Bootloader"
120 // 0x000000030000-0x000000040000 : "Config"
121 // 0x000000040000-0x000000050000 : "Factory"
122 // 0x000000050000-0x000000070000 : "Cimage"
123 // 0x000000070000-0x000000fe0000 : "Uimage"
124 // 0x000000070000-0x000000190000 : "Kernel"
125 // 0x000000190000-0x000000fe0000 : "RootFS"
126 // 0x000000fe0000-0x000001000000 : "FreeSpace"
127
128 // Bootloader
129 partition@0 {
130 label = "u-boot";
131 reg = <0x0 0x30000>;
132 read-only;
133 };
134
135 // Config
136 partition@30000 {
137 label = "u-boot-env";
138 reg = <0x30000 0x10000>;
139 read-only;
140 };
141
142 // Factory
143 factory: partition@40000 {
144 label = "factory";
145 reg = <0x40000 0x10000>;
146 read-only;
147
148 nvmem-layout {
149 compatible = "fixed-layout";
150 #address-cells = <1>;
151 #size-cells = <1>;
152
153 eeprom_factory_0: eeprom@0 {
154 reg = <0x0 0x200>;
155 };
156
157 eeprom_factory_8000: eeprom@8000 {
158 reg = <0x8000 0x200>;
159 };
160
161 macaddr_factory_4: macaddr@4 {
162 reg = <0x4 0x6>;
163 };
164
165 macaddr_factory_2e: macaddr@2e {
166 reg = <0x2e 0x6>;
167 };
168 };
169 };
170
171 // Cimage
172 partition@50000 {
173 label = "cimage";
174 reg = <0x50000 0x20000>;
175 read-only;
176 };
177
178 partition@70000 {
179 compatible = "openwrt,uimage", "denx,uimage";
180 openwrt,offset = <FW_EDIMAX_OFFSET>;
181 openwrt,partition-magic = <FW_MAGIC_EDIMAX>;
182 label = "firmware";
183 reg = <0x00070000 0x00f70000>;
184 };
185
186 // FreeSpace
187 partition@fe0000 {
188 label = "freespace";
189 reg = <0xfe0000 0x20000>;
190 read-only;
191 };
192 };
193 };
194 };
195
196 &state_default {
197 gpio {
198 // TODO: "spi refclk"?
199 groups = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd";
200 function = "gpio";
201 };
202 };
203
204 &ethernet {
205 nvmem-cells = <&macaddr_factory_2e>;
206 nvmem-cell-names = "mac-address";
207
208 mediatek,portmap = "llllw";
209 };
210
211 &wmac {
212 nvmem-cells = <&eeprom_factory_0>;
213 nvmem-cell-names = "eeprom";
214 };
215
216 &pcie {
217 status = "okay";
218 };
219
220 &pcie0 {
221 wifi@0,0 {
222 reg = <0x0000 0 0 0 0>;
223 nvmem-cells = <&eeprom_factory_8000>;
224 nvmem-cell-names = "eeprom";
225 ieee80211-freq-limit = <5000000 6000000>;
226 };
227 };