1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
4 */
5
6#include <dt-bindings/pwm/pwm.h>
7#include "rk3399.dtsi"
8#include "rk3399-opp.dtsi"
9
10/ {
11	aliases {
12		mmc0 = &sdhci;
13	};
14
15	leds {
16		compatible = "gpio-leds";
17		pinctrl-names = "default";
18		pinctrl-0 = <&module_led_pin>;
19
20		module_led: led-0 {
21			label = "module_led";
22			gpios = <&gpio2 RK_PD1 GPIO_ACTIVE_HIGH>;
23			linux,default-trigger = "heartbeat";
24			panic-indicator;
25		};
26	};
27
28	clkin_gmac: external-gmac-clock {
29		compatible = "fixed-clock";
30		clock-frequency = <125000000>;
31		clock-output-names = "clkin_gmac";
32		#clock-cells = <0>;
33	};
34
35	vcc1v2_phy: vcc1v2-phy {
36		compatible = "regulator-fixed";
37		regulator-name = "vcc1v2_phy";
38		regulator-always-on;
39		regulator-boot-on;
40		regulator-min-microvolt = <1200000>;
41		regulator-max-microvolt = <1200000>;
42		vin-supply = <&vcc5v0_sys>;
43	};
44
45	vcc3v3_sys: vcc3v3-sys {
46		compatible = "regulator-fixed";
47		regulator-name = "vcc3v3_sys";
48		regulator-always-on;
49		regulator-boot-on;
50		regulator-min-microvolt = <3300000>;
51		regulator-max-microvolt = <3300000>;
52		vin-supply = <&vcc5v0_sys>;
53	};
54
55	vcc5v0_host: vcc5v0-host-regulator {
56		compatible = "regulator-fixed";
57		gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>;
58		enable-active-low;
59		pinctrl-names = "default";
60		pinctrl-0 = <&vcc5v0_host_en>;
61		regulator-name = "vcc5v0_host";
62		regulator-always-on;
63		vin-supply = <&vcc5v0_sys>;
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	};
74};
75
76&cpu_b0 {
77	cpu-supply = <&vdd_cpu_b>;
78};
79
80&cpu_b1 {
81	cpu-supply = <&vdd_cpu_b>;
82};
83
84&cpu_l0 {
85	cpu-supply = <&vdd_cpu_l>;
86};
87
88&cpu_l1 {
89	cpu-supply = <&vdd_cpu_l>;
90};
91
92&cpu_l2 {
93	cpu-supply = <&vdd_cpu_l>;
94};
95
96&cpu_l3 {
97	cpu-supply = <&vdd_cpu_l>;
98};
99
100&emmc_phy {
101	status = "okay";
102	drive-impedance-ohm = <33>;
103};
104
105&gmac {
106	assigned-clocks = <&cru SCLK_RMII_SRC>;
107	assigned-clock-parents = <&clkin_gmac>;
108	clock_in_out = "input";
109	phy-supply = <&vcc1v2_phy>;
110	phy-mode = "rgmii";
111	pinctrl-names = "default";
112	pinctrl-0 = <&rgmii_pins>;
113	snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
114	snps,reset-active-low;
115	snps,reset-delays-us = <0 10000 50000>;
116	tx_delay = <0x10>;
117	rx_delay = <0x10>;
118	status = "okay";
119};
120
121&gpu {
122	mali-supply = <&vdd_gpu>;
123	status = "okay";
124};
125
126&i2c0 {
127	status = "okay";
128	i2c-scl-rising-time-ns = <168>;
129	i2c-scl-falling-time-ns = <4>;
130	clock-frequency = <400000>;
131
132	rk808: pmic@1b {
133		compatible = "rockchip,rk808";
134		reg = <0x1b>;
135		interrupt-parent = <&gpio1>;
136		interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
137		#clock-cells = <1>;
138		clock-output-names = "xin32k", "rk808-clkout2";
139		pinctrl-names = "default";
140		pinctrl-0 = <&pmic_int_l>;
141		rockchip,system-power-controller;
142		wakeup-source;
143
144		vcc1-supply = <&vcc5v0_sys>;
145		vcc2-supply = <&vcc5v0_sys>;
146		vcc3-supply = <&vcc5v0_sys>;
147		vcc4-supply = <&vcc5v0_sys>;
148		vcc6-supply = <&vcc5v0_sys>;
149		vcc7-supply = <&vcc5v0_sys>;
150		vcc8-supply = <&vcc3v3_sys>;
151		vcc9-supply = <&vcc5v0_sys>;
152		vcc10-supply = <&vcc5v0_sys>;
153		vcc11-supply = <&vcc5v0_sys>;
154		vcc12-supply = <&vcc3v3_sys>;
155		vddio-supply = <&vcc1v8_pmu>;
156
157		regulators {
158			vdd_center: DCDC_REG1 {
159				regulator-name = "vdd_center";
160				regulator-min-microvolt = <750000>;
161				regulator-max-microvolt = <1350000>;
162				regulator-ramp-delay = <6001>;
163				regulator-always-on;
164				regulator-boot-on;
165				regulator-state-mem {
166					regulator-off-in-suspend;
167				};
168			};
169
170			vdd_cpu_l: DCDC_REG2 {
171				regulator-name = "vdd_cpu_l";
172				regulator-min-microvolt = <750000>;
173				regulator-max-microvolt = <1350000>;
174				regulator-ramp-delay = <6001>;
175				regulator-always-on;
176				regulator-boot-on;
177				regulator-state-mem {
178					regulator-off-in-suspend;
179				};
180			};
181
182			vcc_ddr: DCDC_REG3 {
183				regulator-name = "vcc_ddr";
184				regulator-always-on;
185				regulator-boot-on;
186				regulator-state-mem {
187					regulator-on-in-suspend;
188				};
189			};
190
191			vcc_1v8: DCDC_REG4 {
192				regulator-name = "vcc_1v8";
193				regulator-min-microvolt = <1800000>;
194				regulator-max-microvolt = <1800000>;
195				regulator-always-on;
196				regulator-boot-on;
197				regulator-state-mem {
198					regulator-on-in-suspend;
199					regulator-suspend-microvolt = <1800000>;
200				};
201			};
202
203			vcc_ldo1: LDO_REG1 {
204				regulator-name = "vcc_ldo1";
205				regulator-min-microvolt = <1800000>;
206				regulator-max-microvolt = <1800000>;
207				regulator-boot-on;
208				regulator-state-mem {
209					regulator-off-in-suspend;
210				};
211			};
212
213			vcc1v8_hdmi: LDO_REG2 {
214				regulator-name = "vcc1v8_hdmi";
215				regulator-min-microvolt = <1800000>;
216				regulator-max-microvolt = <1800000>;
217				regulator-always-on;
218				regulator-boot-on;
219				regulator-state-mem {
220					regulator-off-in-suspend;
221				};
222			};
223
224			vcc1v8_pmu: LDO_REG3 {
225				regulator-name = "vcc1v8_pmu";
226				regulator-min-microvolt = <1800000>;
227				regulator-max-microvolt = <1800000>;
228				regulator-always-on;
229				regulator-boot-on;
230				regulator-state-mem {
231					regulator-on-in-suspend;
232					regulator-suspend-microvolt = <1800000>;
233				};
234			};
235
236			vcc_sd: LDO_REG4 {
237				regulator-name = "vcc_sd";
238				regulator-min-microvolt = <1800000>;
239				regulator-max-microvolt = <3000000>;
240				regulator-always-on;
241				regulator-boot-on;
242				regulator-state-mem {
243					regulator-on-in-suspend;
244					regulator-suspend-microvolt = <3000000>;
245				};
246			};
247
248			vcc_ldo5: LDO_REG5 {
249				regulator-name = "vcc_ldo5";
250				regulator-min-microvolt = <3000000>;
251				regulator-max-microvolt = <3000000>;
252				regulator-boot-on;
253				regulator-state-mem {
254					regulator-off-in-suspend;
255				};
256			};
257
258			vcc_ldo6: LDO_REG6 {
259				regulator-name = "vcc_ldo6";
260				regulator-min-microvolt = <1500000>;
261				regulator-max-microvolt = <1500000>;
262				regulator-boot-on;
263				regulator-state-mem {
264					regulator-off-in-suspend;
265				};
266			};
267
268			vcc0v9_hdmi: LDO_REG7 {
269				regulator-name = "vcc0v9_hdmi";
270				regulator-min-microvolt = <900000>;
271				regulator-max-microvolt = <900000>;
272				regulator-always-on;
273				regulator-boot-on;
274				regulator-state-mem {
275					regulator-off-in-suspend;
276				};
277			};
278
279			vcc_efuse: LDO_REG8 {
280				regulator-name = "vcc_efuse";
281				regulator-min-microvolt = <1800000>;
282				regulator-max-microvolt = <1800000>;
283				regulator-always-on;
284				regulator-boot-on;
285				regulator-state-mem {
286					regulator-off-in-suspend;
287				};
288			};
289
290			vcc3v3_s3: SWITCH_REG1 {
291				regulator-name = "vcc3v3_s3";
292				regulator-always-on;
293				regulator-boot-on;
294				regulator-state-mem {
295					regulator-off-in-suspend;
296				};
297			};
298
299			vcc3v3_s0: SWITCH_REG2 {
300				regulator-name = "vcc3v3_s0";
301				regulator-always-on;
302				regulator-boot-on;
303				regulator-state-mem {
304					regulator-off-in-suspend;
305				};
306			};
307		};
308	};
309
310	vdd_gpu: regulator@60 {
311		compatible = "fcs,fan53555";
312		reg = <0x60>;
313		fcs,suspend-voltage-selector = <1>;
314		regulator-name = "vdd_gpu";
315		regulator-min-microvolt = <600000>;
316		regulator-max-microvolt = <1230000>;
317		regulator-ramp-delay = <1000>;
318		regulator-always-on;
319		regulator-boot-on;
320		vin-supply = <&vcc5v0_sys>;
321	};
322};
323
324&i2c7 {
325	status = "okay";
326	clock-frequency = <400000>;
327
328	fan: fan@18 {
329		compatible = "ti,amc6821";
330		reg = <0x18>;
331		#cooling-cells = <2>;
332	};
333
334	rtc_twi: rtc@6f {
335		compatible = "isil,isl1208";
336		reg = <0x6f>;
337	};
338};
339
340&i2c8 {
341	status = "okay";
342	clock-frequency = <400000>;
343
344	vdd_cpu_b: regulator@60 {
345		compatible = "fcs,fan53555";
346		reg = <0x60>;
347		vin-supply = <&vcc5v0_sys>;
348		regulator-name = "vdd_cpu_b";
349		regulator-min-microvolt = <600000>;
350		regulator-max-microvolt = <1230000>;
351		regulator-ramp-delay = <1000>;
352		fcs,suspend-voltage-selector = <1>;
353		regulator-always-on;
354		regulator-boot-on;
355	};
356};
357
358&i2s0 {
359	pinctrl-0 = <&i2s0_2ch_bus>;
360	rockchip,playback-channels = <2>;
361	rockchip,capture-channels = <2>;
362	status = "okay";
363};
364
365/*
366 * As Q7 does not specify neither a global nor a RX clock for I2S these
367 * signals are not used. Furthermore I2S0_LRCK_RX is used as GPIO.
368 * Therefore we have to redefine the i2s0_2ch_bus definition to prevent
369 * conflicts.
370 */
371&i2s0_2ch_bus {
372	rockchip,pins =
373		<3 RK_PD0 1 &pcfg_pull_none>,
374		<3 RK_PD2 1 &pcfg_pull_none>,
375		<3 RK_PD3 1 &pcfg_pull_none>,
376		<3 RK_PD7 1 &pcfg_pull_none>;
377};
378
379&io_domains {
380	status = "okay";
381	bt656-supply = <&vcc_1v8>;
382	audio-supply = <&vcc_1v8>;
383	sdmmc-supply = <&vcc_sd>;
384	gpio1830-supply = <&vcc_1v8>;
385};
386
387&pmu_io_domains {
388	status = "okay";
389	pmu1830-supply = <&vcc_1v8>;
390};
391
392&pwm2 {
393	status = "okay";
394};
395
396&pinctrl {
397	i2c8 {
398		i2c8_xfer_a: i2c8-xfer {
399			rockchip,pins =
400			  <1 RK_PC4 1 &pcfg_pull_up>,
401			  <1 RK_PC5 1 &pcfg_pull_up>;
402		};
403	};
404
405	leds {
406		module_led_pin: module-led-pin {
407			rockchip,pins =
408			  <2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
409		};
410	};
411
412	pmic {
413		pmic_int_l: pmic-int-l {
414			rockchip,pins =
415			  <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
416		};
417	};
418
419	usb2 {
420		vcc5v0_host_en: vcc5v0-host-en {
421			rockchip,pins =
422			  <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
423		};
424	};
425};
426
427&sdhci {
428	bus-width = <8>;
429	mmc-hs400-1_8v;
430	mmc-hs400-enhanced-strobe;
431	non-removable;
432	status = "okay";
433};
434
435&sdmmc {
436	vqmmc-supply = <&vcc_sd>;
437};
438
439&spi1 {
440	status = "okay";
441
442	norflash: flash@0 {
443		compatible = "jedec,spi-nor";
444		reg = <0>;
445		spi-max-frequency = <50000000>;
446	};
447};
448
449&tcphy1 {
450	status = "okay";
451};
452
453&tsadc {
454	rockchip,hw-tshut-mode = <1>;
455	rockchip,hw-tshut-polarity = <1>;
456	status = "okay";
457};
458
459&u2phy1 {
460	status = "okay";
461
462	u2phy1_otg: otg-port {
463		status = "okay";
464	};
465
466	u2phy1_host: host-port {
467		phy-supply = <&vcc5v0_host>;
468		status = "okay";
469	};
470};
471
472&usbdrd3_1 {
473	status = "okay";
474};
475
476&usbdrd_dwc3_1 {
477	status = "okay";
478	dr_mode = "host";
479};
480
481&usb_host1_ehci {
482	status = "okay";
483};
484
485&usb_host1_ohci {
486	status = "okay";
487};
488