1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2014, 2015 FUKAUMI Naoki <naobsd@gmail.com>
4 */
5
6#include <dt-bindings/input/input.h>
7#include "rk3288.dtsi"
8
9/ {
10	memory@0 {
11		device_type = "memory";
12		reg = <0x0 0x0 0x0 0x80000000>;
13	};
14
15	adc-keys {
16		compatible = "adc-keys";
17		io-channels = <&saradc 1>;
18		io-channel-names = "buttons";
19		keyup-threshold-microvolt = <1800000>;
20
21		button-recovery {
22			label = "Recovery";
23			linux,code = <KEY_VENDOR>;
24			press-threshold-microvolt = <0>;
25		};
26	};
27
28	dovdd_1v8: dovdd-1v8-regulator {
29		compatible = "regulator-fixed";
30		regulator-name = "dovdd_1v8";
31		regulator-min-microvolt = <1800000>;
32		regulator-max-microvolt = <1800000>;
33		vin-supply = <&vcc28_dvp>;
34	};
35
36	ext_gmac: external-gmac-clock {
37		compatible = "fixed-clock";
38		#clock-cells = <0>;
39		clock-frequency = <125000000>;
40		clock-output-names = "ext_gmac";
41	};
42
43	ir: ir-receiver {
44		compatible = "gpio-ir-receiver";
45		pinctrl-names = "default";
46		pinctrl-0 = <&ir_int>;
47	};
48
49	keys: gpio-keys {
50		compatible = "gpio-keys";
51
52		key-power {
53			wakeup-source;
54			gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
55			label = "GPIO Power";
56			linux,code = <KEY_POWER>;
57			pinctrl-names = "default";
58			pinctrl-0 = <&pwr_key>;
59		};
60	};
61
62	leds {
63		compatible = "gpio-leds";
64
65		work_led: led-0 {
66			gpios = <&gpio8 RK_PA1 GPIO_ACTIVE_LOW>;
67			label = "firefly:blue:user";
68			linux,default-trigger = "rc-feedback";
69			pinctrl-names = "default";
70			pinctrl-0 = <&work_led_pin>;
71		};
72
73		power_led: led-1 {
74			gpios = <&gpio8 RK_PA2 GPIO_ACTIVE_LOW>;
75			label = "firefly:green:power";
76			linux,default-trigger = "default-on";
77			pinctrl-names = "default";
78			pinctrl-0 = <&power_led_pin>;
79		};
80	};
81
82	vbat_wl: vcc_sys: vsys-regulator {
83		compatible = "regulator-fixed";
84		regulator-name = "vcc_sys";
85		regulator-min-microvolt = <5000000>;
86		regulator-max-microvolt = <5000000>;
87		regulator-always-on;
88		regulator-boot-on;
89	};
90
91	vcc_sd: sdmmc-regulator {
92		compatible = "regulator-fixed";
93		gpio = <&gpio7 RK_PB3 GPIO_ACTIVE_LOW>;
94		pinctrl-names = "default";
95		pinctrl-0 = <&sdmmc_pwr>;
96		regulator-name = "vcc_sd";
97		regulator-min-microvolt = <3300000>;
98		regulator-max-microvolt = <3300000>;
99		startup-delay-us = <100000>;
100		vin-supply = <&vcc_io>;
101	};
102
103	vcc_flash: flash-regulator {
104		compatible = "regulator-fixed";
105		regulator-name = "vcc_flash";
106		regulator-min-microvolt = <1800000>;
107		regulator-max-microvolt = <1800000>;
108		vin-supply = <&vcc_io>;
109	};
110
111	vcc_5v: usb-regulator {
112		compatible = "regulator-fixed";
113		regulator-name = "vcc_5v";
114		regulator-min-microvolt = <5000000>;
115		regulator-max-microvolt = <5000000>;
116		regulator-always-on;
117		regulator-boot-on;
118		vin-supply = <&vcc_sys>;
119	};
120
121	vcc_host_5v: usb-host-regulator {
122		compatible = "regulator-fixed";
123		enable-active-high;
124		gpio = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;
125		pinctrl-names = "default";
126		pinctrl-0 = <&host_vbus_drv>;
127		regulator-name = "vcc_host_5v";
128		regulator-min-microvolt = <5000000>;
129		regulator-max-microvolt = <5000000>;
130		regulator-always-on;
131		vin-supply = <&vcc_5v>;
132	};
133
134	vcc_otg_5v: usb-otg-regulator {
135		compatible = "regulator-fixed";
136		enable-active-high;
137		gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
138		pinctrl-names = "default";
139		pinctrl-0 = <&otg_vbus_drv>;
140		regulator-name = "vcc_otg_5v";
141		regulator-min-microvolt = <5000000>;
142		regulator-max-microvolt = <5000000>;
143		regulator-always-on;
144		vin-supply = <&vcc_5v>;
145	};
146
147	/*
148	 * A TT8142 creates both dovdd_1v8 and vcc28_dvp, controlled
149	 * by the dvp_pwr pin.
150	 */
151	vcc28_dvp: vcc28-dvp-regulator {
152		compatible = "regulator-fixed";
153		enable-active-high;
154		gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
155		pinctrl-names = "default";
156		pinctrl-0 = <&dvp_pwr>;
157		regulator-name = "vcc28_dvp";
158		regulator-min-microvolt = <2800000>;
159		regulator-max-microvolt = <2800000>;
160		regulator-always-on;
161		vin-supply = <&vcc_io>;
162	};
163};
164
165&cpu0 {
166	cpu0-supply = <&vdd_cpu>;
167};
168
169&emmc {
170	bus-width = <8>;
171	cap-mmc-highspeed;
172	disable-wp;
173	non-removable;
174	pinctrl-names = "default";
175	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_pwr>, <&emmc_bus8>;
176	vmmc-supply = <&vcc_io>;
177	vqmmc-supply = <&vcc_flash>;
178	status = "okay";
179};
180
181&gmac {
182	assigned-clocks = <&cru SCLK_MAC>;
183	assigned-clock-parents = <&ext_gmac>;
184	clock_in_out = "input";
185	pinctrl-names = "default";
186	pinctrl-0 = <&rgmii_pins>, <&phy_rst>, <&phy_pmeb>, <&phy_int>;
187	phy-supply = <&vcc_lan>;
188	phy-mode = "rgmii";
189	snps,reset-active-low;
190	snps,reset-delays-us = <0 10000 1000000>;
191	snps,reset-gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_LOW>;
192	tx_delay = <0x30>;
193	rx_delay = <0x10>;
194	status = "okay";
195};
196
197&gpu {
198	mali-supply = <&vdd_gpu>;
199	status = "okay";
200};
201
202&hdmi {
203	ddc-i2c-bus = <&i2c5>;
204	status = "okay";
205};
206
207&i2c0 {
208	clock-frequency = <400000>;
209	status = "okay";
210
211	vdd_cpu: syr827@40 {
212		compatible = "silergy,syr827";
213		fcs,suspend-voltage-selector = <1>;
214		reg = <0x40>;
215		regulator-name = "vdd_cpu";
216		regulator-min-microvolt = <850000>;
217		regulator-max-microvolt = <1350000>;
218		regulator-always-on;
219		regulator-boot-on;
220		regulator-enable-ramp-delay = <300>;
221		regulator-ramp-delay = <8000>;
222		vin-supply = <&vcc_sys>;
223	};
224
225	vdd_gpu: syr828@41 {
226		compatible = "silergy,syr828";
227		fcs,suspend-voltage-selector = <1>;
228		reg = <0x41>;
229		regulator-name = "vdd_gpu";
230		regulator-min-microvolt = <850000>;
231		regulator-max-microvolt = <1350000>;
232		regulator-always-on;
233		vin-supply = <&vcc_sys>;
234	};
235
236	hym8563: rtc@51 {
237		compatible = "haoyu,hym8563";
238		reg = <0x51>;
239		#clock-cells = <0>;
240		clock-output-names = "xin32k";
241		interrupt-parent = <&gpio7>;
242		interrupts = <RK_PA4 IRQ_TYPE_EDGE_FALLING>;
243		pinctrl-names = "default";
244		pinctrl-0 = <&rtc_int>;
245	};
246
247	act8846: act8846@5a {
248		compatible = "active-semi,act8846";
249		reg = <0x5a>;
250		pinctrl-names = "default";
251		pinctrl-0 = <&pmic_vsel>, <&pwr_hold>;
252		system-power-controller;
253
254		vp1-supply = <&vcc_sys>;
255		vp2-supply = <&vcc_sys>;
256		vp3-supply = <&vcc_sys>;
257		vp4-supply = <&vcc_sys>;
258		inl1-supply = <&vcc_sys>;
259		inl2-supply = <&vcc_sys>;
260		inl3-supply = <&vcc_20>;
261
262		regulators {
263			vcc_ddr: REG1 {
264				regulator-name = "vcc_ddr";
265				regulator-min-microvolt = <1200000>;
266				regulator-max-microvolt = <1200000>;
267				regulator-always-on;
268			};
269
270			vcc_io: REG2 {
271				regulator-name = "vcc_io";
272				regulator-min-microvolt = <3300000>;
273				regulator-max-microvolt = <3300000>;
274				regulator-always-on;
275			};
276
277			vdd_log: REG3 {
278				regulator-name = "vdd_log";
279				regulator-min-microvolt = <1100000>;
280				regulator-max-microvolt = <1100000>;
281				regulator-always-on;
282			};
283
284			vcc_20: REG4 {
285				regulator-name = "vcc_20";
286				regulator-min-microvolt = <2000000>;
287				regulator-max-microvolt = <2000000>;
288				regulator-always-on;
289			};
290
291			vccio_sd: REG5 {
292				regulator-name = "vccio_sd";
293				regulator-min-microvolt = <3300000>;
294				regulator-max-microvolt = <3300000>;
295				regulator-always-on;
296			};
297
298			vdd10_lcd: REG6 {
299				regulator-name = "vdd10_lcd";
300				regulator-min-microvolt = <1000000>;
301				regulator-max-microvolt = <1000000>;
302				regulator-always-on;
303			};
304
305			vcca_18: REG7 {
306				regulator-name = "vcca_18";
307				regulator-min-microvolt = <1800000>;
308				regulator-max-microvolt = <1800000>;
309			};
310
311			vcca_33: REG8 {
312				regulator-name = "vcca_33";
313				regulator-min-microvolt = <3300000>;
314				regulator-max-microvolt = <3300000>;
315			};
316
317			vcc_lan: REG9 {
318				regulator-name = "vcc_lan";
319				regulator-min-microvolt = <3300000>;
320				regulator-max-microvolt = <3300000>;
321			};
322
323			vdd_10: REG10 {
324				regulator-name = "vdd_10";
325				regulator-min-microvolt = <1000000>;
326				regulator-max-microvolt = <1000000>;
327				regulator-always-on;
328			};
329
330			vccio_wl: vcc_18: REG11 {
331				regulator-name = "vcc_18";
332				regulator-min-microvolt = <1800000>;
333				regulator-max-microvolt = <1800000>;
334				regulator-always-on;
335			};
336
337			vcc18_lcd: REG12 {
338				regulator-name = "vcc18_lcd";
339				regulator-min-microvolt = <1800000>;
340				regulator-max-microvolt = <1800000>;
341				regulator-always-on;
342			};
343		};
344	};
345};
346
347&i2c1 {
348	status = "okay";
349};
350
351&i2c2 {
352	status = "okay";
353};
354
355&i2c4 {
356	status = "okay";
357};
358
359&i2c5 {
360	status = "okay";
361};
362
363&io_domains {
364	status = "okay";
365
366	audio-supply = <&vcca_33>;
367	bb-supply = <&vcc_io>;
368	dvp-supply = <&dovdd_1v8>;
369	flash0-supply = <&vcc_flash>;
370	flash1-supply = <&vcc_lan>;
371	gpio30-supply = <&vcc_io>;
372	gpio1830-supply = <&vcc_io>;
373	lcdc-supply = <&vcc_io>;
374	sdcard-supply = <&vccio_sd>;
375	wifi-supply = <&vccio_wl>;
376};
377
378&pinctrl {
379	pcfg_output_high: pcfg-output-high {
380		output-high;
381	};
382
383	pcfg_output_low: pcfg-output-low {
384		output-low;
385	};
386
387	pcfg_pull_up_drv_12ma: pcfg-pull-up-drv-12ma {
388		bias-pull-up;
389		drive-strength = <12>;
390	};
391
392	act8846 {
393		pwr_hold: pwr-hold {
394			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_output_high>;
395		};
396	};
397
398	dvp {
399		dvp_pwr: dvp-pwr {
400			rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
401		};
402	};
403
404	gmac {
405		phy_int: phy-int {
406			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>;
407		};
408
409		phy_pmeb: phy-pmeb {
410			rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
411		};
412
413		phy_rst: phy-rst {
414			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_output_high>;
415		};
416	};
417
418	hym8563 {
419		rtc_int: rtc-int {
420			rockchip,pins = <7 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>;
421		};
422	};
423
424	keys {
425		pwr_key: pwr-key {
426			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
427		};
428	};
429
430	leds {
431		power_led_pin: power-led-pin {
432			rockchip,pins = <8 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
433		};
434
435		work_led_pin: work-led-pin {
436			rockchip,pins = <8 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
437		};
438	};
439
440	sdmmc {
441		/*
442		 * Default drive strength isn't enough to achieve even
443		 * high-speed mode on firefly board so bump up to 12ma.
444		 */
445		sdmmc_bus4: sdmmc-bus4 {
446			rockchip,pins = <6 RK_PC0 1 &pcfg_pull_up_drv_12ma>,
447					<6 RK_PC1 1 &pcfg_pull_up_drv_12ma>,
448					<6 RK_PC2 1 &pcfg_pull_up_drv_12ma>,
449					<6 RK_PC3 1 &pcfg_pull_up_drv_12ma>;
450		};
451
452		sdmmc_clk: sdmmc-clk {
453			rockchip,pins = <6 RK_PC4 1 &pcfg_pull_none_12ma>;
454		};
455
456		sdmmc_cmd: sdmmc-cmd {
457			rockchip,pins = <6 RK_PC5 1 &pcfg_pull_up_drv_12ma>;
458		};
459
460		sdmmc_pwr: sdmmc-pwr {
461			rockchip,pins = <7 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
462		};
463	};
464
465	usb_host {
466		host_vbus_drv: host-vbus-drv {
467			rockchip,pins = <0 RK_PB6 RK_FUNC_GPIO &pcfg_pull_none>;
468		};
469
470		usbhub_rst: usbhub-rst {
471			rockchip,pins = <8 RK_PA3 RK_FUNC_GPIO &pcfg_output_high>;
472		};
473	};
474
475	usb_otg {
476		otg_vbus_drv: otg-vbus-drv {
477			rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
478		};
479	};
480};
481
482&saradc {
483	vref-supply = <&vcc_18>;
484	status = "okay";
485};
486
487&sdio0 {
488	bus-width = <4>;
489	disable-wp;
490	non-removable;
491	pinctrl-names = "default";
492	pinctrl-0 = <&sdio0_bus4>, <&sdio0_cmd>, <&sdio0_clk>;
493	vmmc-supply = <&vbat_wl>;
494	vqmmc-supply = <&vccio_wl>;
495	status = "okay";
496};
497
498&sdmmc {
499	bus-width = <4>;
500	cap-mmc-highspeed;
501	cap-sd-highspeed;
502	card-detect-delay = <200>;
503	disable-wp;
504	pinctrl-names = "default";
505	pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
506	vmmc-supply = <&vcc_sd>;
507	vqmmc-supply = <&vccio_sd>;
508	status = "okay";
509};
510
511&spi0 {
512	pinctrl-names = "default";
513	pinctrl-0 = <&spi0_clk>, <&spi0_cs0>, <&spi0_tx>, <&spi0_rx>, <&spi0_cs1>;
514	status = "okay";
515};
516
517&tsadc {
518	rockchip,hw-tshut-mode = <0>;
519	rockchip,hw-tshut-polarity = <0>;
520	status = "okay";
521};
522
523&uart0 {
524	pinctrl-names = "default";
525	pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
526	status = "okay";
527};
528
529&uart1 {
530	status = "okay";
531};
532
533&uart2 {
534	status = "okay";
535};
536
537&uart3 {
538	status = "okay";
539};
540
541&usbphy {
542	status = "okay";
543};
544
545&usb_host1 {
546	pinctrl-names = "default";
547	pinctrl-0 = <&usbhub_rst>;
548	status = "okay";
549};
550
551&usb_otg {
552	status = "okay";
553};
554
555&vopb {
556	status = "okay";
557};
558
559&vopb_mmu {
560	status = "okay";
561};
562
563&vopl {
564	status = "okay";
565};
566
567&vopl_mmu {
568	status = "okay";
569};
570
571&wdt {
572	status = "okay";
573};
574