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