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		rockchip,system-power-controller;
280		vcc1-supply = <&vcc5v0_sys>;
281		vcc2-supply = <&vcc5v0_sys>;
282		vcc3-supply = <&vcc5v0_sys>;
283		vcc4-supply = <&vcc5v0_sys>;
284		vcc6-supply = <&vcc5v0_sys>;
285		vcc7-supply = <&vcc5v0_sys>;
286		vcc8-supply = <&vcc3v3_sys_s3>;
287		vcc9-supply = <&vcc5v0_sys>;
288		vcc10-supply = <&vcc5v0_sys>;
289		vcc11-supply = <&vcc5v0_sys>;
290		vcc12-supply = <&vcc3v3_sys_s3>;
291		vddio-supply = <&vcc3v0_s3>;
292		wakeup-source;
293		#clock-cells = <1>;
294
295		regulators {
296			vdd_cpu_l: DCDC_REG2 {
297				regulator-name = "vdd_cpu_l";
298				regulator-always-on;
299				regulator-boot-on;
300				regulator-min-microvolt = <750000>;
301				regulator-max-microvolt = <1350000>;
302				regulator-ramp-delay = <6001>;
303
304				regulator-state-mem {
305					regulator-off-in-suspend;
306				};
307			};
308
309			vcc1v8_sys_s3: DCDC_REG4 {
310				regulator-name = "vcc1v8_sys_s3";
311				regulator-always-on;
312				regulator-boot-on;
313				regulator-min-microvolt = <1800000>;
314				regulator-max-microvolt = <1800000>;
315
316				regulator-state-mem {
317					regulator-on-in-suspend;
318					regulator-suspend-microvolt = <1800000>;
319				};
320			};
321
322			vcc_sdio_s0: LDO_REG4 {
323				regulator-name = "vcc_sdio_s0";
324				regulator-always-on;
325				regulator-boot-on;
326				regulator-min-microvolt = <1800000>;
327				regulator-max-microvolt = <3000000>;
328
329				regulator-state-mem {
330					regulator-on-in-suspend;
331					regulator-suspend-microvolt = <3000000>;
332				};
333			};
334
335			vcc3v0_s3: LDO_REG8 {
336				regulator-name = "vcc3v0_s3";
337				regulator-always-on;
338				regulator-boot-on;
339				regulator-min-microvolt = <3000000>;
340				regulator-max-microvolt = <3000000>;
341
342				regulator-state-mem {
343					regulator-on-in-suspend;
344					regulator-suspend-microvolt = <3000000>;
345				};
346			};
347		};
348	};
349
350	vdd_cpu_b: regulator@40 {
351		compatible = "silergy,syr827";
352		reg = <0x40>;
353		fcs,suspend-voltage-selector = <1>;
354		regulator-name = "vdd_cpu_b";
355		regulator-always-on;
356		regulator-boot-on;
357		regulator-min-microvolt = <712500>;
358		regulator-max-microvolt = <1500000>;
359		regulator-ramp-delay = <1000>;
360		vin-supply = <&vcc5v0_sys>;
361
362		regulator-state-mem {
363			regulator-off-in-suspend;
364		};
365	};
366};
367
368&i2c2 {
369	clock-frequency = <400000>;
370	i2c-scl-rising-time-ns = <160>;
371	i2c-scl-falling-time-ns = <30>;
372	status = "okay";
373
374	temp@4c {
375		compatible = "national,lm75";
376		reg = <0x4c>;
377	};
378};
379
380&io_domains {
381	audio-supply = <&vcc1v8_sys_s0>;
382	bt656-supply = <&vcc1v8_sys_s0>;
383	gpio1830-supply = <&vcc3v0_s3>;
384	sdmmc-supply = <&vcc_sdio_s0>;
385	status = "okay";
386};
387
388&pcie_phy {
389	status = "okay";
390};
391
392&pcie0 {
393	num-lanes = <2>;
394	status = "okay";
395
396	vpcie12v-supply = <&vcc12v_dcin>;
397	vpcie3v3-supply = <&pcie_power>;
398	vpcie1v8-supply = <&avdd_1v8_s0>;
399	vpcie0v9-supply = <&avdd_0v9_s0>;
400};
401
402&pinctrl {
403	gmac {
404		gphy_reset: gphy-reset {
405			rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>;
406		};
407	};
408
409	leds {
410		sys_grn_led_on: sys-grn-led-on {
411			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
412		};
413
414		sys_red_led_on: sys-red-led-on {
415			rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
416		};
417	};
418
419	pcie {
420		pcie_pwr: pcie-pwr {
421			rockchip,pins =
422				<1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
423		};
424	};
425
426	pmic {
427		pmic_int_l: pmic-int-l {
428			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
429		};
430	};
431
432	power {
433		vcc5v0_usb_en: vcc5v0-usb-en {
434			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
435		};
436	};
437
438	vcc3v0-sd {
439		sdmmc0_pwr_h: sdmmc0-pwr-h {
440			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
441		};
442	};
443};
444
445&pmu_io_domains {
446	pmu1830-supply = <&vcc3v0_s3>;
447	status = "okay";
448};
449
450&pwm0 {
451	/* pwm-fan on P7 */
452	status = "okay";
453};
454
455&pwm1 {
456	/* pwm-fan on P6 */
457	status = "okay";
458};
459
460&sdhci {
461	bus-width = <8>;
462	mmc-hs200-1_8v;
463	non-removable;
464	vqmmc-supply = <&vcc1v8_sys_s0>;
465	status = "okay";
466};
467
468&sdmmc {
469	bus-width = <4>;
470	cap-sd-highspeed;
471	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
472	disable-wp;
473	pinctrl-names = "default";
474	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
475	vmmc-supply = <&vcc3v0_sd>;
476	vqmmc-supply = <&vcc_sdio_s0>;
477	status = "okay";
478};
479
480&spi1 {
481	status = "okay";
482
483	spiflash: flash@0 {
484		compatible = "jedec,spi-nor";
485		reg = <0x0>;
486		spi-max-frequency = <25000000>;
487		status = "okay";
488		m25p,fast-read;
489	};
490};
491
492/* UEXT connector */
493&spi2 {
494	status = "okay";
495};
496
497&spi5 {
498	status = "okay";
499};
500
501&tcphy1 {
502	/* phy for &usbdrd_dwc3_1 */
503	status = "okay";
504};
505
506&tsadc {
507	/* tshut mode 0:CRU 1:GPIO */
508	rockchip,hw-tshut-mode = <1>;
509	/* tshut polarity 0:LOW 1:HIGH */
510	rockchip,hw-tshut-polarity = <1>;
511	status = "okay";
512};
513
514&u2phy1 {
515	status = "okay";
516
517	otg-port {
518		/* phy for &usbdrd_dwc3_1 */
519		phy-supply = <&vcc5v0_usb>;
520		status = "okay";
521	};
522};
523
524&uart2 {
525	status = "okay";
526};
527
528&usbdrd3_1 {
529	status = "okay";
530
531	usb@fe900000 {
532		dr_mode = "host";
533		status = "okay";
534	};
535};
536