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	hdd_a_power: hdd-a-power {
93		compatible = "regulator-fixed";
94		enable-active-high;
95		gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
96		pinctrl-0 = <&hdd_a_power_en>;
97		pinctrl-names = "default";
98		regulator-always-on;
99		regulator-boot-on;
100		regulator-name = "hdd_a_power";
101		startup-delay-us = <2000000>;
102	};
103
104	hdd_b_power: hdd-b-power {
105		compatible = "regulator-fixed";
106		enable-active-high;
107		gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
108		pinctrl-0 = <&hdd_b_power_en>;
109		pinctrl-names = "default";
110		regulator-always-on;
111		regulator-boot-on;
112		regulator-name = "hdd_b_power";
113		startup-delay-us = <2000000>;
114	};
115
116	pcie_power: pcie-power {
117		compatible = "regulator-fixed";
118		enable-active-high;
119		gpio = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
120		pinctrl-0 = <&pcie_pwr>;
121		pinctrl-names = "default";
122		regulator-boot-on;
123		regulator-name = "pcie_power";
124		startup-delay-us = <10000>;
125		vin-supply = <&vcc5v0_perdev>;
126	};
127
128	usblan_power: usblan-power {
129		compatible = "regulator-fixed";
130		enable-active-high;
131		gpio = <&gpio1 RK_PC7 GPIO_ACTIVE_HIGH>;
132		pinctrl-names = "default";
133		pinctrl-0 = <&usb_lan_en>;
134		regulator-name = "usblan_power";
135		regulator-always-on;
136		regulator-boot-on;
137		vin-supply = <&vcc5v0_usb>;
138	};
139
140	vcc1v8_sys_s0: vcc1v8-sys-s0 {
141		compatible = "regulator-fixed";
142		regulator-name = "vcc1v8_sys_s0";
143		regulator-always-on;
144		regulator-boot-on;
145		regulator-min-microvolt = <1800000>;
146		regulator-max-microvolt = <1800000>;
147		vin-supply = <&vcc1v8_sys_s3>;
148	};
149
150	vcc3v0_sd: vcc3v0-sd {
151		compatible = "regulator-fixed";
152		enable-active-high;
153		gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>;
154		regulator-name = "vcc3v0_sd";
155		regulator-boot-on;
156		regulator-min-microvolt = <3000000>;
157		regulator-max-microvolt = <3000000>;
158		pinctrl-names = "default";
159		pinctrl-0 = <&sdmmc0_pwr_h>;
160		vin-supply = <&vcc3v3_sys_s3>;
161	};
162
163	vcc3v3_sys_s3: vcc_lan: vcc3v3-sys-s3 {
164		compatible = "regulator-fixed";
165		regulator-name = "vcc3v3_sys_s3";
166		regulator-always-on;
167		regulator-boot-on;
168		regulator-min-microvolt = <3300000>;
169		regulator-max-microvolt = <3300000>;
170		vin-supply = <&vcc5v0_sys>;
171
172		regulator-state-mem {
173			regulator-on-in-suspend;
174		};
175	};
176
177	vcc5v0_perdev: vcc5v0-perdev {
178		compatible = "regulator-fixed";
179		regulator-name = "vcc5v0_perdev";
180		regulator-always-on;
181		regulator-boot-on;
182		regulator-min-microvolt = <5000000>;
183		regulator-max-microvolt = <5000000>;
184		vin-supply = <&vcc12v_dcin_bkup>;
185	};
186
187	vcc5v0_sys: vcc5v0-sys {
188		compatible = "regulator-fixed";
189		regulator-name = "vcc5v0_sys";
190		regulator-always-on;
191		regulator-boot-on;
192		regulator-min-microvolt = <5000000>;
193		regulator-max-microvolt = <5000000>;
194		vin-supply = <&vcc12v_dcin_bkup>;
195
196		regulator-state-mem {
197			regulator-on-in-suspend;
198		};
199	};
200
201	vcc5v0_usb: vcc5v0-usb {
202		compatible = "regulator-fixed";
203		enable-active-high;
204		gpio = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>;
205		pinctrl-names = "default";
206		pinctrl-0 = <&vcc5v0_usb_en>;
207		regulator-name = "vcc5v0_usb";
208		regulator-always-on;
209		regulator-boot-on;
210		regulator-min-microvolt = <5000000>;
211		regulator-max-microvolt = <5000000>;
212		vin-supply = <&vcc5v0_perdev>;
213	};
214
215	vcc12v_dcin: vcc12v-dcin {
216		compatible = "regulator-fixed";
217		regulator-name = "vcc12v_dcin";
218		regulator-always-on;
219		regulator-boot-on;
220		regulator-min-microvolt = <12000000>;
221		regulator-max-microvolt = <12000000>;
222	};
223
224	vcc12v_dcin_bkup: vcc12v-dcin-bkup {
225		compatible = "regulator-fixed";
226		regulator-name = "vcc12v_dcin_bkup";
227		regulator-always-on;
228		regulator-boot-on;
229		regulator-min-microvolt = <12000000>;
230		regulator-max-microvolt = <12000000>;
231		vin-supply = <&vcc12v_dcin>;
232	};
233};
234
235/*
236 * The system doesn't run stable with cpu freq enabled, so disallow the lower
237 * frequencies until this problem is properly understood and resolved.
238 */
239&cluster0_opp {
240	/delete-node/ opp00;
241	/delete-node/ opp01;
242	/delete-node/ opp02;
243	/delete-node/ opp03;
244	/delete-node/ opp04;
245};
246
247&cluster1_opp {
248	/delete-node/ opp00;
249	/delete-node/ opp01;
250	/delete-node/ opp02;
251	/delete-node/ opp03;
252	/delete-node/ opp04;
253	/delete-node/ opp05;
254	/delete-node/ opp06;
255};
256
257&cpu_b0 {
258	cpu-supply = <&vdd_cpu_b>;
259};
260
261&cpu_b1 {
262	cpu-supply = <&vdd_cpu_b>;
263};
264
265&cpu_l0 {
266	cpu-supply = <&vdd_cpu_l>;
267};
268
269&cpu_l1 {
270	cpu-supply = <&vdd_cpu_l>;
271};
272
273&cpu_l2 {
274	cpu-supply = <&vdd_cpu_l>;
275};
276
277&cpu_l3 {
278	cpu-supply = <&vdd_cpu_l>;
279};
280
281&emmc_phy {
282	status = "okay";
283};
284
285&gmac {
286	assigned-clock-parents = <&clkin_gmac>;
287	assigned-clocks = <&cru SCLK_RMII_SRC>;
288	clock_in_out = "input";
289	phy-mode = "rgmii";
290	phy-supply = <&vcc_lan>;
291	pinctrl-names = "default";
292	pinctrl-0 = <&rgmii_pins &gphy_reset>;
293	rx_delay = <0x20>;
294	tx_delay = <0x28>;
295	snps,reset-active-low;
296	snps,reset-delays-us = <0 10000 50000>;
297	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
298	status = "okay";
299};
300
301&i2c0 {
302	clock-frequency = <400000>;
303	i2c-scl-rising-time-ns = <168>;
304	i2c-scl-falling-time-ns = <4>;
305	status = "okay";
306
307	rk808: pmic@1b {
308		compatible = "rockchip,rk808";
309		reg = <0x1b>;
310		interrupt-parent = <&gpio0>;
311		interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
312		clock-output-names = "xin32k", "rk808-clkout2";
313		pinctrl-names = "default";
314		pinctrl-0 = <&pmic_int_l>;
315		rockchip,system-power-controller;
316		vcc1-supply = <&vcc5v0_sys>;
317		vcc2-supply = <&vcc5v0_sys>;
318		vcc3-supply = <&vcc5v0_sys>;
319		vcc4-supply = <&vcc5v0_sys>;
320		vcc6-supply = <&vcc5v0_sys>;
321		vcc7-supply = <&vcc5v0_sys>;
322		vcc8-supply = <&vcc3v3_sys_s3>;
323		vcc9-supply = <&vcc5v0_sys>;
324		vcc10-supply = <&vcc5v0_sys>;
325		vcc11-supply = <&vcc5v0_sys>;
326		vcc12-supply = <&vcc3v3_sys_s3>;
327		vddio-supply = <&vcc3v0_s3>;
328		wakeup-source;
329		#clock-cells = <1>;
330
331		regulators {
332			vdd_cpu_l: DCDC_REG2 {
333				regulator-name = "vdd_cpu_l";
334				regulator-always-on;
335				regulator-boot-on;
336				regulator-min-microvolt = <750000>;
337				regulator-max-microvolt = <1350000>;
338				regulator-ramp-delay = <6001>;
339
340				regulator-state-mem {
341					regulator-off-in-suspend;
342				};
343			};
344
345			vcc1v8_sys_s3: DCDC_REG4 {
346				regulator-name = "vcc1v8_sys_s3";
347				regulator-always-on;
348				regulator-boot-on;
349				regulator-min-microvolt = <1800000>;
350				regulator-max-microvolt = <1800000>;
351
352				regulator-state-mem {
353					regulator-on-in-suspend;
354					regulator-suspend-microvolt = <1800000>;
355				};
356			};
357
358			vcc_sdio_s0: LDO_REG4 {
359				regulator-name = "vcc_sdio_s0";
360				regulator-always-on;
361				regulator-boot-on;
362				regulator-min-microvolt = <1800000>;
363				regulator-max-microvolt = <3000000>;
364
365				regulator-state-mem {
366					regulator-on-in-suspend;
367					regulator-suspend-microvolt = <3000000>;
368				};
369			};
370
371			vcc3v0_s3: LDO_REG8 {
372				regulator-name = "vcc3v0_s3";
373				regulator-always-on;
374				regulator-boot-on;
375				regulator-min-microvolt = <3000000>;
376				regulator-max-microvolt = <3000000>;
377
378				regulator-state-mem {
379					regulator-on-in-suspend;
380					regulator-suspend-microvolt = <3000000>;
381				};
382			};
383		};
384	};
385
386	vdd_cpu_b: regulator@40 {
387		compatible = "silergy,syr827";
388		reg = <0x40>;
389		fcs,suspend-voltage-selector = <1>;
390		regulator-name = "vdd_cpu_b";
391		regulator-always-on;
392		regulator-boot-on;
393		regulator-min-microvolt = <712500>;
394		regulator-max-microvolt = <1500000>;
395		regulator-ramp-delay = <1000>;
396		vin-supply = <&vcc5v0_sys>;
397
398		regulator-state-mem {
399			regulator-off-in-suspend;
400		};
401	};
402};
403
404&i2c2 {
405	clock-frequency = <400000>;
406	i2c-scl-rising-time-ns = <160>;
407	i2c-scl-falling-time-ns = <30>;
408	status = "okay";
409
410	temp@4c {
411		compatible = "national,lm75";
412		reg = <0x4c>;
413	};
414};
415
416&io_domains {
417	audio-supply = <&vcc1v8_sys_s0>;
418	bt656-supply = <&vcc1v8_sys_s0>;
419	gpio1830-supply = <&vcc3v0_s3>;
420	sdmmc-supply = <&vcc_sdio_s0>;
421	status = "okay";
422};
423
424&pcie_phy {
425	status = "okay";
426};
427
428&pcie0 {
429	ep-gpios = <&gpio2 RK_PD4 GPIO_ACTIVE_HIGH>;
430	max-link-speed = <2>;
431	num-lanes = <2>;
432	pinctrl-names = "default";
433	status = "okay";
434
435	vpcie12v-supply = <&vcc12v_dcin>;
436	vpcie3v3-supply = <&pcie_power>;
437	vpcie1v8-supply = <&avdd_1v8_s0>;
438	vpcie0v9-supply = <&avdd_0v9_s0>;
439};
440
441&pinctrl {
442	gmac {
443		gphy_reset: gphy-reset {
444			rockchip,pins = <3 RK_PB7 RK_FUNC_GPIO &pcfg_output_low>;
445		};
446	};
447
448	leds {
449		sys_grn_led_on: sys-grn-led-on {
450			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_down>;
451		};
452
453		sys_red_led_on: sys-red-led-on {
454			rockchip,pins = <0 RK_PB5 RK_FUNC_GPIO &pcfg_pull_down>;
455		};
456	};
457
458	pcie {
459		pcie_pwr: pcie-pwr {
460			rockchip,pins =
461				<1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_none>;
462		};
463	};
464
465	pmic {
466		pmic_int_l: pmic-int-l {
467			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
468		};
469	};
470
471	power {
472		hdd_a_power_en: hdd-a-power-en {
473			rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
474		};
475
476		hdd_b_power_en: hdd-b-power-en {
477			rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
478		};
479
480		vcc5v0_usb_en: vcc5v0-usb-en {
481			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
482		};
483
484		usb_lan_en: usb-lan-en {
485			rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
486		};
487	};
488
489	vcc3v0-sd {
490		sdmmc0_pwr_h: sdmmc0-pwr-h {
491			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
492		};
493	};
494};
495
496&pmu_io_domains {
497	pmu1830-supply = <&vcc3v0_s3>;
498	status = "okay";
499};
500
501&pwm0 {
502	/* pwm-fan on P7 */
503	status = "okay";
504};
505
506&pwm1 {
507	/* pwm-fan on P6 */
508	status = "okay";
509};
510
511&sdhci {
512	bus-width = <8>;
513	mmc-hs200-1_8v;
514	non-removable;
515	vqmmc-supply = <&vcc1v8_sys_s0>;
516	status = "okay";
517};
518
519&sdmmc {
520	bus-width = <4>;
521	cap-sd-highspeed;
522	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
523	disable-wp;
524	pinctrl-names = "default";
525	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
526	vmmc-supply = <&vcc3v0_sd>;
527	vqmmc-supply = <&vcc_sdio_s0>;
528	status = "okay";
529};
530
531&spi1 {
532	status = "okay";
533
534	spiflash: flash@0 {
535		compatible = "jedec,spi-nor";
536		reg = <0x0>;
537		spi-max-frequency = <25000000>;
538		status = "okay";
539		m25p,fast-read;
540	};
541};
542
543/* UEXT connector */
544&spi2 {
545	status = "okay";
546};
547
548&spi5 {
549	status = "okay";
550};
551
552&tcphy1 {
553	/* phy for &usbdrd_dwc3_1 */
554	status = "okay";
555};
556
557&tsadc {
558	/* tshut mode 0:CRU 1:GPIO */
559	rockchip,hw-tshut-mode = <1>;
560	/* tshut polarity 0:LOW 1:HIGH */
561	rockchip,hw-tshut-polarity = <1>;
562	status = "okay";
563};
564
565&u2phy1 {
566	status = "okay";
567
568	otg-port {
569		/* phy for &usbdrd_dwc3_1 */
570		phy-supply = <&vcc5v0_usb>;
571		status = "okay";
572	};
573};
574
575&uart2 {
576	status = "okay";
577};
578
579&usbdrd3_1 {
580	status = "okay";
581
582	usb@fe900000 {
583		dr_mode = "host";
584		status = "okay";
585		#address-cells = <1>;
586		#size-cells = <0>;
587
588		hub@1 {
589			compatible = "usb2109,0815";
590			reg = <1>;
591			#address-cells = <1>;
592			#size-cells = <0>;
593
594			port@1 {
595				reg = <1>;
596				#trigger-source-cells = <0>;
597			};
598
599			port@2 {
600				reg = <2>;
601				#trigger-source-cells = <0>;
602			};
603
604			port@3 {
605				reg = <3>;
606				#trigger-source-cells = <0>;
607			};
608
609			device@4 {
610				compatible = "usbbda,8156";
611				reg = <4>;
612				#address-cells = <2>;
613				#size-cells = <0>;
614
615				interface@0 {	/* interface 0 of configuration 1 */
616					compatible = "usbbda,8156.config1.0";
617					reg = <0 1>;
618				};
619			};
620		};
621	};
622};
623