ramips: mt7621: convert Xiaomi devices EEPROM to NVMEM format
[openwrt/openwrt.git] / target / linux / ramips / dts / mt7621_snr_snr-cpe-me2-sfp.dts
1 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2 #include "mt7621.dtsi"
3
4 #include <dt-bindings/gpio/gpio.h>
5 #include <dt-bindings/input/input.h>
6 #include <dt-bindings/leds/common.h>
7
8 / {
9 compatible = "snr,snr-cpe-me2-sfp", "mediatek,mt7621-soc";
10 model = "SNR-CPE-ME2-SFP";
11
12 aliases {
13 led-boot = &led_sys;
14 led-failsafe = &led_sys;
15 led-running = &led_sys;
16 led-upgrade = &led_sys;
17 };
18
19 leds {
20 compatible = "gpio-leds";
21
22 led_sys: sys {
23 label = "green:sys";
24 color = <LED_COLOR_ID_GREEN>;
25 function = LED_FUNCTION_STATUS;
26 gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
27 };
28
29 vpn {
30 label = "green:vpn";
31 color = <LED_COLOR_ID_GREEN>;
32 function = LED_FUNCTION_STATUS;
33 gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
34 };
35
36 usb {
37 label = "green:usb";
38 color = <LED_COLOR_ID_GREEN>;
39 function = LED_FUNCTION_USB;
40 gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
41 trigger-sources = <&xhci_ehci_port1>;
42 linux,default-trigger = "usbport";
43 };
44 };
45
46 keys {
47 compatible = "gpio-keys";
48
49 reset {
50 label = "reset";
51 gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
52 linux,code = <KEY_RESTART>;
53 };
54 };
55
56 sfp_wan: sfp0 {
57 compatible = "sff,sfp";
58 i2c-bus = <&i2c>;
59 los-gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
60 mod-def0-gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
61 tx-disable-gpios = <&gpio 9 GPIO_ACTIVE_HIGH>;
62 maximum-power-milliwatt = <1000>;
63 };
64
65 reg_usb_vbus: regulator-usb {
66 compatible = "regulator-fixed";
67 regulator-name = "usb_vbus";
68 regulator-min-microvolt = <5000000>;
69 regulator-max-microvolt = <5000000>;
70 gpio = <&gpio 17 GPIO_ACTIVE_HIGH>;
71 enable-active-high;
72 };
73
74 reg_3p3v: regulator-3p3v {
75 compatible = "regulator-fixed";
76 regulator-name = "fixed-3.3V";
77 regulator-min-microvolt = <3300000>;
78 regulator-max-microvolt = <3300000>;
79 regulator-boot-on;
80 regulator-always-on;
81 };
82 };
83
84 &state_default {
85 gpio {
86 groups = "uart2", "uart3", "jtag";
87 function = "gpio";
88 };
89 };
90
91 &spi0 {
92 status = "okay";
93
94 flash@0 { // GD25Q127CSIG
95 compatible = "jedec,spi-nor";
96 reg = <0>;
97 spi-max-frequency = <44000000>;
98
99 partitions {
100 compatible = "fixed-partitions";
101 #address-cells = <1>;
102 #size-cells = <1>;
103
104 partition@0 {
105 label = "u-boot";
106 reg = <0x0 0x30000>;
107 read-only;
108 };
109
110 partition@30000 {
111 label = "config";
112 reg = <0x30000 0x10000>;
113 };
114
115 factory: partition@40000 {
116 label = "factory";
117 reg = <0x40000 0x10000>;
118 read-only;
119
120 nvmem-layout {
121 compatible = "fixed-layout";
122 #address-cells = <1>;
123 #size-cells = <1>;
124
125 eeprom_factory_0: eeprom@0 {
126 reg = <0x0 0x4da8>;
127 };
128
129 macaddr_factory_e000: macaddr@e000 {
130 reg = <0xe000 0x6>;
131 };
132
133 macaddr_factory_e006: macaddr@e006 {
134 reg = <0xe006 0x6>;
135 };
136 };
137 };
138
139 partition@50000 {
140 compatible = "denx,uimage";
141 label = "firmware";
142 reg = <0x50000 0xfb0000>;
143 };
144
145 partition@30001 {
146 label = "uboot-env";
147 reg = <0x30000 0x1000>;
148 };
149 };
150 };
151 };
152
153 &gpio {
154 // driver issue, bypass
155 enable_sfp {
156 gpio-hog;
157 gpios = <9 GPIO_ACTIVE_LOW>;
158 output-low;
159 };
160 };
161
162 &mdio {
163 phy_sfp: ethernet-phy@0 {
164 reg = <0>;
165 sfp = <&sfp_wan>;
166 };
167 };
168
169 &gmac0 {
170 nvmem-cells = <&macaddr_factory_e000>;
171 nvmem-cell-names = "mac-address";
172 };
173
174 &gmac1 {
175 status = "okay";
176 label = "wan";
177 phy-mode = "rgmii-rxid";
178 phy-handle = <&phy_sfp>;
179
180 nvmem-cells = <&macaddr_factory_e006>;
181 nvmem-cell-names = "mac-address";
182 };
183
184 &switch0 {
185 ports {
186 port@1 {
187 status = "okay";
188 label = "lan1";
189 };
190
191 port@2 {
192 status = "okay";
193 label = "lan2";
194 };
195
196 port@3 {
197 status = "okay";
198 label = "lan3";
199 };
200
201 port@4 {
202 status = "okay";
203 label = "lan4";
204 };
205 };
206 };
207
208 &xhci {
209 vusb33-supply = <&reg_3p3v>;
210 vbus-supply = <&reg_usb_vbus>;
211 };
212
213 &pcie {
214 status = "okay";
215 };
216
217 &pcie0 {
218 wifi@0,0 {
219 compatible = "mediatek,mt76";
220 reg = <0x0000 0 0 0 0>;
221 nvmem-cells = <&eeprom_factory_0>;
222 nvmem-cell-names = "eeprom";
223 };
224 };