9e498b78ed7bc78307e85455929d020754d0d191
[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 compatible = "nvmem-cells";
117 label = "factory";
118 reg = <0x40000 0x10000>;
119 #address-cells = <1>;
120 #size-cells = <1>;
121 read-only;
122
123 eeprom_factory_0: eeprom@0 {
124 reg = <0x0 0x4da8>;
125 };
126
127 macaddr_factory_e000: macaddr@e000 {
128 reg = <0xe000 0x6>;
129 };
130
131 macaddr_factory_e006: macaddr@e006 {
132 reg = <0xe006 0x6>;
133 };
134 };
135
136 partition@50000 {
137 compatible = "denx,uimage";
138 label = "firmware";
139 reg = <0x50000 0xfb0000>;
140 };
141
142 partition@30001 {
143 label = "uboot-env";
144 reg = <0x30000 0x1000>;
145 };
146 };
147 };
148 };
149
150 &gpio {
151 // driver issue, bypass
152 enable_sfp {
153 gpio-hog;
154 gpios = <9 GPIO_ACTIVE_LOW>;
155 output-low;
156 };
157 };
158
159 &mdio {
160 phy_sfp: ethernet-phy@0 {
161 reg = <0>;
162 sfp = <&sfp_wan>;
163 };
164 };
165
166 &gmac0 {
167 nvmem-cells = <&macaddr_factory_e000>;
168 nvmem-cell-names = "mac-address";
169 };
170
171 &gmac1 {
172 status = "okay";
173 label = "wan";
174 phy-mode = "rgmii-rxid";
175 phy-handle = <&phy_sfp>;
176
177 nvmem-cells = <&macaddr_factory_e006>;
178 nvmem-cell-names = "mac-address";
179 };
180
181 &switch0 {
182 ports {
183 port@1 {
184 status = "okay";
185 label = "lan1";
186 };
187
188 port@2 {
189 status = "okay";
190 label = "lan2";
191 };
192
193 port@3 {
194 status = "okay";
195 label = "lan3";
196 };
197
198 port@4 {
199 status = "okay";
200 label = "lan4";
201 };
202 };
203 };
204
205 &xhci {
206 vusb33-supply = <&reg_3p3v>;
207 vbus-supply = <&reg_usb_vbus>;
208 };
209
210 &pcie {
211 status = "okay";
212 };
213
214 &pcie0 {
215 wifi@0,0 {
216 compatible = "mediatek,mt76";
217 reg = <0x0000 0 0 0 0>;
218 nvmem-cells = <&eeprom_factory_0>;
219 nvmem-cell-names = "eeprom";
220 };
221 };