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