ee9d19839ccd2b788605a4cff022fcf6e9eedc8b
[openwrt/staging/stintel.git] / target / linux / bmips / dts / bcm6328-inteno-xg6846.dts
1 // SPDX-License-Identifier: GPL-2.0
2 /dts-v1/;
3
4 /*
5 * Devicetree for the Inteno XG6846 router, mostly used as a
6 * media converter from fiber to twisted pair ethernet
7 * "fiber modem" in many households in Sweden. The Marvell
8 * switch has one of its ports connected to an SFP (Small Form
9 * Factor pluggable) optical fiber receiver, which is bridged
10 * to the twisted pair connector LAN1.
11 *
12 * This device tree is inspired by research from the OpenWrt
13 * and Sweclockers forums, including contributions from
14 * NPeca75, mrhaav and csom.
15 *
16 * Some devices have a USB type A host receptacle mounted,
17 * some do not.
18 */
19 #include "bcm6328.dtsi"
20 #include <dt-bindings/input/input.h>
21 #include <dt-bindings/gpio/gpio.h>
22
23 / {
24 model = "Inteno XG6846";
25 compatible = "inteno,xg6846", "brcm,bcm6328";
26
27 /* OpenWrt-specific aliases */
28 aliases {
29 led-boot = &led_pwr_red;
30 led-failsafe = &led_pwr_red;
31 led-running = &led_pwr_green;
32 led-upgrade = &led_pwr_red;
33 led-usb = &led_usb_green;
34 };
35
36 chosen {
37 bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200";
38 stdout-path = "serial0:115200n8";
39 };
40
41 /*
42 * This I2C port is connected to the SFP and reflects the EEPROM etc
43 * inside the SFP module. If the module is not plugged in, consequently
44 * nothing will be found on the bus.
45 */
46 i2c0: i2c-sfp {
47 compatible = "i2c-gpio";
48 sda-gpios = <&gpio 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
49 scl-gpios = <&gpio 19 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
50 #address-cells = <1>;
51 #size-cells = <0>;
52 };
53
54 /* This I2C bus is used for the external CATV connector (usually unused) */
55 i2c1: i2c-catv {
56 compatible = "i2c-gpio";
57 sda-gpios = <&gpio 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
58 scl-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
59 #address-cells = <1>;
60 #size-cells = <0>;
61 };
62
63 sfp0: sfp0 {
64 compatible = "sff,sfp";
65 i2c-bus = <&i2c0>;
66 los-gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
67 };
68
69 keys {
70 compatible = "gpio-keys-polled";
71 #address-cells = <1>;
72 #size-cells = <0>;
73 poll-interval = <20>;
74
75 reset {
76 label = "reset";
77 gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
78 linux,code = <KEY_RESTART>;
79 debounce-interval = <60>;
80 };
81 };
82 };
83
84 &hsspi {
85 status = "okay";
86
87 flash@0 {
88 compatible = "jedec,spi-nor";
89 /*
90 * HW 1.0-1.1: Spansion S25FL128S1
91 * HW 1.3: Winbond W25Q128
92 *
93 * Fast Read Data max speed is 50MHz, see the Winbond W25Q128
94 * datasheet table 9.5 "AC Electrical Characteristics", we can
95 * use this speed because the chip supports fast reads. Older
96 * HW has different NOR chips, I assume they can all do fast
97 * reads.
98 */
99 spi-max-frequency = <104000000>;
100 spi-tx-bus-width = <2>;
101 spi-rx-bus-width = <2>;
102 m25p,fast-read;
103 reg = <0>;
104
105 #address-cells = <1>;
106 #size-cells = <1>;
107
108 partitions {
109 compatible = "fixed-partitions";
110 #address-cells = <1>;
111 #size-cells = <1>;
112
113 cfe: partition@0 {
114 label = "cfe";
115 reg = <0x0000000 0x0010000>;
116 read-only;
117 };
118
119 partition@10000 {
120 compatible = "brcm,bcm963xx-imagetag";
121 reg = <0x010000 0xfe0000>;
122 label = "firmware";
123 };
124
125 partition@ff0000 {
126 reg = <0xff0000 0x010000>;
127 label = "nvram";
128 };
129 };
130 };
131 };
132
133 &cfe {
134 compatible = "nvmem-cells";
135 #address-cells = <1>;
136 #size-cells = <1>;
137
138 macaddr_cfe_6a0: macaddr@6a0 {
139 reg = <0x6a0 0x6>;
140 };
141 };
142
143 &ethernet {
144 status = "okay";
145
146 nvmem-cells = <&macaddr_cfe_6a0>;
147 nvmem-cell-names = "mac-address";
148 };
149
150 &switch0 {
151 dsa,member = <0 0>;
152
153 ports {
154 switch0port4: port@4 {
155 reg = <4>;
156 label = "extsw";
157
158 phy-mode = "rgmii";
159 fixed-link {
160 speed = <1000>;
161 full-duplex;
162 };
163 };
164 };
165 };
166
167 &mdio_ext {
168 switch1: switch@0 {
169 /* The switch is not using any external IRQ, sadly */
170 compatible = "marvell,mv88e6085";
171 #address-cells = <1>;
172 #size-cells = <0>;
173 reg = <0>;
174 interrupt-controller;
175 #interrupt-cells = <2>;
176 dsa,member = <1 0>;
177
178 ports {
179 #address-cells = <1>;
180 #size-cells = <0>;
181
182 port@0 {
183 reg = <0>;
184 label = "lan1";
185 phy-handle = <&lan1phy>;
186 };
187
188 port@1 {
189 reg = <1>;
190 label = "lan2";
191 phy-handle = <&lan2phy>;
192 };
193
194 port@2 {
195 reg = <2>;
196 label = "lan3";
197 phy-handle = <&lan3phy>;
198 };
199
200 port@3 {
201 reg = <3>;
202 label = "lan4";
203 phy-handle = <&lan4phy>;
204 };
205
206 port@4 {
207 reg = <4>;
208 label = "ext1";
209 phy-handle = <&ext1phy>;
210 };
211
212 port@5 {
213 reg = <5>;
214 phy-mode = "rgmii-id";
215 label = "wan";
216 sfp = <&sfp0>;
217 fixed-link {
218 speed = <1000>;
219 full-duplex;
220 };
221 };
222
223 port@6 {
224 reg = <6>;
225 phy-mode = "rgmii-id";
226 label = "cpu";
227 ethernet = <&switch0port4>;
228 fixed-link {
229 speed = <1000>;
230 full-duplex;
231 };
232 };
233 };
234
235 mdio {
236 #address-cells = <1>;
237 #size-cells = <0>;
238
239 lan1phy: ethernet-phy@0 {
240 reg = <0>;
241 interrupt-parent = <&switch1>;
242 interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
243 };
244 lan2phy: ethernet-phy@1 {
245 reg = <1>;
246 interrupt-parent = <&switch1>;
247 interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
248 };
249 lan3phy: ethernet-phy@2 {
250 reg = <2>;
251 interrupt-parent = <&switch1>;
252 interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
253 };
254 lan4phy: ethernet-phy@3 {
255 reg = <3>;
256 interrupt-parent = <&switch1>;
257 interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
258 };
259 ext1phy: ethernet-phy@4 {
260 reg = <4>;
261 interrupt-parent = <&switch1>;
262 interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
263 };
264 };
265 };
266 };
267
268 &uart0 {
269 status = "okay";
270 };
271
272 &pinctrl {
273 pinctrl_xg6846_usb_spd_led: xg6846_usb_spd_led-pins {
274 function = "led";
275 pins = "gpio17";
276 };
277 };
278
279 &leds {
280 status = "okay";
281 pinctrl-names = "default";
282 pinctrl-0 = <&pinctrl_xg6846_usb_spd_led>, /* GPIO16 LED USB */
283 <&pinctrl_ephy1_spd_led>, /* GPIO18 LED PWR red */
284 <&pinctrl_ephy3_spd_led>; /* GPIO20 LED PWR green */
285
286 /* On board variants without USB this LED is not mounted */
287 led_usb_green: led@16 {
288 reg = <16>;
289 active-low;
290 label = "green:usb";
291 default-state = "off";
292 };
293
294 /*
295 * LED 18 and 20 drive the same physical LED, the PWR
296 * LED that can be both red and green.
297 */
298 led_pwr_red: led@18 {
299 reg = <18>;
300 active-low;
301 label = "red:pwr";
302 default-state = "off";
303 };
304
305 led_pwr_green: led@20 {
306 reg = <20>;
307 active-low;
308 label = "green:pwr";
309 default-state = "off";
310 };
311
312 };