1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Hardkernel Co., Ltd
4 * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
5 */
6
7/dts-v1/;
8#include <dt-bindings/gpio/gpio.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/pinctrl/rockchip.h>
11#include "rk3326.dtsi"
12
13/ {
14	model = "ODROID-GO Advance";
15	compatible = "hardkernel,rk3326-odroid-go2", "rockchip,rk3326";
16
17	chosen {
18		stdout-path = "serial2:115200n8";
19	};
20
21	backlight: backlight {
22		compatible = "pwm-backlight";
23		power-supply = <&vcc_bl>;
24		pwms = <&pwm1 0 25000 0>;
25	};
26
27	gpio-keys {
28		compatible = "gpio-keys";
29		pinctrl-names = "default";
30		pinctrl-0 = <&btn_pins>;
31
32		/*
33		 *      *** ODROIDGO2-Advance Switch layout ***
34		 * |------------------------------------------------|
35		 * | sw15                                      sw16 |
36		 * |------------------------------------------------|
37		 * |     sw1      |-------------------|      sw8    |
38		 * |  sw3   sw4   |                   |   sw7   sw5 |
39		 * |     sw2      |    LCD Display    |      sw6    |
40		 * |              |                   |             |
41		 * |              |-------------------|             |
42		 * |         sw9 sw10   sw11 sw12   sw13 sw14       |
43		 * |------------------------------------------------|
44		 */
45
46		sw1 {
47			gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>;
48			label = "DPAD-UP";
49			linux,code = <BTN_DPAD_UP>;
50		};
51		sw2 {
52			gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>;
53			label = "DPAD-DOWN";
54			linux,code = <BTN_DPAD_DOWN>;
55		};
56		sw3 {
57			gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>;
58			label = "DPAD-LEFT";
59			linux,code = <BTN_DPAD_LEFT>;
60		};
61		sw4 {
62			gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>;
63			label = "DPAD-RIGHT";
64			linux,code = <BTN_DPAD_RIGHT>;
65		};
66		sw5 {
67			gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>;
68			label = "BTN-A";
69			linux,code = <BTN_EAST>;
70		};
71		sw6 {
72			gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>;
73			label = "BTN-B";
74			linux,code = <BTN_SOUTH>;
75		};
76		sw7 {
77			gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_LOW>;
78			label = "BTN-Y";
79			linux,code = <BTN_WEST>;
80		};
81		sw8 {
82			gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_LOW>;
83			label = "BTN-X";
84			linux,code = <BTN_NORTH>;
85		};
86		sw9 {
87			gpios = <&gpio2 RK_PA0 GPIO_ACTIVE_LOW>;
88			label = "F1";
89			linux,code = <BTN_TRIGGER_HAPPY1>;
90		};
91		sw10 {
92			gpios = <&gpio2 RK_PA1 GPIO_ACTIVE_LOW>;
93			label = "F2";
94			linux,code = <BTN_TRIGGER_HAPPY2>;
95		};
96		sw11 {
97			gpios = <&gpio2 RK_PA2 GPIO_ACTIVE_LOW>;
98			label = "F3";
99			linux,code = <BTN_TRIGGER_HAPPY3>;
100		};
101		sw12 {
102			gpios = <&gpio2 RK_PA3 GPIO_ACTIVE_LOW>;
103			label = "F4";
104			linux,code = <BTN_TRIGGER_HAPPY4>;
105		};
106		sw13 {
107			gpios = <&gpio2 RK_PA4 GPIO_ACTIVE_LOW>;
108			label = "F5";
109			linux,code = <BTN_TRIGGER_HAPPY5>;
110		};
111		sw14 {
112			gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_LOW>;
113			label = "F6";
114			linux,code = <BTN_TRIGGER_HAPPY6>;
115		};
116		sw15 {
117			gpios = <&gpio2 RK_PA6 GPIO_ACTIVE_LOW>;
118			label = "TOP-LEFT";
119			linux,code = <BTN_TL>;
120		};
121		sw16 {
122			gpios = <&gpio2 RK_PA7 GPIO_ACTIVE_LOW>;
123			label = "TOP-RIGHT";
124			linux,code = <BTN_TR>;
125		};
126	};
127
128	leds: gpio-leds {
129		compatible = "gpio-leds";
130		pinctrl-names = "default";
131		pinctrl-0 = <&blue_led_pin>;
132
133		blue_led: led-0 {
134			label = "blue:heartbeat";
135			gpios = <&gpio0 RK_PC1 GPIO_ACTIVE_HIGH>;
136			linux,default-trigger = "heartbeat";
137		};
138	};
139
140	vccsys: vccsys {
141		compatible = "regulator-fixed";
142		regulator-name = "vcc3v8_sys";
143		regulator-always-on;
144		regulator-min-microvolt = <3800000>;
145		regulator-max-microvolt = <3800000>;
146	};
147
148	vcc_host: vcc_host {
149		compatible = "regulator-fixed";
150		regulator-name = "vcc_host";
151		regulator-min-microvolt = <5000000>;
152		regulator-max-microvolt = <5000000>;
153
154		gpio = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
155		enable-active-high;
156		regulator-always-on;
157		vin-supply = <&vccsys>;
158	};
159};
160
161&cpu0 {
162	cpu-supply = <&vdd_arm>;
163};
164
165&cpu1 {
166	cpu-supply = <&vdd_arm>;
167};
168
169&cpu2 {
170	cpu-supply = <&vdd_arm>;
171};
172
173&cpu3 {
174	cpu-supply = <&vdd_arm>;
175};
176
177&cru {
178	assigned-clocks = <&cru PLL_NPLL>,
179		<&cru ACLK_BUS_PRE>, <&cru ACLK_PERI_PRE>,
180		<&cru HCLK_BUS_PRE>, <&cru HCLK_PERI_PRE>,
181		<&cru PCLK_BUS_PRE>, <&cru SCLK_GPU>,
182		<&cru PLL_CPLL>;
183
184	assigned-clock-rates = <1188000000>,
185		<200000000>, <200000000>,
186		<150000000>, <150000000>,
187		<100000000>, <200000000>,
188		<17000000>;
189};
190
191&display_subsystem {
192	status = "okay";
193};
194
195&dsi {
196	status = "okay";
197
198	ports {
199		mipi_out: port@1 {
200			reg = <1>;
201
202			mipi_out_panel: endpoint {
203				remote-endpoint = <&mipi_in_panel>;
204			};
205		};
206	};
207
208	panel@0 {
209		compatible = "elida,kd35t133";
210		reg = <0>;
211		backlight = <&backlight>;
212		iovcc-supply = <&vcc_lcd>;
213		reset-gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
214		vdd-supply = <&vcc_lcd>;
215
216		port {
217			mipi_in_panel: endpoint {
218				remote-endpoint = <&mipi_out_panel>;
219			};
220		};
221	};
222};
223
224&dsi_dphy {
225	status = "okay";
226};
227
228&gpu {
229	mali-supply = <&vdd_logic>;
230	status = "okay";
231};
232
233&i2c0 {
234	clock-frequency = <400000>;
235	i2c-scl-falling-time-ns = <16>;
236	i2c-scl-rising-time-ns = <280>;
237	status = "okay";
238
239	rk817: pmic@20 {
240		compatible = "rockchip,rk817";
241		reg = <0x20>;
242		interrupt-parent = <&gpio0>;
243		interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>;
244		pinctrl-names = "default";
245		pinctrl-0 = <&pmic_int>;
246		wakeup-source;
247		#clock-cells = <1>;
248		clock-output-names = "rk808-clkout1", "xin32k";
249
250		vcc1-supply = <&vccsys>;
251		vcc2-supply = <&vccsys>;
252		vcc3-supply = <&vccsys>;
253		vcc4-supply = <&vccsys>;
254		vcc5-supply = <&vccsys>;
255		vcc6-supply = <&vccsys>;
256		vcc7-supply = <&vccsys>;
257
258		regulators {
259			vdd_logic: DCDC_REG1 {
260				regulator-name = "vdd_logic";
261				regulator-min-microvolt = <950000>;
262				regulator-max-microvolt = <1150000>;
263				regulator-ramp-delay = <6001>;
264				regulator-always-on;
265				regulator-boot-on;
266
267				regulator-state-mem {
268					regulator-on-in-suspend;
269					regulator-suspend-microvolt = <950000>;
270				};
271			};
272
273			vdd_arm: DCDC_REG2 {
274				regulator-name = "vdd_arm";
275				regulator-min-microvolt = <950000>;
276				regulator-max-microvolt = <1350000>;
277				regulator-ramp-delay = <6001>;
278				regulator-always-on;
279				regulator-boot-on;
280
281				regulator-state-mem {
282					regulator-off-in-suspend;
283					regulator-suspend-microvolt = <950000>;
284				};
285			};
286
287			vcc_ddr: DCDC_REG3 {
288				regulator-name = "vcc_ddr";
289				regulator-always-on;
290				regulator-boot-on;
291
292				regulator-state-mem {
293					regulator-on-in-suspend;
294				};
295			};
296
297			vcc_3v3: DCDC_REG4 {
298				regulator-name = "vcc_3v3";
299				regulator-min-microvolt = <3300000>;
300				regulator-max-microvolt = <3300000>;
301				regulator-always-on;
302				regulator-boot-on;
303
304				regulator-state-mem {
305					regulator-off-in-suspend;
306					regulator-suspend-microvolt = <3300000>;
307				};
308			};
309
310			vcc_1v8: LDO_REG2 {
311				regulator-name = "vcc_1v8";
312				regulator-min-microvolt = <1800000>;
313				regulator-max-microvolt = <1800000>;
314				regulator-always-on;
315				regulator-boot-on;
316
317				regulator-state-mem {
318					regulator-on-in-suspend;
319					regulator-suspend-microvolt = <1800000>;
320				};
321			};
322
323			vdd_1v0: LDO_REG3 {
324				regulator-name = "vdd_1v0";
325				regulator-min-microvolt = <1000000>;
326				regulator-max-microvolt = <1000000>;
327				regulator-always-on;
328				regulator-boot-on;
329
330				regulator-state-mem {
331					regulator-on-in-suspend;
332					regulator-suspend-microvolt = <1000000>;
333				};
334			};
335
336			vcc3v3_pmu: LDO_REG4 {
337				regulator-name = "vcc3v3_pmu";
338				regulator-min-microvolt = <3300000>;
339				regulator-max-microvolt = <3300000>;
340				regulator-always-on;
341				regulator-boot-on;
342
343				regulator-state-mem {
344					regulator-on-in-suspend;
345					regulator-suspend-microvolt = <3300000>;
346				};
347			};
348
349			vccio_sd: LDO_REG5 {
350				regulator-name = "vccio_sd";
351				regulator-min-microvolt = <1800000>;
352				regulator-max-microvolt = <3300000>;
353				regulator-always-on;
354				regulator-boot-on;
355
356				regulator-state-mem {
357					regulator-on-in-suspend;
358					regulator-suspend-microvolt = <3300000>;
359				};
360			};
361
362			vcc_sd: LDO_REG6 {
363				regulator-name = "vcc_sd";
364				regulator-min-microvolt = <3300000>;
365				regulator-max-microvolt = <3300000>;
366				regulator-boot-on;
367
368				regulator-state-mem {
369					regulator-on-in-suspend;
370					regulator-suspend-microvolt = <3300000>;
371				};
372			};
373
374			vcc_bl: LDO_REG7 {
375				regulator-name = "vcc_bl";
376				regulator-min-microvolt = <3300000>;
377				regulator-max-microvolt = <3300000>;
378
379				regulator-state-mem {
380					regulator-off-in-suspend;
381					regulator-suspend-microvolt = <3300000>;
382				};
383			};
384
385			vcc_lcd: LDO_REG8 {
386				regulator-name = "vcc_lcd";
387				regulator-min-microvolt = <2800000>;
388				regulator-max-microvolt = <2800000>;
389
390				regulator-state-mem {
391					regulator-off-in-suspend;
392					regulator-suspend-microvolt = <2800000>;
393				};
394			};
395
396			vcc_cam: LDO_REG9 {
397				regulator-name = "vcc_cam";
398				regulator-min-microvolt = <3000000>;
399				regulator-max-microvolt = <3000000>;
400
401				regulator-state-mem {
402					regulator-off-in-suspend;
403					regulator-suspend-microvolt = <3000000>;
404				};
405			};
406		};
407	};
408};
409
410/* EXT Header(P2): 7(SCL:GPIO0.C2), 8(SDA:GPIO0.C3) */
411&i2c1 {
412	clock-frequency = <400000>;
413	status = "okay";
414};
415
416/* I2S 1 Channel Used */
417&i2s1_2ch {
418	status = "okay";
419};
420
421&io_domains {
422	vccio1-supply = <&vcc_3v3>;
423	vccio2-supply = <&vccio_sd>;
424	vccio3-supply = <&vcc_3v3>;
425	vccio4-supply = <&vcc_3v3>;
426	vccio5-supply = <&vcc_3v3>;
427	vccio6-supply = <&vcc_3v3>;
428	status = "okay";
429};
430
431&pmu_io_domains {
432	pmuio1-supply = <&vcc3v3_pmu>;
433	pmuio2-supply = <&vcc3v3_pmu>;
434	status = "okay";
435};
436
437&pwm1 {
438	status = "okay";
439};
440
441&saradc {
442	vref-supply = <&vcc_1v8>;
443	status = "okay";
444};
445
446&sdmmc {
447	cap-sd-highspeed;
448	card-detect-delay = <200>;
449	cd-gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_LOW>; /*[> CD GPIO <]*/
450	sd-uhs-sdr12;
451	sd-uhs-sdr25;
452	sd-uhs-sdr50;
453	sd-uhs-sdr104;
454	vmmc-supply = <&vcc_sd>;
455	vqmmc-supply = <&vccio_sd>;
456	status = "okay";
457};
458
459&tsadc {
460	status = "okay";
461};
462
463&u2phy {
464	status = "okay";
465
466	u2phy_host: host-port {
467		status = "okay";
468	};
469
470	u2phy_otg: otg-port {
471		status = "disabled";
472	};
473};
474
475&usb20_otg {
476	status = "okay";
477};
478
479/* EXT Header(P2): 2(RXD:GPIO1.C0),3(TXD:.C1),4(CTS:.C2),5(RTS:.C3) */
480&uart1 {
481	pinctrl-names = "default";
482	pinctrl-0 = <&uart1_xfer &uart1_cts>;
483	status = "okay";
484};
485
486&uart2 {
487	pinctrl-names = "default";
488	pinctrl-0 = <&uart2m1_xfer>;
489	status = "okay";
490};
491
492&vopb {
493	status = "okay";
494};
495
496&vopb_mmu {
497	status = "okay";
498};
499
500&pinctrl {
501	btns {
502		btn_pins: btn-pins {
503			rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
504					<1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
505					<1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
506					<1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
507					<1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
508					<1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
509					<1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
510					<1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>,
511					<2 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>,
512					<2 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>,
513					<2 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
514					<2 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
515					<2 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
516					<2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
517					<2 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
518					<2 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
519		};
520	};
521
522	headphone {
523		hp_det: hp-det {
524			rockchip,pins = <2 RK_PC6 RK_FUNC_GPIO &pcfg_pull_down>;
525		};
526	};
527
528	leds {
529		blue_led_pin: blue-led-pin {
530			rockchip,pins = <0 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
531		};
532	};
533
534	pmic {
535		dc_det: dc-det {
536			rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
537		};
538
539		pmic_int: pmic-int {
540			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
541		};
542
543		soc_slppin_gpio: soc_slppin_gpio {
544			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_output_low>;
545		};
546
547		soc_slppin_rst: soc_slppin_rst {
548			rockchip,pins = <0 RK_PA4 2 &pcfg_pull_none>;
549		};
550
551		soc_slppin_slp: soc_slppin_slp {
552			rockchip,pins = <0 RK_PA4 1 &pcfg_pull_none>;
553		};
554	};
555};
556