1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Author: Frank Wunderlich <frank-w@public-files.de>
4 *
5 */
6
7/dts-v1/;
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/leds/common.h>
10#include <dt-bindings/pinctrl/rockchip.h>
11#include "rk3568.dtsi"
12
13/ {
14	model = "Bananapi-R2 Pro (RK3568) DDR4 Board";
15	compatible = "rockchip,rk3568-bpi-r2pro", "rockchip,rk3568";
16
17	aliases {
18		ethernet0 = &gmac0;
19		ethernet1 = &gmac1;
20		mmc0 = &sdmmc0;
21		mmc1 = &sdhci;
22	};
23
24	chosen: chosen {
25		stdout-path = "serial2:1500000n8";
26	};
27
28	leds {
29		compatible = "gpio-leds";
30		pinctrl-names = "default";
31		pinctrl-0 = <&blue_led_pin &green_led_pin>;
32
33		blue_led: led-0 {
34			color = <LED_COLOR_ID_BLUE>;
35			default-state = "off";
36			function = LED_FUNCTION_STATUS;
37			gpios = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>;
38		};
39
40		green_led: led-1 {
41			color = <LED_COLOR_ID_GREEN>;
42			default-state = "on";
43			function = LED_FUNCTION_POWER;
44			gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
45		};
46	};
47
48	dc_12v: dc-12v {
49		compatible = "regulator-fixed";
50		regulator-name = "dc_12v";
51		regulator-always-on;
52		regulator-boot-on;
53		regulator-min-microvolt = <12000000>;
54		regulator-max-microvolt = <12000000>;
55	};
56
57	vcc3v3_sys: vcc3v3-sys {
58		compatible = "regulator-fixed";
59		regulator-name = "vcc3v3_sys";
60		regulator-always-on;
61		regulator-boot-on;
62		regulator-min-microvolt = <3300000>;
63		regulator-max-microvolt = <3300000>;
64		vin-supply = <&dc_12v>;
65	};
66
67	vcc5v0_sys: vcc5v0-sys {
68		compatible = "regulator-fixed";
69		regulator-name = "vcc5v0_sys";
70		regulator-always-on;
71		regulator-boot-on;
72		regulator-min-microvolt = <5000000>;
73		regulator-max-microvolt = <5000000>;
74		vin-supply = <&dc_12v>;
75	};
76
77	vcc5v0_usb: vcc5v0_usb {
78		compatible = "regulator-fixed";
79		regulator-name = "vcc5v0_usb";
80		regulator-always-on;
81		regulator-boot-on;
82		regulator-min-microvolt = <5000000>;
83		regulator-max-microvolt = <5000000>;
84		vin-supply = <&dc_12v>;
85	};
86
87	vcc5v0_usb_host: vcc5v0-usb-host {
88		compatible = "regulator-fixed";
89		enable-active-high;
90		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
91		pinctrl-names = "default";
92		pinctrl-0 = <&vcc5v0_usb_host_en>;
93		regulator-name = "vcc5v0_usb_host";
94		regulator-min-microvolt = <5000000>;
95		regulator-max-microvolt = <5000000>;
96		vin-supply = <&vcc5v0_usb>;
97	};
98
99	vcc5v0_usb_otg: vcc5v0-usb-otg {
100		compatible = "regulator-fixed";
101		enable-active-high;
102		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
103		pinctrl-names = "default";
104		pinctrl-0 = <&vcc5v0_usb_otg_en>;
105		regulator-name = "vcc5v0_usb_otg";
106		regulator-min-microvolt = <5000000>;
107		regulator-max-microvolt = <5000000>;
108		vin-supply = <&vcc5v0_usb>;
109	};
110};
111
112&combphy0 {
113	/* used for USB3 */
114	status = "okay";
115};
116
117&combphy1 {
118	/* used for USB3 */
119	status = "okay";
120};
121
122&combphy2 {
123	/* used for SATA */
124	status = "okay";
125};
126
127&gmac0 {
128	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>;
129	assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>;
130	clock_in_out = "input";
131	phy-mode = "rgmii";
132	pinctrl-names = "default";
133	pinctrl-0 = <&gmac0_miim
134		     &gmac0_tx_bus2
135		     &gmac0_rx_bus2
136		     &gmac0_rgmii_clk
137		     &gmac0_rgmii_bus>;
138	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
139	snps,reset-active-low;
140	/* Reset time is 20ms, 100ms for rtl8211f */
141	snps,reset-delays-us = <0 20000 100000>;
142	tx_delay = <0x4f>;
143	rx_delay = <0x0f>;
144	status = "okay";
145
146	fixed-link {
147		speed = <1000>;
148		full-duplex;
149		pause;
150	};
151};
152
153&gmac1 {
154	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
155	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>;
156	clock_in_out = "output";
157	phy-handle = <&rgmii_phy1>;
158	phy-mode = "rgmii";
159	pinctrl-names = "default";
160	pinctrl-0 = <&gmac1m1_miim
161		     &gmac1m1_tx_bus2
162		     &gmac1m1_rx_bus2
163		     &gmac1m1_rgmii_clk
164		     &gmac1m1_rgmii_bus>;
165
166	snps,reset-gpio = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
167	snps,reset-active-low;
168	/* Reset time is 20ms, 100ms for rtl8211f */
169	snps,reset-delays-us = <0 20000 100000>;
170
171	tx_delay = <0x3c>;
172	rx_delay = <0x2f>;
173
174	status = "okay";
175};
176
177&i2c0 {
178	status = "okay";
179
180	rk809: pmic@20 {
181		compatible = "rockchip,rk809";
182		reg = <0x20>;
183		interrupt-parent = <&gpio0>;
184		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
185		#clock-cells = <1>;
186		pinctrl-names = "default";
187		pinctrl-0 = <&pmic_int>;
188		rockchip,system-power-controller;
189		vcc1-supply = <&vcc3v3_sys>;
190		vcc2-supply = <&vcc3v3_sys>;
191		vcc3-supply = <&vcc3v3_sys>;
192		vcc4-supply = <&vcc3v3_sys>;
193		vcc5-supply = <&vcc3v3_sys>;
194		vcc6-supply = <&vcc3v3_sys>;
195		vcc7-supply = <&vcc3v3_sys>;
196		vcc8-supply = <&vcc3v3_sys>;
197		vcc9-supply = <&vcc3v3_sys>;
198		wakeup-source;
199
200		regulators {
201			vdd_logic: DCDC_REG1 {
202				regulator-name = "vdd_logic";
203				regulator-always-on;
204				regulator-boot-on;
205				regulator-init-microvolt = <900000>;
206				regulator-initial-mode = <0x2>;
207				regulator-min-microvolt = <500000>;
208				regulator-max-microvolt = <1350000>;
209				regulator-ramp-delay = <6001>;
210
211				regulator-state-mem {
212					regulator-off-in-suspend;
213				};
214			};
215
216			vdd_gpu: DCDC_REG2 {
217				regulator-name = "vdd_gpu";
218				regulator-init-microvolt = <900000>;
219				regulator-initial-mode = <0x2>;
220				regulator-min-microvolt = <500000>;
221				regulator-max-microvolt = <1350000>;
222				regulator-ramp-delay = <6001>;
223
224				regulator-state-mem {
225					regulator-off-in-suspend;
226				};
227			};
228
229			vcc_ddr: DCDC_REG3 {
230				regulator-name = "vcc_ddr";
231				regulator-always-on;
232				regulator-boot-on;
233				regulator-initial-mode = <0x2>;
234
235				regulator-state-mem {
236					regulator-on-in-suspend;
237				};
238			};
239
240			vdd_npu: DCDC_REG4 {
241				regulator-name = "vdd_npu";
242				regulator-init-microvolt = <900000>;
243				regulator-initial-mode = <0x2>;
244				regulator-min-microvolt = <500000>;
245				regulator-max-microvolt = <1350000>;
246				regulator-ramp-delay = <6001>;
247
248				regulator-state-mem {
249					regulator-off-in-suspend;
250				};
251			};
252
253			vcc_1v8: DCDC_REG5 {
254				regulator-name = "vcc_1v8";
255				regulator-always-on;
256				regulator-boot-on;
257				regulator-min-microvolt = <1800000>;
258				regulator-max-microvolt = <1800000>;
259
260				regulator-state-mem {
261					regulator-off-in-suspend;
262				};
263			};
264
265			vdda0v9_image: LDO_REG1 {
266				regulator-name = "vdda0v9_image";
267				regulator-min-microvolt = <900000>;
268				regulator-max-microvolt = <900000>;
269
270				regulator-state-mem {
271					regulator-off-in-suspend;
272				};
273			};
274
275			vdda_0v9: LDO_REG2 {
276				regulator-name = "vdda_0v9";
277				regulator-always-on;
278				regulator-boot-on;
279				regulator-min-microvolt = <900000>;
280				regulator-max-microvolt = <900000>;
281
282				regulator-state-mem {
283					regulator-off-in-suspend;
284				};
285			};
286
287			vdda0v9_pmu: LDO_REG3 {
288				regulator-name = "vdda0v9_pmu";
289				regulator-always-on;
290				regulator-boot-on;
291				regulator-min-microvolt = <900000>;
292				regulator-max-microvolt = <900000>;
293
294				regulator-state-mem {
295					regulator-on-in-suspend;
296					regulator-suspend-microvolt = <900000>;
297				};
298			};
299
300			vccio_acodec: LDO_REG4 {
301				regulator-name = "vccio_acodec";
302				regulator-always-on;
303				regulator-boot-on;
304				regulator-min-microvolt = <3300000>;
305				regulator-max-microvolt = <3300000>;
306
307				regulator-state-mem {
308					regulator-off-in-suspend;
309				};
310			};
311
312			vccio_sd: LDO_REG5 {
313				regulator-name = "vccio_sd";
314				regulator-min-microvolt = <1800000>;
315				regulator-max-microvolt = <3300000>;
316
317				regulator-state-mem {
318					regulator-off-in-suspend;
319				};
320			};
321
322			vcc3v3_pmu: LDO_REG6 {
323				regulator-name = "vcc3v3_pmu";
324				regulator-always-on;
325				regulator-boot-on;
326				regulator-min-microvolt = <3300000>;
327				regulator-max-microvolt = <3300000>;
328
329				regulator-state-mem {
330					regulator-on-in-suspend;
331					regulator-suspend-microvolt = <3300000>;
332				};
333			};
334
335			vcca_1v8: LDO_REG7 {
336				regulator-name = "vcca_1v8";
337				regulator-always-on;
338				regulator-boot-on;
339				regulator-min-microvolt = <1800000>;
340				regulator-max-microvolt = <1800000>;
341
342				regulator-state-mem {
343					regulator-off-in-suspend;
344				};
345			};
346
347			vcca1v8_pmu: LDO_REG8 {
348				regulator-name = "vcca1v8_pmu";
349				regulator-always-on;
350				regulator-boot-on;
351				regulator-min-microvolt = <1800000>;
352				regulator-max-microvolt = <1800000>;
353
354				regulator-state-mem {
355					regulator-on-in-suspend;
356					regulator-suspend-microvolt = <1800000>;
357				};
358			};
359
360			vcca1v8_image: LDO_REG9 {
361				regulator-name = "vcca1v8_image";
362				regulator-min-microvolt = <1800000>;
363				regulator-max-microvolt = <1800000>;
364
365				regulator-state-mem {
366					regulator-off-in-suspend;
367				};
368			};
369
370			vcc_3v3: SWITCH_REG1 {
371				regulator-name = "vcc_3v3";
372				regulator-always-on;
373				regulator-boot-on;
374
375				regulator-state-mem {
376					regulator-off-in-suspend;
377				};
378			};
379
380			vcc3v3_sd: SWITCH_REG2 {
381				regulator-name = "vcc3v3_sd";
382				regulator-always-on;
383
384				regulator-state-mem {
385					regulator-off-in-suspend;
386				};
387			};
388		};
389	};
390};
391
392&i2c5 {
393	/* pin 3 (SDA) + 4 (SCL) of header con2 */
394	status = "disabled";
395};
396
397&mdio1 {
398	rgmii_phy1: ethernet-phy@0 {
399		compatible = "ethernet-phy-ieee802.3-c22";
400		reg = <0x0>;
401	};
402};
403
404&pinctrl {
405	leds {
406		blue_led_pin: blue-led-pin {
407			rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
408		};
409		green_led_pin: green-led-pin {
410			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
411		};
412	};
413
414	pmic {
415		pmic_int: pmic_int {
416			rockchip,pins =
417				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
418		};
419	};
420
421	usb {
422		vcc5v0_usb_host_en: vcc5v0_usb_host_en {
423			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
424		};
425
426		vcc5v0_usb_otg_en: vcc5v0_usb_otg_en {
427			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
428		};
429	};
430};
431
432&pmu_io_domains {
433	pmuio1-supply = <&vcc3v3_pmu>;
434	pmuio2-supply = <&vcc3v3_pmu>;
435	vccio1-supply = <&vccio_acodec>;
436	vccio3-supply = <&vccio_sd>;
437	vccio4-supply = <&vcc_3v3>;
438	vccio5-supply = <&vcc_3v3>;
439	vccio6-supply = <&vcc_1v8>;
440	vccio7-supply = <&vcc_3v3>;
441	status = "okay";
442};
443
444&pwm8 {
445	/* fan 5v - gnd - pwm */
446	status = "okay";
447};
448
449&pwm10 {
450	/* pin 7 of header con2 */
451	status = "disabled";
452};
453
454&pwm11 {
455	/* pin 15 of header con2 */
456	status = "disabled";
457};
458
459&pwm12 {
460	/* pin 21 of header con2 */
461	/* shared with uart9 + spi3 */
462	pinctrl-0 = <&pwm12m1_pins>;
463	status = "disabled";
464};
465
466&pwm13 {
467	/* pin 24 of header con2 */
468	/* shared with uart9 */
469	pinctrl-0 = <&pwm13m1_pins>;
470	status = "disabled";
471};
472
473&pwm14 {
474	/* pin 23 of header con2 */
475	/* shared with spi3 */
476	pinctrl-0 = <&pwm14m1_pins>;
477	status = "disabled";
478};
479
480&pwm15 {
481	/* pin 19 of header con2 */
482	/* shared with spi3 */
483	pinctrl-0 = <&pwm15m1_pins>;
484	status = "disabled";
485};
486
487&saradc {
488	vref-supply = <&vcca_1v8>;
489	status = "okay";
490};
491
492&sata2 {
493	status = "okay";
494};
495
496&sdhci {
497	bus-width = <8>;
498	max-frequency = <200000000>;
499	non-removable;
500	pinctrl-names = "default";
501	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
502	status = "okay";
503};
504
505&sdmmc0 {
506	bus-width = <4>;
507	cap-sd-highspeed;
508	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
509	disable-wp;
510	pinctrl-names = "default";
511	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
512	sd-uhs-sdr104;
513	vmmc-supply = <&vcc3v3_sd>;
514	vqmmc-supply = <&vccio_sd>;
515	status = "okay";
516};
517
518&spi3 {
519	/* pin 19 (MO) + 21 (MI) + 23 (CK) of header con2 */
520	/* shared with pwm12/14/15 and uart9 */
521	pinctrl-0 = <&spi3m1_pins>;
522	status = "disabled";
523};
524
525&tsadc {
526	status = "okay";
527};
528
529&uart0 {
530	/* pin 8 (TX) + 10 (RX) (RTS:16, CTS:18) of header con2 */
531	status = "disabled";
532};
533
534&uart2 {
535	/* debug-uart */
536	status = "okay";
537};
538
539&uart7 {
540	/* pin 11 (TX) + 13 (RX) of header con2 */
541	pinctrl-0 = <&uart7m1_xfer>;
542	status = "disabled";
543};
544
545&uart9 {
546	/* pin 21 (TX) + 24 (RX) of header con2 */
547	/* shared with pwm13 and pwm12/spi3 */
548	pinctrl-0 = <&uart9m1_xfer>;
549	status = "disabled";
550};
551
552&usb_host0_ehci {
553	status = "okay";
554};
555
556&usb_host0_ohci {
557	status = "okay";
558};
559
560&usb_host0_xhci {
561	extcon = <&usb2phy0>;
562	status = "okay";
563};
564
565&usb_host1_ehci {
566	status = "okay";
567};
568
569&usb_host1_ohci {
570	status = "okay";
571};
572
573&usb_host1_xhci {
574	status = "okay";
575};
576
577&usb2phy0 {
578	status = "okay";
579};
580
581&usb2phy0_host {
582	phy-supply = <&vcc5v0_usb_host>;
583	status = "okay";
584};
585
586&usb2phy0_otg {
587	phy-supply = <&vcc5v0_usb_otg>;
588	status = "okay";
589};
590