1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2022 Radxa Limited
4 * Copyright (c) 2022 Amarula Solutions(India)
5 */
6
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/leds/common.h>
9
10/ {
11	compatible = "radxa,cm3", "rockchip,rk3566";
12
13	aliases {
14		mmc0 = &sdhci;
15	};
16
17	leds {
18		compatible = "gpio-leds";
19
20		led-0 {
21			gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
22			color = <LED_COLOR_ID_GREEN>;
23			function = LED_FUNCTION_STATUS;
24			linux,default-trigger = "timer";
25			default-state = "on";
26			pinctrl-names = "default";
27			pinctrl-0 = <&user_led2>;
28		};
29	};
30
31	vcc_sys: vcc-sys-regulator {
32		compatible = "regulator-fixed";
33		regulator-name = "vcc_sys";
34		regulator-always-on;
35		regulator-boot-on;
36		regulator-min-microvolt = <5000000>;
37		regulator-max-microvolt = <5000000>;
38	};
39
40	vcc_1v8: vcc-1v8-regulator {
41		compatible = "regulator-fixed";
42		regulator-name = "vcc_1v8";
43		regulator-always-on;
44		regulator-boot-on;
45		regulator-min-microvolt = <1800000>;
46		regulator-max-microvolt = <1800000>;
47		vin-supply = <&vcc_1v8_p>;
48	};
49
50	vcc_3v3: vcc-3v3-regulator {
51		compatible = "regulator-fixed";
52		regulator-name = "vcc_3v3";
53		regulator-always-on;
54		regulator-boot-on;
55		regulator-min-microvolt = <3300000>;
56		regulator-max-microvolt = <3300000>;
57		vin-supply = <&vcc3v3_sys>;
58	};
59
60	vcca_1v8: vcca-1v8-regulator {
61		compatible = "regulator-fixed";
62		regulator-name = "vcca_1v8";
63		regulator-always-on;
64		regulator-boot-on;
65		regulator-min-microvolt = <1800000>;
66		regulator-max-microvolt = <1800000>;
67		vin-supply = <&vcc_1v8_p>;
68	};
69
70	sdio_pwrseq: pwrseq-sdio {
71		compatible = "mmc-pwrseq-simple";
72		clocks = <&rk817 1>;
73		clock-names = "ext_clock";
74		pinctrl-names = "default";
75		pinctrl-0 = <&wifi_reg_on_h>;
76		reset-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_LOW>;
77	};
78};
79
80&cpu0 {
81	cpu-supply = <&vdd_cpu>;
82};
83
84&cpu1 {
85	cpu-supply = <&vdd_cpu>;
86};
87
88&cpu2 {
89	cpu-supply = <&vdd_cpu>;
90};
91
92&cpu3 {
93	cpu-supply = <&vdd_cpu>;
94};
95
96&gpu {
97	mali-supply = <&vdd_gpu_npu>;
98	status = "okay";
99};
100
101&i2c0 {
102	status = "okay";
103
104	vdd_cpu: regulator@1c {
105		compatible = "tcs,tcs4525";
106		reg = <0x1c>;
107		fcs,suspend-voltage-selector = <1>;
108		regulator-name = "vdd_cpu";
109		regulator-always-on;
110		regulator-boot-on;
111		regulator-min-microvolt = <712500>;
112		regulator-max-microvolt = <1390000>;
113		regulator-ramp-delay = <2300>;
114		vin-supply = <&vcc_sys>;
115
116		regulator-state-mem {
117			regulator-off-in-suspend;
118		};
119	};
120
121	rk817: pmic@20 {
122		compatible = "rockchip,rk817";
123		reg = <0x20>;
124		#clock-cells = <1>;
125		clock-output-names = "rk817-clkout1", "rk817-clkout2";
126		interrupt-parent = <&gpio0>;
127		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
128		pinctrl-names = "default";
129		pinctrl-0 = <&pmic_int_l>;
130		rockchip,system-power-controller;
131		wakeup-source;
132
133		vcc1-supply = <&vcc_sys>;
134		vcc2-supply = <&vcc_sys>;
135		vcc3-supply = <&vcc_sys>;
136		vcc4-supply = <&vcc_sys>;
137		vcc5-supply = <&vcc_sys>;
138		vcc6-supply = <&vcc_sys>;
139		vcc7-supply = <&vcc_sys>;
140
141		regulators {
142			vdd_logic: DCDC_REG1 {
143				regulator-name = "vdd_logic";
144				regulator-always-on;
145				regulator-boot-on;
146				regulator-initial-mode = <0x2>;
147				regulator-min-microvolt = <500000>;
148				regulator-max-microvolt = <1350000>;
149				regulator-ramp-delay = <6001>;
150				regulator-state-mem {
151					regulator-on-in-suspend;
152					regulator-suspend-microvolt = <900000>;
153				};
154			};
155
156			vdd_gpu_npu: DCDC_REG2 {
157				regulator-name = "vdd_gpu_npu";
158				regulator-always-on;
159				regulator-boot-on;
160				regulator-initial-mode = <0x2>;
161				regulator-min-microvolt = <500000>;
162				regulator-max-microvolt = <1350000>;
163				regulator-ramp-delay = <6001>;
164				regulator-state-mem {
165					regulator-off-in-suspend;
166				};
167			};
168
169			vcc_ddr: DCDC_REG3 {
170				regulator-name = "vcc_ddr";
171				regulator-always-on;
172				regulator-boot-on;
173				regulator-initial-mode = <0x2>;
174				regulator-state-mem {
175					regulator-on-in-suspend;
176				};
177			};
178
179			vcc3v3_sys: DCDC_REG4 {
180				regulator-name = "vcc3v3_sys";
181				regulator-always-on;
182				regulator-boot-on;
183				regulator-initial-mode = <0x2>;
184				regulator-min-microvolt = <3300000>;
185				regulator-max-microvolt = <3300000>;
186				regulator-state-mem {
187					regulator-on-in-suspend;
188					regulator-suspend-microvolt = <3300000>;
189				};
190			};
191
192			vcca1v8_pmu: LDO_REG1 {
193				regulator-name = "vcca1v8_pmu";
194				regulator-always-on;
195				regulator-boot-on;
196				regulator-min-microvolt = <1800000>;
197				regulator-max-microvolt = <1800000>;
198				regulator-state-mem {
199					regulator-on-in-suspend;
200					regulator-suspend-microvolt = <1800000>;
201				};
202			};
203
204			vdda_0v9: LDO_REG2 {
205				regulator-name = "vdda_0v9";
206				regulator-always-on;
207				regulator-boot-on;
208				regulator-min-microvolt = <900000>;
209				regulator-max-microvolt = <900000>;
210				regulator-state-mem {
211					regulator-off-in-suspend;
212				};
213			};
214
215			vdda0v9_pmu: LDO_REG3 {
216				regulator-name = "vdda0v9_pmu";
217				regulator-always-on;
218				regulator-boot-on;
219				regulator-min-microvolt = <900000>;
220				regulator-max-microvolt = <900000>;
221				regulator-state-mem {
222					regulator-on-in-suspend;
223					regulator-suspend-microvolt = <900000>;
224				};
225			};
226
227			vccio_acodec: LDO_REG4 {
228				regulator-name = "vccio_acodec";
229				regulator-always-on;
230				regulator-boot-on;
231				regulator-min-microvolt = <3300000>;
232				regulator-max-microvolt = <3300000>;
233				regulator-state-mem {
234					regulator-off-in-suspend;
235				};
236			};
237
238			vccio_sd: LDO_REG5 {
239				regulator-name = "vccio_sd";
240				regulator-always-on;
241				regulator-boot-on;
242				regulator-min-microvolt = <1800000>;
243				regulator-max-microvolt = <3300000>;
244				regulator-state-mem {
245					regulator-off-in-suspend;
246				};
247			};
248
249			vcc3v3_pmu: LDO_REG6 {
250				regulator-name = "vcc3v3_pmu";
251				regulator-always-on;
252				regulator-boot-on;
253				regulator-min-microvolt = <3300000>;
254				regulator-max-microvolt = <3300000>;
255				regulator-state-mem {
256					regulator-on-in-suspend;
257					regulator-suspend-microvolt = <3300000>;
258				};
259			};
260
261			vcc_1v8_p: LDO_REG7 {
262				regulator-name = "vcc_1v8_p";
263				regulator-always-on;
264				regulator-boot-on;
265				regulator-min-microvolt = <1800000>;
266				regulator-max-microvolt = <1800000>;
267				regulator-state-mem {
268					regulator-off-in-suspend;
269				};
270			};
271
272			vcc1v8_dvp: LDO_REG8 {
273				regulator-name = "vcc1v8_dvp";
274				regulator-always-on;
275				regulator-boot-on;
276				regulator-min-microvolt = <1800000>;
277				regulator-max-microvolt = <1800000>;
278				regulator-state-mem {
279					regulator-off-in-suspend;
280				};
281			};
282
283			vcc2v8_dvp: LDO_REG9 {
284				regulator-name = "vcc2v8_dvp";
285				regulator-always-on;
286				regulator-boot-on;
287				regulator-min-microvolt = <2800000>;
288				regulator-max-microvolt = <2800000>;
289				regulator-state-mem {
290					regulator-off-in-suspend;
291				};
292			};
293
294		};
295	};
296};
297
298&pinctrl {
299	bluetooth {
300		bt_host_wake_h: bt-host-wake-h {
301			rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
302		};
303
304		bt_reg_on_h: bt-reg-on-h {
305			rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
306		};
307
308		bt_wake_host_h: bt-wake-host-h {
309			rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
310		};
311	};
312
313	pmic {
314		pmic_int_l: pmic-int-l {
315			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
316		};
317	};
318
319	leds {
320		user_led2: user-led2 {
321			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
322		};
323	};
324
325	wifi {
326		wifi_reg_on_h: wifi-reg-on-h {
327			rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
328		};
329
330		wifi_host_wake_h: wifi-host-wake-h {
331			rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
332		};
333	};
334};
335
336&pmu_io_domains {
337	pmuio1-supply = <&vcc3v3_pmu>;
338	pmuio2-supply = <&vcc_3v3>;
339	vccio1-supply = <&vccio_acodec>;
340	vccio2-supply = <&vcc_1v8>;
341	vccio3-supply = <&vccio_sd>;
342	vccio4-supply = <&vcc_1v8>;
343	vccio5-supply = <&vcc_3v3>;
344	vccio6-supply = <&vcc_3v3>;
345	vccio7-supply = <&vcc_3v3>;
346	status = "okay";
347};
348
349&saradc {
350	vref-supply = <&vcca_1v8>;
351	status = "okay";
352};
353
354&sdmmc1 {
355	#address-cells = <1>;
356	#size-cells = <0>;
357	bus-width = <4>;
358	disable-wp;
359	cap-sd-highspeed;
360	cap-sdio-irq;
361	keep-power-in-suspend;
362	mmc-pwrseq = <&sdio_pwrseq>;
363	non-removable;
364	pinctrl-names = "default";
365	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>;
366	sd-uhs-sdr104;
367	vmmc-supply = <&vcc_3v3>;
368	vqmmc-supply = <&vcc_1v8>;
369	status = "okay";
370
371	wifi@1 {
372		compatible = "brcm,bcm43455-fmac";
373		reg = <1>;
374		interrupt-parent = <&gpio2>;
375		interrupts = <RK_PC1 IRQ_TYPE_LEVEL_HIGH>;
376		interrupt-names = "host-wake";
377		pinctrl-names = "default";
378		pinctrl-0 = <&wifi_host_wake_h>;
379	};
380};
381
382&sdhci {
383	bus-width = <8>;
384	max-frequency = <200000000>;
385	mmc-hs200-1_8v;
386	non-removable;
387	pinctrl-names = "default";
388	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
389	vmmc-supply = <&vcc_3v3>;
390	vqmmc-supply = <&vcc_1v8>;
391	status = "okay";
392};
393
394&uart1 {
395	pinctrl-names = "default";
396	pinctrl-0 = <&uart1m0_ctsn &uart1m0_rtsn &uart1m0_xfer>;
397	status = "okay";
398
399	bluetooth {
400		compatible = "brcm,bcm4345c5";
401		clocks = <&rk817 1>;
402		clock-names = "lpo";
403		device-wakeup-gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>;
404		host-wakeup-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_HIGH>;
405		reset-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_LOW>;
406		pinctrl-names = "default";
407		pinctrl-0 = <&bt_host_wake_h &bt_reg_on_h &bt_wake_host_h>;
408		vbat-supply = <&vcc_3v3>;
409		vddio-supply = <&vcc_1v8>;
410	};
411};
412
413&usb2phy0 {
414	status = "okay";
415};
416
417&usb2phy1 {
418	status = "okay";
419};
420
421&tsadc {
422	rockchip,hw-tshut-mode = <1>;
423	rockchip,hw-tshut-polarity = <0>;
424	status = "okay";
425};
426