1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2020 Aditya Prayoga <aditya@kobol.io>
4 */
5
6/*
7 * The Kobol Helios64 is a board designed to operate as a NAS and optionally
8 * ships with an enclosing that can host five 2.5" hard disks.
9 *
10 * See https://wiki.kobol.io/helios64/intro/ for further details.
11 */
12
13/dts-v1/;
14#include "rk3399.dtsi"
15#include "rk3399-opp.dtsi"
16
17/ {
18	model = "Kobol Helios64";
19	compatible = "kobol,helios64", "rockchip,rk3399";
20
21	aliases {
22		mmc0 = &sdmmc;
23		mmc1 = &sdhci;
24		spi1 = &spi1;
25		spi2 = &spi2;
26		spi5 = &spi5;
27	};
28
29	avdd_0v9_s0: avdd-0v9-s0 {
30		compatible = "regulator-fixed";
31		regulator-name = "avdd_0v9_s0";
32		regulator-always-on;
33		regulator-boot-on;
34		regulator-min-microvolt = <900000>;
35		regulator-max-microvolt = <900000>;
36		vin-supply = <&vcc1v8_sys_s3>;
37	};
38
39	avdd_1v8_s0: avdd-1v8-s0 {
40		compatible = "regulator-fixed";
41		regulator-name = "avdd_1v8_s0";
42		regulator-always-on;
43		regulator-boot-on;
44		regulator-min-microvolt = <1800000>;
45		regulator-max-microvolt = <1800000>;
46		vin-supply = <&vcc3v3_sys_s3>;
47	};
48
49	chosen {
50		stdout-path = "serial2:1500000n8";
51	};
52
53	clkin_gmac: external-gmac-clock {
54		compatible = "fixed-clock";
55		clock-frequency = <125000000>;
56		clock-output-names = "clkin_gmac";
57		#clock-cells = <0>;
58	};
59
60	fan1 {
61		/* fan connected to P7 */
62		compatible = "pwm-fan";
63		pwms = <&pwm0 0 40000 0>;
64		cooling-levels = <0 80 170 255>;
65	};
66
67	fan2 {
68		/* fan connected to P6 */
69		compatible = "pwm-fan";
70		pwms = <&pwm1 0 40000 0>;
71		cooling-levels = <0 80 170 255>;
72	};
73
74	leds {
75		compatible = "gpio-leds";
76		pinctrl-names = "default";
77		pinctrl-0 = <&sys_grn_led_on &sys_red_led_on>;
78
79		led-0 {
80			label = "helios64:green:status";
81			gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
82			default-state = "on";
83		};
84
85		led-1 {
86			label = "helios64:red:fault";
87			gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
88			default-state = "keep";
89		};
90	};
91
92	pcie_power: pcie-power {
93		compatible = "regulator-fixed";
94		enable-active-high;
95		gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
96		pinctrl-0 = <&pcie_pwr>;
97		pinctrl-names = "default";
98		regulator-boot-on;
99		regulator-name = "pcie_power";
100		startup-delay-us = <10000>;
101		vin-supply = <&vcc5v0_perdev>;
102	};
103
104	vcc1v8_sys_s0: vcc1v8-sys-s0 {
105		compatible = "regulator-fixed";
106		regulator-name = "vcc1v8_sys_s0";
107		regulator-always-on;
108		regulator-boot-on;
109		regulator-min-microvolt = <1800000>;
110		regulator-max-microvolt = <1800000>;
111		vin-supply = <&vcc1v8_sys_s3>;
112	};
113
114	vcc3v0_sd: vcc3v0-sd {
115		compatible = "regulator-fixed";
116		enable-active-high;
117		gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
118		regulator-name = "vcc3v0_sd";
119		regulator-boot-on;
120		regulator-min-microvolt = <3000000>;
121		regulator-max-microvolt = <3000000>;
122		pinctrl-names = "default";
123		pinctrl-0 = <&sdmmc0_pwr_h>;
124		vin-supply = <&vcc3v3_sys_s3>;
125	};
126
127	vcc3v3_sys_s3: vcc_lan: vcc3v3-sys-s3 {
128		compatible = "regulator-fixed";
129		regulator-name = "vcc3v3_sys_s3";
130		regulator-always-on;
131		regulator-boot-on;
132		regulator-min-microvolt = <3300000>;
133		regulator-max-microvolt = <3300000>;
134		vin-supply = <&vcc5v0_sys>;
135
136		regulator-state-mem {
137			regulator-on-in-suspend;
138		};
139	};
140
141	vcc5v0_perdev: vcc5v0-perdev {
142		compatible = "regulator-fixed";
143		regulator-name = "vcc5v0_perdev";
144		regulator-always-on;
145		regulator-boot-on;
146		regulator-min-microvolt = <5000000>;
147		regulator-max-microvolt = <5000000>;
148		vin-supply = <&vcc12v_dcin_bkup>;
149	};
150
151	vcc5v0_sys: vcc5v0-sys {
152		compatible = "regulator-fixed";
153		regulator-name = "vcc5v0_sys";
154		regulator-always-on;
155		regulator-boot-on;
156		regulator-min-microvolt = <5000000>;
157		regulator-max-microvolt = <5000000>;
158		vin-supply = <&vcc12v_dcin_bkup>;
159
160		regulator-state-mem {
161			regulator-on-in-suspend;
162		};
163	};
164
165	vcc5v0_usb: vcc5v0-usb {
166		compatible = "regulator-fixed";
167		enable-active-high;
168		gpio = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>;
169		pinctrl-names = "default";
170		pinctrl-0 = <&vcc5v0_usb_en>;
171		regulator-name = "vcc5v0_usb";
172		regulator-always-on;
173		regulator-boot-on;
174		regulator-min-microvolt = <5000000>;
175		regulator-max-microvolt = <5000000>;
176		vin-supply = <&vcc5v0_perdev>;
177	};
178
179	vcc12v_dcin: vcc12v-dcin {
180		compatible = "regulator-fixed";
181		regulator-name = "vcc12v_dcin";
182		regulator-always-on;
183		regulator-boot-on;
184		regulator-min-microvolt = <12000000>;
185		regulator-max-microvolt = <12000000>;
186	};
187
188	vcc12v_dcin_bkup: vcc12v-dcin-bkup {
189		compatible = "regulator-fixed";
190		regulator-name = "vcc12v_dcin_bkup";
191		regulator-always-on;
192		regulator-boot-on;
193		regulator-min-microvolt = <12000000>;
194		regulator-max-microvolt = <12000000>;
195		vin-supply = <&vcc12v_dcin>;
196	};
197};
198
199/*
200 * The system doesn't run stable with cpu freq enabled, so disallow the lower
201 * frequencies until this problem is properly understood and resolved.
202 */
203&cluster0_opp {
204	/delete-node/ opp00;
205	/delete-node/ opp01;
206	/delete-node/ opp02;
207	/delete-node/ opp03;
208	/delete-node/ opp04;
209};
210
211&cluster1_opp {
212	/delete-node/ opp00;
213	/delete-node/ opp01;
214	/delete-node/ opp02;
215	/delete-node/ opp03;
216	/delete-node/ opp04;
217	/delete-node/ opp05;
218	/delete-node/ opp06;
219};
220
221&cpu_b0 {
222	cpu-supply = <&vdd_cpu_b>;
223};
224
225&cpu_b1 {
226	cpu-supply = <&vdd_cpu_b>;
227};
228
229&cpu_l0 {
230	cpu-supply = <&vdd_cpu_l>;
231};
232
233&cpu_l1 {
234	cpu-supply = <&vdd_cpu_l>;
235};
236
237&cpu_l2 {
238	cpu-supply = <&vdd_cpu_l>;
239};
240
241&cpu_l3 {
242	cpu-supply = <&vdd_cpu_l>;
243};
244
245&emmc_phy {
246	status = "okay";
247};
248
249&gmac {
250	assigned-clock-parents = <&clkin_gmac>;
251	assigned-clocks = <&cru SCLK_RMII_SRC>;
252	clock_in_out = "input";
253	phy-mode = "rgmii";
254	phy-supply = <&vcc_lan>;
255	pinctrl-names = "default";
256	pinctrl-0 = <&rgmii_pins &gphy_reset>;
257	rx_delay = <0x20>;
258	tx_delay = <0x28>;
259	snps,reset-active-low;
260	snps,reset-delays-us = <0 10000 50000>;
261	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
262	status = "okay";
263};
264
265&i2c0 {
266	clock-frequency = <400000>;
267	i2c-scl-rising-time-ns = <168>;
268	i2c-scl-falling-time-ns = <4>;
269	status = "okay";
270
271	rk808: pmic@1b {
272		compatible = "rockchip,rk808";
273		reg = <0x1b>;
274		interrupt-parent = <&gpio0>;
275		interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
276		clock-output-names = "xin32k", "rk808-clkout2";
277		pinctrl-names = "default";
278		pinctrl-0 = <&pmic_int_l>;
279		vcc1-supply = <&vcc5v0_sys>;
280		vcc2-supply = <&vcc5v0_sys>;
281		vcc3-supply = <&vcc5v0_sys>;
282		vcc4-supply = <&vcc5v0_sys>;
283		vcc6-supply = <&vcc5v0_sys>;
284		vcc7-supply = <&vcc5v0_sys>;
285		vcc8-supply = <&vcc3v3_sys_s3>;
286		vcc9-supply = <&vcc5v0_sys>;
287		vcc10-supply = <&vcc5v0_sys>;
288		vcc11-supply = <&vcc5v0_sys>;
289		vcc12-supply = <&vcc3v3_sys_s3>;
290		vddio-supply = <&vcc3v0_s3>;
291		wakeup-source;
292		#clock-cells = <1>;
293
294		regulators {
295			vdd_cpu_l: DCDC_REG2 {
296				regulator-name = "vdd_cpu_l";
297				regulator-always-on;
298				regulator-boot-on;
299				regulator-min-microvolt = <750000>;
300				regulator-max-microvolt = <1350000>;
301				regulator-ramp-delay = <6001>;
302
303				regulator-state-mem {
304					regulator-off-in-suspend;
305				};
306			};
307
308			vcc1v8_sys_s3: DCDC_REG4 {
309				regulator-name = "vcc1v8_sys_s3";
310				regulator-always-on;
311				regulator-boot-on;
312				regulator-min-microvolt = <1800000>;
313				regulator-max-microvolt = <1800000>;
314
315				regulator-state-mem {
316					regulator-on-in-suspend;
317					regulator-suspend-microvolt = <1800000>;
318				};
319			};
320
321			vcc_sdio_s0: LDO_REG4 {
322				regulator-name = "vcc_sdio_s0";
323				regulator-always-on;
324				regulator-boot-on;
325				regulator-min-microvolt = <1800000>;
326				regulator-max-microvolt = <3000000>;
327
328				regulator-state-mem {
329					regulator-on-in-suspend;
330					regulator-suspend-microvolt = <3000000>;
331				};
332			};
333
334			vcc3v0_s3: LDO_REG8 {
335				regulator-name = "vcc3v0_s3";
336				regulator-always-on;
337				regulator-boot-on;
338				regulator-min-microvolt = <3000000>;
339				regulator-max-microvolt = <3000000>;
340
341				regulator-state-mem {
342					regulator-on-in-suspend;
343					regulator-suspend-microvolt = <3000000>;
344				};
345			};
346		};
347	};
348
349	vdd_cpu_b: regulator@40 {
350		compatible = "silergy,syr827";
351		reg = <0x40>;
352		fcs,suspend-voltage-selector = <1>;
353		regulator-name = "vdd_cpu_b";
354		regulator-always-on;
355		regulator-boot-on;
356		regulator-min-microvolt = <712500>;
357		regulator-max-microvolt = <1500000>;
358		regulator-ramp-delay = <1000>;
359		vin-supply = <&vcc5v0_sys>;
360
361		regulator-state-mem {
362			regulator-off-in-suspend;
363		};
364	};
365};
366
367&i2c2 {
368	clock-frequency = <400000>;
369	i2c-scl-rising-time-ns = <160>;
370	i2c-scl-falling-time-ns = <30>;
371	status = "okay";
372
373	temp@4c {
374		compatible = "national,lm75";
375		reg = <0x4c>;
376	};
377};
378
379&io_domains {
380	audio-supply = <&vcc1v8_sys_s0>;
381	bt656-supply = <&vcc1v8_sys_s0>;
382	gpio1830-supply = <&vcc3v0_s3>;
383	sdmmc-supply = <&vcc_sdio_s0>;
384	status = "okay";
385};
386
387&pcie_phy {
388	status = "okay";
389};
390
391&pcie0 {
392	num-lanes = <2>;
393	status = "okay";
394
395	vpcie12v-supply = <&vcc12v_dcin>;
396	vpcie3v3-supply = <&pcie_power>;
397	vpcie1v8-supply = <&avdd_1v8_s0>;
398	vpcie0v9-supply = <&avdd_0v9_s0>;
399};
400
401&pinctrl {
402	gmac {
403		gphy_reset: gphy-reset {
404			rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>;
405		};
406	};
407
408	leds {
409		sys_grn_led_on: sys-grn-led-on {
410			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
411		};
412
413		sys_red_led_on: sys-red-led-on {
414			rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
415		};
416	};
417
418	pcie {
419		pcie_pwr: pcie-pwr {
420			rockchip,pins =
421				<1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
422		};
423	};
424
425	pmic {
426		pmic_int_l: pmic-int-l {
427			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
428		};
429	};
430
431	power {
432		vcc5v0_usb_en: vcc5v0-usb-en {
433			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
434		};
435	};
436
437	vcc3v0-sd {
438		sdmmc0_pwr_h: sdmmc0-pwr-h {
439			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
440		};
441	};
442};
443
444&pmu_io_domains {
445	pmu1830-supply = <&vcc3v0_s3>;
446	status = "okay";
447};
448
449&pwm0 {
450	/* pwm-fan on P7 */
451	status = "okay";
452};
453
454&pwm1 {
455	/* pwm-fan on P6 */
456	status = "okay";
457};
458
459&sdhci {
460	bus-width = <8>;
461	mmc-hs200-1_8v;
462	non-removable;
463	vqmmc-supply = <&vcc1v8_sys_s0>;
464	status = "okay";
465};
466
467&sdmmc {
468	bus-width = <4>;
469	cap-sd-highspeed;
470	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
471	disable-wp;
472	pinctrl-names = "default";
473	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
474	vmmc-supply = <&vcc3v0_sd>;
475	vqmmc-supply = <&vcc_sdio_s0>;
476	status = "okay";
477};
478
479&spi1 {
480	status = "okay";
481
482	spiflash: flash@0 {
483		compatible = "jedec,spi-nor";
484		reg = <0x0>;
485		spi-max-frequency = <25000000>;
486		status = "okay";
487		m25p,fast-read;
488	};
489};
490
491/* UEXT connector */
492&spi2 {
493	status = "okay";
494};
495
496&spi5 {
497	status = "okay";
498};
499
500&tcphy1 {
501	/* phy for &usbdrd_dwc3_1 */
502	status = "okay";
503};
504
505&tsadc {
506	/* tshut mode 0:CRU 1:GPIO */
507	rockchip,hw-tshut-mode = <1>;
508	/* tshut polarity 0:LOW 1:HIGH */
509	rockchip,hw-tshut-polarity = <1>;
510	status = "okay";
511};
512
513&u2phy1 {
514	status = "okay";
515
516	otg-port {
517		/* phy for &usbdrd_dwc3_1 */
518		phy-supply = <&vcc5v0_usb>;
519		status = "okay";
520	};
521};
522
523&uart2 {
524	status = "okay";
525};
526
527&usbdrd3_1 {
528	status = "okay";
529
530	usb@fe900000 {
531		dr_mode = "host";
532		status = "okay";
533	};
534};
535