ramips: mt7621: convert to nvmem-layout
[openwrt/staging/stintel.git] / target / linux / ramips / dts / mt7621_comfast_cf-ew72-v2.dts
1 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2
3 #include "mt7621.dtsi"
4
5 #include <dt-bindings/gpio/gpio.h>
6 #include <dt-bindings/input/input.h>
7 #include <dt-bindings/leds/common.h>
8
9 / {
10 compatible = "comfast,cf-ew72-v2", "mediatek,mt7621-soc";
11 model = "COMFAST CF-EW72 V2";
12
13 // There are at least two HW variants of cf-ew72-v2:
14 // With external RAM chip and with integrated RAM (RAM chip not soldered).
15 // Both act same.
16
17 chosen {
18 bootargs = "console=ttyS0,115200";
19 };
20
21 keys {
22 compatible = "gpio-keys";
23
24 reset {
25 label = "reset";
26 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
27 linux,code = <KEY_RESTART>;
28 debounce-interval = <60>;
29 };
30 };
31
32 leds {
33 compatible = "gpio-leds";
34
35 // The only both visible and controllable indicator is wifi LED.
36 // CF-EW72 have 8 LEDs:
37 // "wlan" is the only LED is controllable with GPIO and have proper hole in shell.
38 // "power", "wan" and "lan" LEDs have proper holes in shell, but can not be controlled with GPIO
39 // "hidden_led_2" and "hidden_led_4" can be controlled with GPIO, but have no proper holes in shell
40 // "hidden_led_2" is between POWER and WAN LEDs
41 // "hidden_led_4" is between WAN and LAN LEDs
42 // "noconn_led_6" and "noconn_led_8" exist, but have no proper holes in shell and not controlled:
43 // "noconn_led_6" is between LAN and WLAN LEDs
44 // "noconn_led_8" is after WLAN LED
45
46 // LED "hidden_led_2" between POWER and WAN LEDs is controllable with GPIO, but it has no proper hole in shell;
47 // LED "hidden_led_4" between WAN and LAN LEDs is controllable with GPIO, but it has no proper hole in shell;
48
49 // TABLE of LEDs. All leds are blue.
50 //
51 // Place (WAN->ANT) | Num | GPIO | LED name (LuCI) | Note
52 // -----------------|-----|-----------------------------------------------------------------------------------------
53 // power | 1 | | | POWER LED. Not controlled with GPIO.
54 // hidden_led_2 | 2 | 13 | blue:hidden_led_2 | This LED does not have proper hole in shell.
55 // wan | 3 | | | WAN LED. Not controlled with GPIO.
56 // hidden_led_4 | 4 | 16 | blue:hidden_led_4 | This LED does not have proper hole in shell.
57 // lan | 5 | | | LAN LED. Not controlled with GPIO.
58 // noconn_led_6 | 6 | | | Not controlled with GPIO, possibly not connected
59 // wlan | 7 | 15 | blue:wlan | WLAN LED. Wireless indicator.
60 // noconn_led_8 | 8 | | | Not controlled with GPIO, possibly not connected
61
62 hidden_led_2_blue {
63 label = "blue:hidden_led_2";
64 gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
65 };
66
67 hidden_led_4_blue {
68 label = "blue:hidden_led_4";
69 gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
70 };
71
72 wlan_blue {
73 label = "blue:wlan";
74 gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
75 };
76 };
77
78 aliases {
79 label-mac-device = &wan;
80 };
81 };
82
83 &spi0 {
84 status = "okay";
85
86 flash@0 {
87 compatible = "w25q128";
88 reg = <0>;
89 spi-max-frequency = <10000000>;
90 m25p,fast-read;
91 partitions {
92 compatible = "fixed-partitions";
93 #address-cells = <1>;
94 #size-cells = <1>;
95
96 partition@0 {
97 label = "Bootloader";
98 reg = <0x0 0x30000>;
99 read-only;
100 };
101
102 partition@30000 {
103 label = "Config";
104 reg = <0x30000 0x10000>;
105 read-only;
106 };
107
108 factory: partition@40000 {
109 label = "factory";
110 reg = <0x40000 0x10000>;
111 read-only;
112
113 nvmem-layout {
114 compatible = "fixed-layout";
115 #address-cells = <1>;
116 #size-cells = <1>;
117
118 eeprom_factory_0: eeprom@0 {
119 reg = <0x0 0x400>;
120 };
121
122 eeprom_factory_8000: eeprom@8000 {
123 reg = <0x8000 0x4da8>;
124 };
125
126 macaddr_factory_e000: macaddr@e000 {
127 compatible = "mac-base";
128 reg = <0xe000 0x6>;
129 #nvmem-cell-cells = <1>;
130 };
131
132 // Serial number can be found in "factory" at 0xE100.
133 // it starts and ends with double quotes `"` and is ASCII string
134 };
135 };
136
137 partition@50000 {
138 label = "firmware";
139 compatible = "denx,uimage";
140 reg = <0x50000 0xfb0000>;
141 };
142 };
143 };
144 };
145
146 &gpio {
147 groups = "i2c", "uart2", "uart3", "sdhci", "jtag";
148 function = "gpio";
149 };
150
151 &gmac0 {
152 nvmem-cells = <&macaddr_factory_e000 0>;
153 nvmem-cell-names = "mac-address";
154 };
155
156 &pcie {
157 status = "okay";
158 };
159
160 &pcie0 {
161 wifi_2_4_ghz: wifi@0,0 {
162 compatible = "mediatek,mt76";
163 reg = <0x0000 0 0 0 0>;
164 nvmem-cells = <&eeprom_factory_0>;
165 nvmem-cell-names = "eeprom";
166 // Wi-Fi device reads it's MAC address from EEPROM (&factory + 4)
167 // adding anything related to mac-address here will cause use random MAC
168 };
169 };
170
171 &pcie1 {
172 wifi_5_0_ghz: wifi@0,0 {
173 compatible = "mediatek,mt76";
174 reg = <0x0000 0 0 0 0>;
175 nvmem-cells = <&eeprom_factory_8000>;
176 nvmem-cell-names = "eeprom";
177 // Wi-Fi device reads it's MAC address from EEPROM, (&factory + 0x8000 + 4)
178 // adding anything related to mac-address here will cause use random MAC.
179 };
180 };
181
182 &pcie2 {
183 status = "disabled";
184 };
185
186 &switch0 {
187 mediatek,mcm;
188 ports {
189 wan: port@0 {
190 status = "okay";
191 label = "wan";
192 nvmem-cells = <&macaddr_factory_e000 1>;
193 nvmem-cell-names = "mac-address";
194 };
195
196 lan: port@1 {
197 status = "okay";
198 label = "lan";
199 nvmem-cells = <&macaddr_factory_e000 0>;
200 nvmem-cell-names = "mac-address";
201 };
202 };
203 };