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		mmc0 = &sdmmc0;
20		mmc1 = &sdhci;
21	};
22
23	chosen: chosen {
24		stdout-path = "serial2:1500000n8";
25	};
26
27	leds {
28		compatible = "gpio-leds";
29		pinctrl-names = "default";
30		pinctrl-0 = <&blue_led_pin &green_led_pin>;
31
32		blue_led: led-0 {
33			color = <LED_COLOR_ID_BLUE>;
34			default-state = "off";
35			function = LED_FUNCTION_STATUS;
36			gpios = <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>;
37		};
38
39		green_led: led-1 {
40			color = <LED_COLOR_ID_GREEN>;
41			default-state = "on";
42			function = LED_FUNCTION_POWER;
43			gpios = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
44		};
45	};
46
47	dc_12v: dc-12v {
48		compatible = "regulator-fixed";
49		regulator-name = "dc_12v";
50		regulator-always-on;
51		regulator-boot-on;
52		regulator-min-microvolt = <12000000>;
53		regulator-max-microvolt = <12000000>;
54	};
55
56	vcc3v3_sys: vcc3v3-sys {
57		compatible = "regulator-fixed";
58		regulator-name = "vcc3v3_sys";
59		regulator-always-on;
60		regulator-boot-on;
61		regulator-min-microvolt = <3300000>;
62		regulator-max-microvolt = <3300000>;
63		vin-supply = <&dc_12v>;
64	};
65
66	vcc5v0_sys: vcc5v0-sys {
67		compatible = "regulator-fixed";
68		regulator-name = "vcc5v0_sys";
69		regulator-always-on;
70		regulator-boot-on;
71		regulator-min-microvolt = <5000000>;
72		regulator-max-microvolt = <5000000>;
73		vin-supply = <&dc_12v>;
74	};
75};
76
77&gmac0 {
78	assigned-clocks = <&cru SCLK_GMAC0_RX_TX>, <&cru SCLK_GMAC0>;
79	assigned-clock-parents = <&cru SCLK_GMAC0_RGMII_SPEED>, <&cru CLK_MAC0_2TOP>;
80	clock_in_out = "input";
81	phy-handle = <&rgmii_phy0>;
82	phy-mode = "rgmii";
83	pinctrl-names = "default";
84	pinctrl-0 = <&gmac0_miim
85		     &gmac0_tx_bus2
86		     &gmac0_rx_bus2
87		     &gmac0_rgmii_clk
88		     &gmac0_rgmii_bus>;
89	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
90	snps,reset-active-low;
91	/* Reset time is 20ms, 100ms for rtl8211f */
92	snps,reset-delays-us = <0 20000 100000>;
93	tx_delay = <0x3c>;
94	rx_delay = <0x2f>;
95	status = "okay";
96};
97
98&i2c0 {
99	status = "okay";
100
101	rk809: pmic@20 {
102		compatible = "rockchip,rk809";
103		reg = <0x20>;
104		interrupt-parent = <&gpio0>;
105		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
106		#clock-cells = <1>;
107		pinctrl-names = "default";
108		pinctrl-0 = <&pmic_int>;
109		rockchip,system-power-controller;
110		vcc1-supply = <&vcc3v3_sys>;
111		vcc2-supply = <&vcc3v3_sys>;
112		vcc3-supply = <&vcc3v3_sys>;
113		vcc4-supply = <&vcc3v3_sys>;
114		vcc5-supply = <&vcc3v3_sys>;
115		vcc6-supply = <&vcc3v3_sys>;
116		vcc7-supply = <&vcc3v3_sys>;
117		vcc8-supply = <&vcc3v3_sys>;
118		vcc9-supply = <&vcc3v3_sys>;
119		wakeup-source;
120
121		regulators {
122			vdd_logic: DCDC_REG1 {
123				regulator-name = "vdd_logic";
124				regulator-always-on;
125				regulator-boot-on;
126				regulator-init-microvolt = <900000>;
127				regulator-initial-mode = <0x2>;
128				regulator-min-microvolt = <500000>;
129				regulator-max-microvolt = <1350000>;
130				regulator-ramp-delay = <6001>;
131
132				regulator-state-mem {
133					regulator-off-in-suspend;
134				};
135			};
136
137			vdd_gpu: DCDC_REG2 {
138				regulator-name = "vdd_gpu";
139				regulator-init-microvolt = <900000>;
140				regulator-initial-mode = <0x2>;
141				regulator-min-microvolt = <500000>;
142				regulator-max-microvolt = <1350000>;
143				regulator-ramp-delay = <6001>;
144
145				regulator-state-mem {
146					regulator-off-in-suspend;
147				};
148			};
149
150			vcc_ddr: DCDC_REG3 {
151				regulator-name = "vcc_ddr";
152				regulator-always-on;
153				regulator-boot-on;
154				regulator-initial-mode = <0x2>;
155
156				regulator-state-mem {
157					regulator-on-in-suspend;
158				};
159			};
160
161			vdd_npu: DCDC_REG4 {
162				regulator-name = "vdd_npu";
163				regulator-init-microvolt = <900000>;
164				regulator-initial-mode = <0x2>;
165				regulator-min-microvolt = <500000>;
166				regulator-max-microvolt = <1350000>;
167				regulator-ramp-delay = <6001>;
168
169				regulator-state-mem {
170					regulator-off-in-suspend;
171				};
172			};
173
174			vcc_1v8: DCDC_REG5 {
175				regulator-name = "vcc_1v8";
176				regulator-always-on;
177				regulator-boot-on;
178				regulator-min-microvolt = <1800000>;
179				regulator-max-microvolt = <1800000>;
180
181				regulator-state-mem {
182					regulator-off-in-suspend;
183				};
184			};
185
186			vdda0v9_image: LDO_REG1 {
187				regulator-name = "vdda0v9_image";
188				regulator-min-microvolt = <900000>;
189				regulator-max-microvolt = <900000>;
190
191				regulator-state-mem {
192					regulator-off-in-suspend;
193				};
194			};
195
196			vdda_0v9: LDO_REG2 {
197				regulator-name = "vdda_0v9";
198				regulator-always-on;
199				regulator-boot-on;
200				regulator-min-microvolt = <900000>;
201				regulator-max-microvolt = <900000>;
202
203				regulator-state-mem {
204					regulator-off-in-suspend;
205				};
206			};
207
208			vdda0v9_pmu: LDO_REG3 {
209				regulator-name = "vdda0v9_pmu";
210				regulator-always-on;
211				regulator-boot-on;
212				regulator-min-microvolt = <900000>;
213				regulator-max-microvolt = <900000>;
214
215				regulator-state-mem {
216					regulator-on-in-suspend;
217					regulator-suspend-microvolt = <900000>;
218				};
219			};
220
221			vccio_acodec: LDO_REG4 {
222				regulator-name = "vccio_acodec";
223				regulator-always-on;
224				regulator-boot-on;
225				regulator-min-microvolt = <3300000>;
226				regulator-max-microvolt = <3300000>;
227
228				regulator-state-mem {
229					regulator-off-in-suspend;
230				};
231			};
232
233			vccio_sd: LDO_REG5 {
234				regulator-name = "vccio_sd";
235				regulator-min-microvolt = <1800000>;
236				regulator-max-microvolt = <3300000>;
237
238				regulator-state-mem {
239					regulator-off-in-suspend;
240				};
241			};
242
243			vcc3v3_pmu: LDO_REG6 {
244				regulator-name = "vcc3v3_pmu";
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-min-microvolt = <3300000>;
248				regulator-max-microvolt = <3300000>;
249
250				regulator-state-mem {
251					regulator-on-in-suspend;
252					regulator-suspend-microvolt = <3300000>;
253				};
254			};
255
256			vcca_1v8: LDO_REG7 {
257				regulator-name = "vcca_1v8";
258				regulator-always-on;
259				regulator-boot-on;
260				regulator-min-microvolt = <1800000>;
261				regulator-max-microvolt = <1800000>;
262
263				regulator-state-mem {
264					regulator-off-in-suspend;
265				};
266			};
267
268			vcca1v8_pmu: LDO_REG8 {
269				regulator-name = "vcca1v8_pmu";
270				regulator-always-on;
271				regulator-boot-on;
272				regulator-min-microvolt = <1800000>;
273				regulator-max-microvolt = <1800000>;
274
275				regulator-state-mem {
276					regulator-on-in-suspend;
277					regulator-suspend-microvolt = <1800000>;
278				};
279			};
280
281			vcca1v8_image: LDO_REG9 {
282				regulator-name = "vcca1v8_image";
283				regulator-min-microvolt = <1800000>;
284				regulator-max-microvolt = <1800000>;
285
286				regulator-state-mem {
287					regulator-off-in-suspend;
288				};
289			};
290
291			vcc_3v3: SWITCH_REG1 {
292				regulator-name = "vcc_3v3";
293				regulator-always-on;
294				regulator-boot-on;
295
296				regulator-state-mem {
297					regulator-off-in-suspend;
298				};
299			};
300
301			vcc3v3_sd: SWITCH_REG2 {
302				regulator-name = "vcc3v3_sd";
303				regulator-always-on;
304
305				regulator-state-mem {
306					regulator-off-in-suspend;
307				};
308			};
309		};
310	};
311};
312
313&i2c5 {
314	/* pin 3 (SDA) + 4 (SCL) of header con2 */
315	status = "disabled";
316};
317
318&mdio0 {
319	rgmii_phy0: ethernet-phy@0 {
320		compatible = "ethernet-phy-ieee802.3-c22";
321		reg = <0x0>;
322	};
323};
324
325&pinctrl {
326	leds {
327		blue_led_pin: blue-led-pin {
328			rockchip,pins = <0 RK_PD6 RK_FUNC_GPIO &pcfg_pull_none>;
329		};
330		green_led_pin: green-led-pin {
331			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
332		};
333	};
334
335	pmic {
336		pmic_int: pmic_int {
337			rockchip,pins =
338				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
339		};
340	};
341};
342
343&pmu_io_domains {
344	pmuio1-supply = <&vcc3v3_pmu>;
345	pmuio2-supply = <&vcc3v3_pmu>;
346	vccio1-supply = <&vccio_acodec>;
347	vccio3-supply = <&vccio_sd>;
348	vccio4-supply = <&vcc_1v8>;
349	vccio5-supply = <&vcc_3v3>;
350	vccio6-supply = <&vcc_3v3>;
351	vccio7-supply = <&vcc_3v3>;
352	status = "okay";
353};
354
355&pwm8 {
356	/* fan 5v - gnd - pwm */
357	status = "okay";
358};
359
360&pwm10 {
361	/* pin 7 of header con2 */
362	status = "disabled";
363};
364
365&pwm11 {
366	/* pin 15 of header con2 */
367	status = "disabled";
368};
369
370&pwm12 {
371	/* pin 21 of header con2 */
372	/* shared with uart9 + spi3 */
373	pinctrl-0 = <&pwm12m1_pins>;
374	status = "disabled";
375};
376
377&pwm13 {
378	/* pin 24 of header con2 */
379	/* shared with uart9 */
380	pinctrl-0 = <&pwm13m1_pins>;
381	status = "disabled";
382};
383
384&pwm14 {
385	/* pin 23 of header con2 */
386	/* shared with spi3 */
387	pinctrl-0 = <&pwm14m1_pins>;
388	status = "disabled";
389};
390
391&pwm15 {
392	/* pin 19 of header con2 */
393	/* shared with spi3 */
394	pinctrl-0 = <&pwm15m1_pins>;
395	status = "disabled";
396};
397
398&saradc {
399	vref-supply = <&vcca_1v8>;
400	status = "okay";
401};
402
403&sdhci {
404	bus-width = <8>;
405	max-frequency = <200000000>;
406	non-removable;
407	pinctrl-names = "default";
408	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
409	status = "okay";
410};
411
412&sdmmc0 {
413	bus-width = <4>;
414	cap-sd-highspeed;
415	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
416	disable-wp;
417	pinctrl-names = "default";
418	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
419	sd-uhs-sdr104;
420	vmmc-supply = <&vcc3v3_sd>;
421	vqmmc-supply = <&vccio_sd>;
422	status = "okay";
423};
424
425&spi3 {
426	/* pin 19 (MO) + 21 (MI) + 23 (CK) of header con2 */
427	/* shared with pwm12/14/15 and uart9 */
428	pinctrl-0 = <&spi3m1_pins>;
429	status = "disabled";
430};
431
432&tsadc {
433	status = "okay";
434};
435
436&uart0 {
437	/* pin 8 (TX) + 10 (RX) (RTS:16, CTS:18) of header con2 */
438	status = "disabled";
439};
440
441&uart2 {
442	/* debug-uart */
443	status = "okay";
444};
445
446&uart7 {
447	/* pin 11 (TX) + 13 (RX) of header con2 */
448	pinctrl-0 = <&uart7m1_xfer>;
449	status = "disabled";
450};
451
452&uart9 {
453	/* pin 21 (TX) + 24 (RX) of header con2 */
454	/* shared with pwm13 and pwm12/spi3 */
455	pinctrl-0 = <&uart9m1_xfer>;
456	status = "disabled";
457};
458