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};
150
151&gmac {
152	assigned-clocks = <&cru SCLK_RMII_SRC>;
153	assigned-clock-parents = <&clkin_gmac>;
154	clock_in_out = "input";
155	phy-supply = <&vcc1v2_phy>;
156	phy-mode = "rgmii";
157	pinctrl-names = "default";
158	pinctrl-0 = <&rgmii_pins>;
159	snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;
160	snps,reset-active-low;
161	snps,reset-delays-us = <0 10000 50000>;
162	tx_delay = <0x10>;
163	rx_delay = <0x10>;
164	status = "okay";
165};
166
167&i2c0 {
168	status = "okay";
169	i2c-scl-rising-time-ns = <168>;
170	i2c-scl-falling-time-ns = <4>;
171	clock-frequency = <400000>;
172
173	rk808: pmic@1b {
174		compatible = "rockchip,rk808";
175		reg = <0x1b>;
176		interrupt-parent = <&gpio1>;
177		interrupts = <22 IRQ_TYPE_LEVEL_LOW>;
178		#clock-cells = <1>;
179		clock-output-names = "xin32k", "rk808-clkout2";
180		pinctrl-names = "default";
181		pinctrl-0 = <&pmic_int_l>;
182		rockchip,system-power-controller;
183		wakeup-source;
184
185		vcc1-supply = <&vcc5v0_sys>;
186		vcc2-supply = <&vcc5v0_sys>;
187		vcc3-supply = <&vcc5v0_sys>;
188		vcc4-supply = <&vcc5v0_sys>;
189		vcc6-supply = <&vcc5v0_sys>;
190		vcc7-supply = <&vcc5v0_sys>;
191		vcc8-supply = <&vcc3v3_sys>;
192		vcc9-supply = <&vcc5v0_sys>;
193		vcc10-supply = <&vcc5v0_sys>;
194		vcc11-supply = <&vcc5v0_sys>;
195		vcc12-supply = <&vcc3v3_sys>;
196		vddio-supply = <&vcc1v8_pmu>;
197
198		regulators {
199			vdd_center: DCDC_REG1 {
200				regulator-name = "vdd_center";
201				regulator-min-microvolt = <750000>;
202				regulator-max-microvolt = <1350000>;
203				regulator-ramp-delay = <6001>;
204				regulator-always-on;
205				regulator-boot-on;
206				regulator-state-mem {
207					regulator-off-in-suspend;
208				};
209			};
210
211			vdd_cpu_l: DCDC_REG2 {
212				regulator-name = "vdd_cpu_l";
213				regulator-min-microvolt = <750000>;
214				regulator-max-microvolt = <1350000>;
215				regulator-ramp-delay = <6001>;
216				regulator-always-on;
217				regulator-boot-on;
218				regulator-state-mem {
219					regulator-off-in-suspend;
220				};
221			};
222
223			vcc_ddr: DCDC_REG3 {
224				regulator-name = "vcc_ddr";
225				regulator-always-on;
226				regulator-boot-on;
227				regulator-state-mem {
228					regulator-on-in-suspend;
229				};
230			};
231
232			vcc_1v8: DCDC_REG4 {
233				regulator-name = "vcc_1v8";
234				regulator-min-microvolt = <1800000>;
235				regulator-max-microvolt = <1800000>;
236				regulator-always-on;
237				regulator-boot-on;
238				regulator-state-mem {
239					regulator-on-in-suspend;
240					regulator-suspend-microvolt = <1800000>;
241				};
242			};
243
244			vcc_ldo1: LDO_REG1 {
245				regulator-name = "vcc_ldo1";
246				regulator-min-microvolt = <1800000>;
247				regulator-max-microvolt = <1800000>;
248				regulator-boot-on;
249				regulator-state-mem {
250					regulator-off-in-suspend;
251				};
252			};
253
254			vcc1v8_hdmi: LDO_REG2 {
255				regulator-name = "vcc1v8_hdmi";
256				regulator-min-microvolt = <1800000>;
257				regulator-max-microvolt = <1800000>;
258				regulator-always-on;
259				regulator-boot-on;
260				regulator-state-mem {
261					regulator-off-in-suspend;
262				};
263			};
264
265			vcc1v8_pmu: LDO_REG3 {
266				regulator-name = "vcc1v8_pmu";
267				regulator-min-microvolt = <1800000>;
268				regulator-max-microvolt = <1800000>;
269				regulator-always-on;
270				regulator-boot-on;
271				regulator-state-mem {
272					regulator-on-in-suspend;
273					regulator-suspend-microvolt = <1800000>;
274				};
275			};
276
277			vcc_sd: LDO_REG4 {
278				regulator-name = "vcc_sd";
279				regulator-min-microvolt = <1800000>;
280				regulator-max-microvolt = <3000000>;
281				regulator-always-on;
282				regulator-boot-on;
283				regulator-state-mem {
284					regulator-on-in-suspend;
285					regulator-suspend-microvolt = <3000000>;
286				};
287			};
288
289			vcc_ldo5: LDO_REG5 {
290				regulator-name = "vcc_ldo5";
291				regulator-min-microvolt = <3000000>;
292				regulator-max-microvolt = <3000000>;
293				regulator-boot-on;
294				regulator-state-mem {
295					regulator-off-in-suspend;
296				};
297			};
298
299			vcc_ldo6: LDO_REG6 {
300				regulator-name = "vcc_ldo6";
301				regulator-min-microvolt = <1500000>;
302				regulator-max-microvolt = <1500000>;
303				regulator-boot-on;
304				regulator-state-mem {
305					regulator-off-in-suspend;
306				};
307			};
308
309			vcc0v9_hdmi: LDO_REG7 {
310				regulator-name = "vcc0v9_hdmi";
311				regulator-min-microvolt = <900000>;
312				regulator-max-microvolt = <900000>;
313				regulator-always-on;
314				regulator-boot-on;
315				regulator-state-mem {
316					regulator-off-in-suspend;
317				};
318			};
319
320			vcc_efuse: LDO_REG8 {
321				regulator-name = "vcc_efuse";
322				regulator-min-microvolt = <1800000>;
323				regulator-max-microvolt = <1800000>;
324				regulator-always-on;
325				regulator-boot-on;
326				regulator-state-mem {
327					regulator-off-in-suspend;
328				};
329			};
330
331			vcc3v3_s3: SWITCH_REG1 {
332				regulator-name = "vcc3v3_s3";
333				regulator-always-on;
334				regulator-boot-on;
335				regulator-state-mem {
336					regulator-off-in-suspend;
337				};
338			};
339
340			vcc3v3_s0: SWITCH_REG2 {
341				regulator-name = "vcc3v3_s0";
342				regulator-always-on;
343				regulator-boot-on;
344				regulator-state-mem {
345					regulator-off-in-suspend;
346				};
347			};
348		};
349	};
350
351	vdd_gpu: regulator@60 {
352		compatible = "fcs,fan53555";
353		reg = <0x60>;
354		fcs,suspend-voltage-selector = <1>;
355		regulator-name = "vdd_gpu";
356		regulator-min-microvolt = <600000>;
357		regulator-max-microvolt = <1230000>;
358		regulator-ramp-delay = <1000>;
359		regulator-always-on;
360		regulator-boot-on;
361		vin-supply = <&vcc5v0_sys>;
362	};
363};
364
365&i2c7 {
366	status = "okay";
367	clock-frequency = <400000>;
368
369	fan: fan@18 {
370		compatible = "ti,amc6821";
371		reg = <0x18>;
372		cooling-min-state = <0>;
373		cooling-max-state = <9>;
374		#cooling-cells = <2>;
375	};
376
377	rtc_twi: rtc@6f {
378		compatible = "isil,isl1208";
379		reg = <0x6f>;
380	};
381};
382
383&i2c8 {
384	status = "okay";
385	clock-frequency = <400000>;
386
387	vdd_cpu_b: regulator@60 {
388		compatible = "fcs,fan53555";
389		reg = <0x60>;
390		vin-supply = <&vcc5v0_sys>;
391		regulator-name = "vdd_cpu_b";
392		regulator-min-microvolt = <600000>;
393		regulator-max-microvolt = <1230000>;
394		regulator-ramp-delay = <1000>;
395		fcs,suspend-voltage-selector = <1>;
396		regulator-always-on;
397		regulator-boot-on;
398	};
399};
400
401&i2s0 {
402	pinctrl-0 = <&i2s0_2ch_bus>;
403	rockchip,playback-channels = <2>;
404	rockchip,capture-channels = <2>;
405	status = "okay";
406};
407
408/*
409 * As Q7 does not specify neither a global nor a RX clock for I2S these
410 * signals are not used. Furthermore I2S0_LRCK_RX is used as GPIO.
411 * Therefore we have to redefine the i2s0_2ch_bus definition to prevent
412 * conflicts.
413 */
414&i2s0_2ch_bus {
415	rockchip,pins =
416		<RK_GPIO3 RK_PD0 RK_FUNC_1 &pcfg_pull_none>,
417		<RK_GPIO3 RK_PD2 RK_FUNC_1 &pcfg_pull_none>,
418		<RK_GPIO3 RK_PD3 RK_FUNC_1 &pcfg_pull_none>,
419		<RK_GPIO3 RK_PD7 RK_FUNC_1 &pcfg_pull_none>;
420};
421
422&io_domains {
423	status = "okay";
424	bt656-supply = <&vcc_1v8>;
425	audio-supply = <&vcc_1v8>;
426	sdmmc-supply = <&vcc_sd>;
427	gpio1830-supply = <&vcc_1v8>;
428};
429
430&pmu_io_domains {
431	status = "okay";
432	pmu1830-supply = <&vcc_1v8>;
433};
434
435&pwm2 {
436	status = "okay";
437};
438
439&pinctrl {
440	i2c8 {
441		i2c8_xfer_a: i2c8-xfer {
442			rockchip,pins =
443			  <RK_GPIO1 RK_PC4 RK_FUNC_1 &pcfg_pull_up>,
444			  <RK_GPIO1 RK_PC5 RK_FUNC_1 &pcfg_pull_up>;
445		};
446	};
447
448	leds {
449		led_pin_module: led-module-gpio {
450			rockchip,pins =
451			  <RK_GPIO2 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
452		};
453	};
454
455	pmic {
456		pmic_int_l: pmic-int-l {
457			rockchip,pins =
458			  <RK_GPIO1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>;
459		};
460	};
461
462	usb2 {
463		vcc5v0_host_en: vcc5v0-host-en {
464			rockchip,pins =
465			  <RK_GPIO4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
466		};
467	};
468};
469
470&sdhci {
471	bus-width = <8>;
472	mmc-hs400-1_8v;
473	mmc-hs400-enhanced-strobe;
474	non-removable;
475	status = "okay";
476};
477
478&sdmmc {
479	vqmmc = <&vcc_sd>;
480};
481
482&spi1 {
483	status = "okay";
484
485	norflash: flash@0 {
486		compatible = "jedec,spi-nor";
487		reg = <0>;
488		spi-max-frequency = <50000000>;
489	};
490};
491
492&tcphy1 {
493	status = "okay";
494};
495
496&tsadc {
497	rockchip,hw-tshut-mode = <1>;
498	rockchip,hw-tshut-polarity = <1>;
499	status = "okay";
500};
501
502&u2phy1 {
503	status = "okay";
504
505	u2phy1_otg: otg-port {
506		status = "okay";
507	};
508
509	u2phy1_host: host-port {
510		phy-supply = <&vcc5v0_host>;
511		status = "okay";
512	};
513};
514
515&usbdrd3_1 {
516	status = "okay";
517};
518
519&usbdrd_dwc3_1 {
520	status = "okay";
521	dr_mode = "host";
522};
523
524&usb_host1_ehci {
525	status = "okay";
526};
527
528&usb_host1_ohci {
529	status = "okay";
530};
531