ramips: convert rt2x00 EEPROM to NVMEM format
[openwrt/staging/stintel.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 compatible = "nvmem-cells";
145 label = "factory";
146 reg = <0x40000 0x10000>;
147 #address-cells = <1>;
148 #size-cells = <1>;
149 read-only;
150
151 eeprom_factory_0: eeprom@0 {
152 reg = <0x0 0x200>;
153 };
154
155 macaddr_factory_4: macaddr@4 {
156 reg = <0x4 0x6>;
157 };
158
159 macaddr_factory_2e: macaddr@2e {
160 reg = <0x2e 0x6>;
161 };
162 };
163
164 // Cimage
165 partition@50000 {
166 label = "cimage";
167 reg = <0x50000 0x20000>;
168 read-only;
169 };
170
171 partition@70000 {
172 compatible = "openwrt,uimage", "denx,uimage";
173 openwrt,offset = <FW_EDIMAX_OFFSET>;
174 openwrt,partition-magic = <FW_MAGIC_EDIMAX>;
175 label = "firmware";
176 reg = <0x00070000 0x00f70000>;
177 };
178
179 // FreeSpace
180 partition@fe0000 {
181 label = "freespace";
182 reg = <0xfe0000 0x20000>;
183 read-only;
184 };
185 };
186 };
187 };
188
189 &state_default {
190 gpio {
191 // TODO: "spi refclk"?
192 groups = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd";
193 function = "gpio";
194 };
195 };
196
197 &ethernet {
198 nvmem-cells = <&macaddr_factory_2e>;
199 nvmem-cell-names = "mac-address";
200
201 mediatek,portmap = "llllw";
202 };
203
204 &wmac {
205 nvmem-cells = <&eeprom_factory_0>;
206 nvmem-cell-names = "eeprom";
207 };
208
209 &pcie {
210 status = "okay";
211 };
212
213 &pcie0 {
214 wifi@0,0 {
215 reg = <0x0000 0 0 0 0>;
216 mediatek,mtd-eeprom = <&factory 0x8000>;
217 ieee80211-freq-limit = <5000000 6000000>;
218 };
219 };