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