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