xref: /freebsd/sys/contrib/device-tree/src/arm64/rockchip/rk3588-jaguar-ethernet-switch.dtso (revision 833e5d42ab135b0238e61c5b3c19b8619677cbfa)
1*833e5d42SEmmanuel Vadot// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2*833e5d42SEmmanuel Vadot/*
3*833e5d42SEmmanuel Vadot * Copyright (c) 2025 Cherry Embedded Solutions GmbH
4*833e5d42SEmmanuel Vadot *
5*833e5d42SEmmanuel Vadot * Device Tree Overlay for the Ethernet Switch adapter for the Mezzanine
6*833e5d42SEmmanuel Vadot * connector on RK3588 Jaguar
7*833e5d42SEmmanuel Vadot * (manual: https://embedded.cherry.de/jaguar-ethernet-switch-user-manual/)
8*833e5d42SEmmanuel Vadot *
9*833e5d42SEmmanuel Vadot * This adapter has a KSZ9896 Ethernet Switch with 4 1GbE Ethernet connectors,
10*833e5d42SEmmanuel Vadot * two user controllable LEDs, and an M12 12-pin connector which exposes the
11*833e5d42SEmmanuel Vadot * following signals:
12*833e5d42SEmmanuel Vadot *  - RS232/RS485 (max 250Kbps/500Kbps, RX pin1, TX pin2)
13*833e5d42SEmmanuel Vadot *  - two digital inputs (pin4 routed to GPIO3_C5 on SoC, pin5 to GPIO4_B4)
14*833e5d42SEmmanuel Vadot *  - two digital outputs (pin7 routed to GPIO3_D3 on SoC, pin8 to GPIO3_D1)
15*833e5d42SEmmanuel Vadot *  - two analog inputs (pin10 to channel1 of ADS1015, pin11 to channel2)
16*833e5d42SEmmanuel Vadot *
17*833e5d42SEmmanuel Vadot * RK3588 Jaguar can be powered entirely through the adapter via the M8 3-pin
18*833e5d42SEmmanuel Vadot * connector (12-24V).
19*833e5d42SEmmanuel Vadot */
20*833e5d42SEmmanuel Vadot
21*833e5d42SEmmanuel Vadot/dts-v1/;
22*833e5d42SEmmanuel Vadot/plugin/;
23*833e5d42SEmmanuel Vadot
24*833e5d42SEmmanuel Vadot#include <dt-bindings/clock/rockchip,rk3588-cru.h>
25*833e5d42SEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
26*833e5d42SEmmanuel Vadot#include <dt-bindings/interrupt-controller/irq.h>
27*833e5d42SEmmanuel Vadot#include <dt-bindings/leds/common.h>
28*833e5d42SEmmanuel Vadot#include <dt-bindings/pinctrl/rockchip.h>
29*833e5d42SEmmanuel Vadot
30*833e5d42SEmmanuel Vadot&{/} {
31*833e5d42SEmmanuel Vadot	aliases {
32*833e5d42SEmmanuel Vadot		ethernet1 = "/ethernet@fe1c0000";
33*833e5d42SEmmanuel Vadot	};
34*833e5d42SEmmanuel Vadot
35*833e5d42SEmmanuel Vadot	mezzanine-leds {
36*833e5d42SEmmanuel Vadot		compatible = "gpio-leds";
37*833e5d42SEmmanuel Vadot		pinctrl-names = "default";
38*833e5d42SEmmanuel Vadot		pinctrl-0 = <&led_usr1_pin &led_usr2_pin>;
39*833e5d42SEmmanuel Vadot
40*833e5d42SEmmanuel Vadot		led-1 {
41*833e5d42SEmmanuel Vadot			gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
42*833e5d42SEmmanuel Vadot			label = "USR1";
43*833e5d42SEmmanuel Vadot		};
44*833e5d42SEmmanuel Vadot
45*833e5d42SEmmanuel Vadot		led-2 {
46*833e5d42SEmmanuel Vadot			gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
47*833e5d42SEmmanuel Vadot			label = "USR2";
48*833e5d42SEmmanuel Vadot		};
49*833e5d42SEmmanuel Vadot	};
50*833e5d42SEmmanuel Vadot};
51*833e5d42SEmmanuel Vadot
52*833e5d42SEmmanuel Vadot&gmac1 {
53*833e5d42SEmmanuel Vadot	clock_in_out = "output";
54*833e5d42SEmmanuel Vadot	phy-mode = "rgmii-id";
55*833e5d42SEmmanuel Vadot	pinctrl-names = "default";
56*833e5d42SEmmanuel Vadot	pinctrl-0 = <&gmac1_rx_bus2
57*833e5d42SEmmanuel Vadot		     &gmac1_tx_bus2
58*833e5d42SEmmanuel Vadot		     &gmac1_rgmii_clk
59*833e5d42SEmmanuel Vadot		     &gmac1_rgmii_bus
60*833e5d42SEmmanuel Vadot		     &eth1_pins>;
61*833e5d42SEmmanuel Vadot	rx_delay = <0x0>;
62*833e5d42SEmmanuel Vadot	tx_delay = <0x0>;
63*833e5d42SEmmanuel Vadot	status = "okay";
64*833e5d42SEmmanuel Vadot
65*833e5d42SEmmanuel Vadot	fixed-link {
66*833e5d42SEmmanuel Vadot		speed = <1000>;
67*833e5d42SEmmanuel Vadot		full-duplex;
68*833e5d42SEmmanuel Vadot	};
69*833e5d42SEmmanuel Vadot};
70*833e5d42SEmmanuel Vadot
71*833e5d42SEmmanuel Vadot&i2c1 {
72*833e5d42SEmmanuel Vadot	#address-cells = <1>;
73*833e5d42SEmmanuel Vadot	/*
74*833e5d42SEmmanuel Vadot	 * ADS1015 can handle high-speed (HS) mode (up to 3.4MHz) on I2C bus,
75*833e5d42SEmmanuel Vadot	 * but SoC can handle only up to 400kHz.
76*833e5d42SEmmanuel Vadot	 */
77*833e5d42SEmmanuel Vadot	clock-frequency = <400000>;
78*833e5d42SEmmanuel Vadot	#size-cells = <0>;
79*833e5d42SEmmanuel Vadot	status = "okay";
80*833e5d42SEmmanuel Vadot
81*833e5d42SEmmanuel Vadot	adc@48 {
82*833e5d42SEmmanuel Vadot		compatible = "ti,ads1015";
83*833e5d42SEmmanuel Vadot		reg = <0x48>;
84*833e5d42SEmmanuel Vadot		#address-cells = <1>;
85*833e5d42SEmmanuel Vadot		interrupt-parent = <&gpio3>;
86*833e5d42SEmmanuel Vadot		interrupts = <RK_PC7 IRQ_TYPE_EDGE_FALLING>;
87*833e5d42SEmmanuel Vadot		pinctrl-0 = <&adc_alert>;
88*833e5d42SEmmanuel Vadot		pinctrl-names = "default";
89*833e5d42SEmmanuel Vadot		#io-channel-cells = <1>;
90*833e5d42SEmmanuel Vadot		#size-cells = <0>;
91*833e5d42SEmmanuel Vadot
92*833e5d42SEmmanuel Vadot		channel@1 {
93*833e5d42SEmmanuel Vadot			reg = <5>; /* Single-ended between AIN1 and GND */
94*833e5d42SEmmanuel Vadot			ti,datarate = <0>;
95*833e5d42SEmmanuel Vadot			ti,gain = <5>;
96*833e5d42SEmmanuel Vadot		};
97*833e5d42SEmmanuel Vadot
98*833e5d42SEmmanuel Vadot		channel@2 {
99*833e5d42SEmmanuel Vadot			reg = <6>; /* Single-ended between AIN2 and GND */
100*833e5d42SEmmanuel Vadot			ti,datarate = <0>;
101*833e5d42SEmmanuel Vadot			ti,gain = <5>;
102*833e5d42SEmmanuel Vadot		};
103*833e5d42SEmmanuel Vadot	};
104*833e5d42SEmmanuel Vadot
105*833e5d42SEmmanuel Vadot	switch@5f {
106*833e5d42SEmmanuel Vadot		compatible = "microchip,ksz9896";
107*833e5d42SEmmanuel Vadot		reg = <0x5f>;
108*833e5d42SEmmanuel Vadot		interrupt-parent = <&gpio3>;
109*833e5d42SEmmanuel Vadot		interrupts = <RK_PB7 IRQ_TYPE_EDGE_FALLING>; /* ETH_INTRP_N */
110*833e5d42SEmmanuel Vadot		pinctrl-0 = <&eth_reset_n &eth_intrp_n>;
111*833e5d42SEmmanuel Vadot		pinctrl-names = "default";
112*833e5d42SEmmanuel Vadot		reset-gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>; /* ETH_RESET */
113*833e5d42SEmmanuel Vadot		microchip,synclko-disable; /* CLKO_25_125 only routed to TP1 */
114*833e5d42SEmmanuel Vadot
115*833e5d42SEmmanuel Vadot		ethernet-ports {
116*833e5d42SEmmanuel Vadot			#address-cells = <1>;
117*833e5d42SEmmanuel Vadot			#size-cells = <0>;
118*833e5d42SEmmanuel Vadot
119*833e5d42SEmmanuel Vadot			lan1: port@0 {
120*833e5d42SEmmanuel Vadot				reg = <0>;
121*833e5d42SEmmanuel Vadot				label = "ETH1";
122*833e5d42SEmmanuel Vadot			};
123*833e5d42SEmmanuel Vadot
124*833e5d42SEmmanuel Vadot			lan2: port@1 {
125*833e5d42SEmmanuel Vadot				reg = <1>;
126*833e5d42SEmmanuel Vadot				label = "ETH2";
127*833e5d42SEmmanuel Vadot			};
128*833e5d42SEmmanuel Vadot
129*833e5d42SEmmanuel Vadot			lan3: port@2 {
130*833e5d42SEmmanuel Vadot				reg = <2>;
131*833e5d42SEmmanuel Vadot				label = "ETH3";
132*833e5d42SEmmanuel Vadot			};
133*833e5d42SEmmanuel Vadot
134*833e5d42SEmmanuel Vadot			lan4: port@3 {
135*833e5d42SEmmanuel Vadot				reg = <3>;
136*833e5d42SEmmanuel Vadot				label = "ETH4";
137*833e5d42SEmmanuel Vadot			};
138*833e5d42SEmmanuel Vadot
139*833e5d42SEmmanuel Vadot			port@5 {
140*833e5d42SEmmanuel Vadot				reg = <5>;
141*833e5d42SEmmanuel Vadot				ethernet = <&gmac1>;
142*833e5d42SEmmanuel Vadot				label = "CPU";
143*833e5d42SEmmanuel Vadot				phy-mode = "rgmii-id";
144*833e5d42SEmmanuel Vadot				rx-internal-delay-ps = <2000>;
145*833e5d42SEmmanuel Vadot				tx-internal-delay-ps = <2000>;
146*833e5d42SEmmanuel Vadot
147*833e5d42SEmmanuel Vadot				fixed-link {
148*833e5d42SEmmanuel Vadot					speed = <1000>;
149*833e5d42SEmmanuel Vadot					full-duplex;
150*833e5d42SEmmanuel Vadot				};
151*833e5d42SEmmanuel Vadot			};
152*833e5d42SEmmanuel Vadot		};
153*833e5d42SEmmanuel Vadot	};
154*833e5d42SEmmanuel Vadot};
155*833e5d42SEmmanuel Vadot
156*833e5d42SEmmanuel Vadot&pinctrl {
157*833e5d42SEmmanuel Vadot	adc {
158*833e5d42SEmmanuel Vadot		adc_alert: adc-alert-irq {
159*833e5d42SEmmanuel Vadot			rockchip,pins =
160*833e5d42SEmmanuel Vadot				<3 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>;
161*833e5d42SEmmanuel Vadot		};
162*833e5d42SEmmanuel Vadot	};
163*833e5d42SEmmanuel Vadot
164*833e5d42SEmmanuel Vadot	ethernet {
165*833e5d42SEmmanuel Vadot		eth_intrp_n: eth-intrp-n {
166*833e5d42SEmmanuel Vadot			rockchip,pins =
167*833e5d42SEmmanuel Vadot				<3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
168*833e5d42SEmmanuel Vadot		};
169*833e5d42SEmmanuel Vadot
170*833e5d42SEmmanuel Vadot		eth_reset_n: eth-reset-n {
171*833e5d42SEmmanuel Vadot			rockchip,pins =
172*833e5d42SEmmanuel Vadot				<3 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
173*833e5d42SEmmanuel Vadot		};
174*833e5d42SEmmanuel Vadot	};
175*833e5d42SEmmanuel Vadot
176*833e5d42SEmmanuel Vadot	leds {
177*833e5d42SEmmanuel Vadot		led_usr1_pin: led-usr1-pin {
178*833e5d42SEmmanuel Vadot			rockchip,pins =
179*833e5d42SEmmanuel Vadot				<1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
180*833e5d42SEmmanuel Vadot		};
181*833e5d42SEmmanuel Vadot
182*833e5d42SEmmanuel Vadot		led_usr2_pin: led-usr2-pin {
183*833e5d42SEmmanuel Vadot			rockchip,pins =
184*833e5d42SEmmanuel Vadot				<3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_down>;
185*833e5d42SEmmanuel Vadot		};
186*833e5d42SEmmanuel Vadot	};
187*833e5d42SEmmanuel Vadot};
188*833e5d42SEmmanuel Vadot
189*833e5d42SEmmanuel Vadot&uart9 {
190*833e5d42SEmmanuel Vadot	/* GPIO3_D0/EN_RS485_MODE for switching between RS232 and RS485 */
191*833e5d42SEmmanuel Vadot	pinctrl-0 = <&uart9m2_xfer &uart9m2_rtsn>;
192*833e5d42SEmmanuel Vadot	pinctrl-names = "default";
193*833e5d42SEmmanuel Vadot	linux,rs485-enabled-at-boot-time;
194*833e5d42SEmmanuel Vadot	status = "okay";
195*833e5d42SEmmanuel Vadot};
196