1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2023 Ondřej Jirman <[email protected]>
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/pinctrl/rockchip.h>
10#include <dt-bindings/soc/rockchip,vop2.h>
11#include <dt-bindings/usb/pd.h>
12#include "rk3588-orangepi-5.dtsi"
13
14/ {
15	model = "Xunlong Orange Pi 5 Plus";
16	compatible = "xunlong,orangepi-5-plus", "rockchip,rk3588";
17
18	hdmi0-con {
19		compatible = "hdmi-connector";
20		type = "a";
21
22		port {
23			hdmi0_con_in: endpoint {
24				remote-endpoint = <&hdmi0_out_con>;
25			};
26		};
27	};
28
29	ir-receiver {
30		compatible = "gpio-ir-receiver";
31		gpios = <&gpio4 RK_PB3 GPIO_ACTIVE_LOW>;
32		pinctrl-names = "default";
33		pinctrl-0 = <&ir_receiver_pin>;
34	};
35
36	rfkill {
37		compatible = "rfkill-gpio";
38		label = "rfkill-pcie-wlan";
39		radio-type = "wlan";
40		shutdown-gpios = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
41	};
42
43	vbus5v0_typec: regulator-vbus-typec {
44		compatible = "regulator-fixed";
45		enable-active-high;
46		gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
47		pinctrl-names = "default";
48		pinctrl-0 = <&typec5v_pwren>;
49		regulator-name = "vbus5v0_typec";
50		regulator-min-microvolt = <5000000>;
51		regulator-max-microvolt = <5000000>;
52		vin-supply = <&vcc5v0_sys>;
53	};
54};
55
56&speaker_amp {
57	enable-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;
58	status = "okay";
59};
60
61&headphone_amp {
62	enable-gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_HIGH>;
63};
64
65&analog_sound {
66	pinctrl-names = "default";
67	pinctrl-0 = <&hp_detect>;
68	simple-audio-card,aux-devs = <&speaker_amp>, <&headphone_amp>;
69	simple-audio-card,hp-det-gpios = <&gpio1 RK_PD3 GPIO_ACTIVE_LOW>;
70	simple-audio-card,widgets =
71		"Microphone", "Onboard Microphone",
72		"Microphone", "Microphone Jack",
73		"Speaker", "Speaker",
74		"Headphone", "Headphones";
75
76	simple-audio-card,routing =
77		"Headphones", "LOUT1",
78		"Headphones", "ROUT1",
79		"Speaker", "LOUT2",
80		"Speaker", "ROUT2",
81
82		"Headphones", "Headphones Amp OUTL",
83		"Headphones", "Headphones Amp OUTR",
84		"Headphones Amp INL", "LOUT1",
85		"Headphones Amp INR", "ROUT1",
86
87		"Speaker", "Speaker Amp OUTL",
88		"Speaker", "Speaker Amp OUTR",
89		"Speaker Amp INL", "LOUT2",
90		"Speaker Amp INR", "ROUT2",
91
92		/* single ended signal to LINPUT1 */
93		"LINPUT1", "Microphone Jack",
94		"RINPUT1", "Microphone Jack",
95		/* differential signal */
96		"LINPUT2", "Onboard Microphone",
97		"RINPUT2", "Onboard Microphone";
98};
99
100&combphy0_ps {
101	status = "okay";
102};
103
104&combphy1_ps {
105	status = "okay";
106};
107
108&fan {
109	pwms = <&pwm3 0 50000 0>;
110};
111
112&hdmi0 {
113	status = "okay";
114};
115
116&hdmi0_in {
117	hdmi0_in_vp0: endpoint {
118		remote-endpoint = <&vp0_out_hdmi0>;
119	};
120};
121
122&hdmi0_out {
123	hdmi0_out_con: endpoint {
124		remote-endpoint = <&hdmi0_con_in>;
125	};
126};
127
128&hdptxphy_hdmi0 {
129	status = "okay";
130};
131
132&hym8563 {
133	interrupt-parent = <&gpio0>;
134	interrupts = <RK_PB0 IRQ_TYPE_LEVEL_LOW>;
135	pinctrl-names = "default";
136	pinctrl-0 = <&hym8563_int>;
137};
138
139&i2c6 {
140	usbc0: usb-typec@22 {
141		compatible = "fcs,fusb302";
142		reg = <0x22>;
143		interrupt-parent = <&gpio0>;
144		interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;
145		pinctrl-names = "default";
146		pinctrl-0 = <&usbc0_int>;
147		vbus-supply = <&vbus5v0_typec>;
148		status = "okay";
149
150		usb_con: connector {
151			compatible = "usb-c-connector";
152			data-role = "dual";
153			label = "USB-C";
154			power-role = "dual";
155			op-sink-microwatt = <10>;
156			source-pdos = <PDO_FIXED(5000, 1400, PDO_FIXED_USB_COMM)>;
157			sink-pdos = <PDO_FIXED(5000, 10, PDO_FIXED_USB_COMM)>;
158			try-power-role = "source";
159
160			ports {
161				#address-cells = <1>;
162				#size-cells = <0>;
163
164				port@0 {
165					reg = <0>;
166
167					usbc0_hs: endpoint {
168						remote-endpoint = <&usb_host0_xhci_drd_sw>;
169					};
170				};
171
172				port@1 {
173					reg = <1>;
174
175					usbc0_ss: endpoint {
176						remote-endpoint = <&usbdp_phy0_typec_ss>;
177					};
178				};
179
180				port@2 {
181					reg = <2>;
182
183					usbc0_sbu: endpoint {
184						remote-endpoint = <&usbdp_phy0_typec_sbu>;
185					};
186				};
187			};
188		};
189	};
190};
191
192&led_blue_gpio {
193	gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;
194	status = "okay";
195};
196
197&led_green_pwm {
198	pwms = <&pwm2 0 25000 0>;
199};
200
201/* phy1 - M.KEY socket */
202&pcie2x1l0 {
203	reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>;
204	vpcie3v3-supply = <&vcc3v3_wf>;
205	status = "okay";
206};
207
208/* phy2 - right ethernet port */
209&pcie2x1l1 {
210	reset-gpios = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>;
211	vpcie3v3-supply = <&vcc3v3_pcie_eth>;
212	status = "okay";
213};
214
215/* phy0 - left ethernet port */
216&pcie2x1l2 {
217	reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>;
218	vpcie3v3-supply = <&vcc3v3_pcie_eth>;
219	status = "okay";
220};
221
222&pinctrl {
223	hym8563 {
224		hym8563_int: hym8563-int {
225			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
226		};
227	};
228
229	leds {
230		blue_led_pin: blue-led {
231			rockchip,pins = <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>;
232		};
233	};
234
235	ir-receiver {
236		ir_receiver_pin: ir-receiver-pin {
237			rockchip,pins = <4 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
238		};
239	};
240
241	sound {
242		hp_detect: hp-detect {
243			rockchip,pins = <1 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
244		};
245	};
246
247	usb {
248		vcc5v0_usb20_en: vcc5v0-usb20-en {
249			rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
250		};
251	};
252
253	usb-typec {
254		usbc0_int: usbc0-int {
255			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>;
256		};
257
258		typec5v_pwren: typec5v-pwren {
259			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
260		};
261	};
262};
263
264&pwm2 {
265	pinctrl-0 = <&pwm2m1_pins>;
266	pinctrl-names = "default";
267	status = "okay";
268};
269
270&pwm3 {
271	pinctrl-0 = <&pwm3m1_pins>;
272	status = "okay";
273};
274
275&recovery_button {
276	status = "okay";
277};
278
279&sfc {
280	pinctrl-names = "default";
281	pinctrl-0 = <&fspim1_pins>;
282};
283
284&u2phy1_otg {
285	phy-supply = <&vcc5v0_sys>;
286};
287
288&uart9 {
289	pinctrl-0 = <&uart9m0_xfer>;
290	status = "okay";
291};
292
293&usbdp_phy0 {
294	mode-switch;
295	orientation-switch;
296	sbu1-dc-gpios = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>;
297	sbu2-dc-gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>;
298
299	port {
300		#address-cells = <1>;
301		#size-cells = <0>;
302
303		usbdp_phy0_typec_ss: endpoint@0 {
304			reg = <0>;
305			remote-endpoint = <&usbc0_ss>;
306		};
307
308		usbdp_phy0_typec_sbu: endpoint@1 {
309			reg = <1>;
310			remote-endpoint = <&usbc0_sbu>;
311		};
312	};
313};
314
315&usb_host0_xhci {
316	usb-role-switch;
317
318	port {
319		usb_host0_xhci_drd_sw: endpoint {
320			remote-endpoint = <&usbc0_hs>;
321		};
322	};
323};
324
325&vcc3v3_pcie_eth {
326	gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
327};
328
329&vcc3v3_wf {
330	status = "okay";
331};
332
333&vcc5v0_usb20 {
334	gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_HIGH>;
335	pinctrl-names = "default";
336	pinctrl-0 = <&vcc5v0_usb20_en>;
337};
338
339&vp0 {
340	vp0_out_hdmi0: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
341		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
342		remote-endpoint = <&hdmi0_in_vp0>;
343	};
344};
345