xref: /freebsd/sys/contrib/device-tree/src/arm64/rockchip/rk3326-anbernic-rg351m.dtsi (revision 9978553d0199e7ec0bdd1c44fc7f6c7b0c11e43b)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Hardkernel Co., Ltd
4 * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
5 * Copyright (c) 2022 Maya Matuszczyk <maccraft123mc@gmail.com>
6 */
7
8/dts-v1/;
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/leds/common.h>
12#include <dt-bindings/pinctrl/rockchip.h>
13#include "rk3326.dtsi"
14
15/ {
16	aliases {
17		mmc0 = &sdmmc;
18	};
19
20	chosen {
21		stdout-path = "serial2:115200n8";
22	};
23
24	backlight: backlight {
25		compatible = "pwm-backlight";
26		power-supply = <&vcc_bl>;
27		pwms = <&pwm1 0 25000 0>;
28	};
29
30	/*
31	 * LED is a tri-state. Driven high it is red, driven low it is
32	 * green, and not driven at all (pin set to input) it is amber.
33	 * Additionally, there is a 2nd LED that is not controllable
34	 * that is on (red) when plugged in to power.
35	 */
36	gpio_led: gpio-leds {
37		compatible = "gpio-leds";
38		pinctrl-names = "default";
39		pinctrl-0 = <&led_pin>;
40
41		red_green_led: led-0 {
42			color = <LED_COLOR_ID_RED>;
43			gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>;
44			function = LED_FUNCTION_CHARGING;
45		};
46	};
47
48	rk817-sound {
49		compatible = "simple-audio-card";
50		simple-audio-card,name = "rk817_int";
51		simple-audio-card,format = "i2s";
52		simple-audio-card,hp-det-gpios = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
53		simple-audio-card,mclk-fs = <256>;
54		simple-audio-card,widgets =
55			"Microphone", "Mic Jack",
56			"Headphone", "Headphones",
57			"Speaker", "Speaker";
58		simple-audio-card,routing =
59			"MICL", "Mic Jack",
60			"Headphones", "HPOL",
61			"Headphones", "HPOR",
62			"Speaker", "SPKO";
63
64		simple-audio-card,codec {
65			sound-dai = <&rk817>;
66		};
67
68		simple-audio-card,cpu {
69			sound-dai = <&i2s1_2ch>;
70		};
71	};
72
73	vccsys: regulator-vccsys {
74		compatible = "regulator-fixed";
75		regulator-name = "vcc3v8_sys";
76		regulator-always-on;
77		regulator-min-microvolt = <3800000>;
78		regulator-max-microvolt = <3800000>;
79	};
80
81	vibrator {
82		compatible = "pwm-vibrator";
83		pwms = <&pwm0 0 1000000 0>;
84		pwm-names = "enable";
85	};
86};
87
88&cpu0 {
89	cpu-supply = <&vdd_arm>;
90};
91
92&cpu1 {
93	cpu-supply = <&vdd_arm>;
94};
95
96&cpu2 {
97	cpu-supply = <&vdd_arm>;
98};
99
100&cpu3 {
101	cpu-supply = <&vdd_arm>;
102};
103
104&cru {
105	assigned-clocks = <&cru PLL_NPLL>,
106		<&cru ACLK_BUS_PRE>, <&cru ACLK_PERI_PRE>,
107		<&cru HCLK_BUS_PRE>, <&cru HCLK_PERI_PRE>,
108		<&cru PCLK_BUS_PRE>, <&cru SCLK_GPU>;
109
110	assigned-clock-rates = <1188000000>,
111		<200000000>, <200000000>,
112		<150000000>, <150000000>,
113		<100000000>, <200000000>;
114};
115
116&display_subsystem {
117	status = "okay";
118};
119
120&dsi {
121	#address-cells = <1>;
122	#size-cells = <0>;
123	status = "okay";
124
125	ports {
126		mipi_out: port@1 {
127			reg = <1>;
128
129			mipi_out_panel: endpoint {
130				remote-endpoint = <&mipi_in_panel>;
131			};
132		};
133	};
134
135	internal_display: panel@0 {
136		reg = <0>;
137		backlight = <&backlight>;
138		reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
139
140		port {
141			mipi_in_panel: endpoint {
142				remote-endpoint = <&mipi_out_panel>;
143			};
144		};
145	};
146};
147
148&dsi_dphy {
149	status = "okay";
150};
151
152&gpu {
153	mali-supply = <&vdd_logic>;
154	status = "okay";
155};
156
157&i2c0 {
158	clock-frequency = <400000>;
159	i2c-scl-falling-time-ns = <16>;
160	i2c-scl-rising-time-ns = <280>;
161	status = "okay";
162
163	rk817: pmic@20 {
164		compatible = "rockchip,rk817";
165		reg = <0x20>;
166		#clock-cells = <1>;
167		clock-names = "mclk";
168		clock-output-names = "rk808-clkout1", "xin32k";
169		clocks = <&cru SCLK_I2S1_OUT>;
170		interrupt-parent = <&gpio0>;
171		interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
172		pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>;
173		pinctrl-names = "default";
174		#sound-dai-cells = <0>;
175		wakeup-source;
176
177		vcc1-supply = <&vccsys>;
178		vcc2-supply = <&vccsys>;
179		vcc3-supply = <&vccsys>;
180		vcc4-supply = <&vccsys>;
181		vcc5-supply = <&vccsys>;
182		vcc6-supply = <&vccsys>;
183		vcc7-supply = <&vccsys>;
184		vcc8-supply = <&vccsys>;
185
186		regulators {
187			vdd_logic: DCDC_REG1 {
188				regulator-always-on;
189				regulator-boot-on;
190				regulator-max-microvolt = <1150000>;
191				regulator-min-microvolt = <950000>;
192				regulator-name = "vdd_logic";
193				regulator-ramp-delay = <6001>;
194
195				regulator-state-mem {
196					regulator-on-in-suspend;
197					regulator-suspend-microvolt = <950000>;
198				};
199			};
200
201			vdd_arm: DCDC_REG2 {
202				regulator-always-on;
203				regulator-boot-on;
204				regulator-max-microvolt = <1350000>;
205				regulator-min-microvolt = <950000>;
206				regulator-name = "vdd_arm";
207				regulator-ramp-delay = <6001>;
208
209				regulator-state-mem {
210					regulator-off-in-suspend;
211					regulator-suspend-microvolt = <950000>;
212				};
213			};
214
215			vcc_ddr: DCDC_REG3 {
216				regulator-always-on;
217				regulator-boot-on;
218				regulator-name = "vcc_ddr";
219
220				regulator-state-mem {
221					regulator-on-in-suspend;
222				};
223			};
224
225			vcc_3v3: DCDC_REG4 {
226				regulator-always-on;
227				regulator-boot-on;
228				regulator-max-microvolt = <3300000>;
229				regulator-min-microvolt = <3300000>;
230				regulator-name = "vcc_3v3";
231
232				regulator-state-mem {
233					regulator-off-in-suspend;
234					regulator-suspend-microvolt = <3300000>;
235				};
236			};
237
238			vcc_1v8: LDO_REG2 {
239				regulator-always-on;
240				regulator-boot-on;
241				regulator-max-microvolt = <1800000>;
242				regulator-min-microvolt = <1800000>;
243				regulator-name = "vcc_1v8";
244
245				regulator-state-mem {
246					regulator-on-in-suspend;
247					regulator-suspend-microvolt = <1800000>;
248				};
249			};
250
251			vdd_1v0: LDO_REG3 {
252				regulator-always-on;
253				regulator-boot-on;
254				regulator-max-microvolt = <1000000>;
255				regulator-min-microvolt = <1000000>;
256				regulator-name = "vdd_1v0";
257
258				regulator-state-mem {
259					regulator-on-in-suspend;
260					regulator-suspend-microvolt = <1000000>;
261				};
262			};
263
264			vcc3v3_pmu: LDO_REG4 {
265				regulator-always-on;
266				regulator-boot-on;
267				regulator-max-microvolt = <3300000>;
268				regulator-min-microvolt = <3300000>;
269				regulator-name = "vcc3v3_pmu";
270
271				regulator-state-mem {
272					regulator-on-in-suspend;
273					regulator-suspend-microvolt = <3300000>;
274				};
275			};
276
277			vccio_sd: LDO_REG5 {
278				regulator-always-on;
279				regulator-boot-on;
280				regulator-max-microvolt = <3300000>;
281				regulator-min-microvolt = <1800000>;
282				regulator-name = "vccio_sd";
283
284				regulator-state-mem {
285					regulator-on-in-suspend;
286					regulator-suspend-microvolt = <3300000>;
287				};
288			};
289
290			vcc_sd: LDO_REG6 {
291				regulator-boot-on;
292				regulator-max-microvolt = <3300000>;
293				regulator-min-microvolt = <3300000>;
294				regulator-name = "vcc_sd";
295
296				regulator-state-mem {
297					regulator-on-in-suspend;
298					regulator-suspend-microvolt = <3300000>;
299				};
300			};
301
302			vcc_bl: LDO_REG7 {
303				regulator-max-microvolt = <3300000>;
304				regulator-min-microvolt = <3300000>;
305				regulator-name = "vcc_bl";
306
307				regulator-state-mem {
308					regulator-off-in-suspend;
309					regulator-suspend-microvolt = <3300000>;
310				};
311			};
312
313			vcc_lcd: LDO_REG8 {
314				regulator-max-microvolt = <2800000>;
315				regulator-min-microvolt = <2800000>;
316				regulator-name = "vcc_lcd";
317
318				regulator-state-mem {
319					regulator-off-in-suspend;
320					regulator-suspend-microvolt = <2800000>;
321				};
322			};
323
324			vcc_wifi: LDO_REG9 {
325				regulator-max-microvolt = <3300000>;
326				regulator-min-microvolt = <3300000>;
327				regulator-name = "vcc_wifi";
328
329				regulator-state-mem {
330					regulator-off-in-suspend;
331					regulator-suspend-microvolt = <3300000>;
332				};
333			};
334
335			usb_midu: BOOST {
336				regulator-always-on;
337				regulator-boot-on;
338				regulator-max-microvolt = <5400000>;
339				regulator-min-microvolt = <5000000>;
340				regulator-name = "usb_midu";
341			};
342		};
343
344		rk817_codec: codec {
345			rockchip,mic-in-differential;
346		};
347	};
348};
349
350&i2s1_2ch {
351	status = "okay";
352};
353
354&io_domains {
355	vccio1-supply = <&vcc_3v3>;
356	vccio2-supply = <&vccio_sd>;
357	vccio3-supply = <&vcc_3v3>;
358	vccio4-supply = <&vcc_3v3>;
359	vccio5-supply = <&vcc_3v3>;
360	vccio6-supply = <&vcc_3v3>;
361	status = "okay";
362};
363
364&pmu_io_domains {
365	pmuio1-supply = <&vcc3v3_pmu>;
366	pmuio2-supply = <&vcc3v3_pmu>;
367	status = "okay";
368};
369
370&pwm0 {
371	status = "okay";
372};
373
374&pwm1 {
375	status = "okay";
376};
377
378&saradc {
379	vref-supply = <&vcc_1v8>;
380	status = "okay";
381};
382
383&sdmmc {
384	cap-sd-highspeed;
385	card-detect-delay = <200>;
386	cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>;
387	sd-uhs-sdr12;
388	sd-uhs-sdr25;
389	sd-uhs-sdr50;
390	sd-uhs-sdr104;
391	vmmc-supply = <&vcc_sd>;
392	vqmmc-supply = <&vccio_sd>;
393	status = "okay";
394};
395
396&sfc {
397	#address-cells = <1>;
398	pinctrl-0 = <&sfc_clk &sfc_cs0 &sfc_bus2>;
399	pinctrl-names = "default";
400	#size-cells = <0>;
401	status = "okay";
402
403	flash@0 {
404		compatible = "jedec,spi-nor";
405		reg = <0>;
406		spi-max-frequency = <108000000>;
407		spi-rx-bus-width = <2>;
408		spi-tx-bus-width = <1>;
409	};
410};
411
412&tsadc {
413	status = "okay";
414};
415
416&u2phy {
417	status = "okay";
418
419	u2phy_host: host-port {
420		status = "okay";
421	};
422
423	u2phy_otg: otg-port {
424		status = "disabled";
425	};
426};
427
428&usb20_otg {
429	status = "okay";
430};
431
432&uart2 {
433	pinctrl-0 = <&uart2m1_xfer>;
434	pinctrl-names = "default";
435	status = "okay";
436};
437
438&vopb {
439	status = "okay";
440};
441
442&vopb_mmu {
443	status = "okay";
444};
445
446&pinctrl {
447	headphone {
448		hp_det: hp-det {
449			rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
450		};
451	};
452
453	leds {
454		led_pin: led-pin {
455			rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
456		};
457	};
458
459	pmic {
460		dc_det: dc-det {
461			rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
462		};
463
464		pmic_int: pmic-int {
465			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
466		};
467
468		soc_slppin_gpio: soc_slppin_gpio {
469			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_output_low>;
470		};
471
472		soc_slppin_rst: soc_slppin_rst {
473			rockchip,pins = <0 RK_PA4 2 &pcfg_pull_none>;
474		};
475
476		soc_slppin_slp: soc_slppin_slp {
477			rockchip,pins = <0 RK_PA4 1 &pcfg_pull_none>;
478		};
479	};
480};
481