1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright 2020, Compass Electronics Group, LLC
4 */
5
6#include <dt-bindings/gpio/gpio.h>
7#include <dt-bindings/input/input.h>
8
9/ {
10	backlight_lvds: backlight-lvds {
11		compatible = "pwm-backlight";
12		power-supply = <&reg_lcd>;
13		enable-gpios = <&gpio_exp1 3 GPIO_ACTIVE_LOW>;
14		pwms = <&pwm2 0 50000>;
15		brightness-levels = <0 4 8 16 32 64 128 255>;
16		default-brightness-level = <6>;
17	};
18
19	backlight_rgb: backlight-rgb {
20		compatible = "pwm-backlight";
21		power-supply = <&reg_lcd>;
22		enable-gpios = <&gpio_exp1 7 GPIO_ACTIVE_LOW>;
23		pwms = <&pwm0 0 50000>;
24		brightness-levels = <0 4 8 16 32 64 128 255>;
25		default-brightness-level = <6>;
26	};
27
28	hdmi0-out {
29		compatible = "hdmi-connector";
30		type = "a";
31
32		port {
33			hdmi0_con: endpoint {
34				remote-endpoint = <&rcar_dw_hdmi0_out>;
35			};
36		};
37	};
38
39	keys {
40		compatible = "gpio-keys";
41
42		key-1 {
43			gpios = <&gpio4 6 GPIO_ACTIVE_LOW>;
44			linux,code = <KEY_1>;
45			label = "Switch-1";
46			wakeup-source;
47			debounce-interval = <20>;
48		};
49		key-2 {
50			gpios = <&gpio3 13 GPIO_ACTIVE_LOW>;
51			linux,code = <KEY_2>;
52			label = "Switch-2";
53			wakeup-source;
54			debounce-interval = <20>;
55		};
56		key-3 {
57			gpios = <&gpio5 17 GPIO_ACTIVE_LOW>;
58			linux,code = <KEY_3>;
59			label = "Switch-3";
60			wakeup-source;
61			debounce-interval = <20>;
62		};
63		key-4 {
64			gpios = <&gpio5 20 GPIO_ACTIVE_LOW>;
65			linux,code = <KEY_4>;
66			label = "Switch-4";
67			wakeup-source;
68			debounce-interval = <20>;
69		};
70		key-5 {
71			gpios = <&gpio5 22 GPIO_ACTIVE_LOW>;
72			linux,code = <KEY_5>;
73			label = "Switch-4";
74			wakeup-source;
75			debounce-interval = <20>;
76		};
77	};
78
79	leds {
80		compatible = "gpio-leds";
81		pinctrl-0 = <&led_pins>;
82		pinctrl-names = "default";
83
84		led0 {
85			gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
86			label = "LED0";
87			linux,default-trigger = "heartbeat";
88		};
89		led1 {
90			gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
91			label = "LED1";
92		};
93		led2 {
94			gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
95			label = "LED2";
96		};
97		led3 {
98			gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>;
99			label = "LED3";
100		};
101	};
102
103	lvds {
104		compatible = "panel-lvds";
105		power-supply = <&reg_lcd_reset>;
106		width-mm = <223>;
107		height-mm = <125>;
108		backlight = <&backlight_lvds>;
109		data-mapping = "vesa-24";
110
111		panel-timing {
112			/* 800x480@60Hz */
113			clock-frequency = <30000000>;
114			hactive = <800>;
115			vactive = <480>;
116			hsync-len = <48>;
117			hfront-porch = <40>;
118			hback-porch = <40>;
119			vfront-porch = <13>;
120			vback-porch = <29>;
121			vsync-len = <3>;
122			hsync-active = <1>;
123			vsync-active = <1>;
124			de-active = <1>;
125			pixelclk-active = <0>;
126		};
127
128		port {
129			panel_in: endpoint {
130				remote-endpoint = <&lvds0_out>;
131			};
132		};
133	};
134
135	rgb {
136		/* Different LCD with compatible timings */
137		compatible = "rocktech,rk070er9427";
138		backlight = <&backlight_rgb>;
139		enable-gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
140		power-supply = <&reg_lcd>;
141		port {
142			rgb_panel: endpoint {
143				remote-endpoint = <&du_out_rgb>;
144			};
145		};
146	};
147
148	reg_audio: regulator_audio {
149		compatible = "regulator-fixed";
150		regulator-name = "audio-1.8V";
151		regulator-min-microvolt = <1800000>;
152		regulator-max-microvolt = <1800000>;
153		gpio = <&gpio_exp2 7 GPIO_ACTIVE_HIGH>;
154		enable-active-high;
155	};
156
157	reg_lcd: regulator-lcd {
158		compatible = "regulator-fixed";
159		regulator-name = "lcd_panel_pwr";
160		regulator-min-microvolt = <3300000>;
161		regulator-max-microvolt = <3300000>;
162		gpio = <&gpio_exp1 1 GPIO_ACTIVE_HIGH>;
163		enable-active-high;
164	};
165
166	reg_lcd_reset: regulator-lcd-reset {
167		compatible = "regulator-fixed";
168		regulator-name = "nLCD_RESET";
169		regulator-min-microvolt = <3300000>;
170		regulator-max-microvolt = <3300000>;
171		gpio = <&gpio5 3 GPIO_ACTIVE_HIGH>;
172		enable-active-high;
173		vin-supply = <&reg_lcd>;
174	};
175
176	reg_cam0: regulator_camera {
177		compatible = "regulator-fixed";
178		regulator-name = "reg_cam0";
179		regulator-min-microvolt = <1800000>;
180		regulator-max-microvolt = <1800000>;
181		gpio = <&gpio_exp2 2 GPIO_ACTIVE_HIGH>;
182		enable-active-high;
183	};
184
185	reg_cam1: regulator_camera {
186		compatible = "regulator-fixed";
187		regulator-name = "reg_cam1";
188		regulator-min-microvolt = <1800000>;
189		regulator-max-microvolt = <1800000>;
190		gpio = <&gpio_exp2 5 GPIO_ACTIVE_HIGH>;
191		enable-active-high;
192		startup-delay-us = <100000>;
193	};
194
195	sound_card {
196		compatible = "audio-graph-card";
197		label = "rcar-sound";
198		dais = <&rsnd_port0>, <&rsnd_port1>;
199	};
200
201	vccq_sdhi0: regulator-vccq-sdhi0 {
202		compatible = "regulator-gpio";
203
204		regulator-name = "SDHI0 VccQ";
205		regulator-min-microvolt = <1800000>;
206		regulator-max-microvolt = <3300000>;
207
208		gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>;
209		gpios-states = <1>;
210		states = <3300000 1>, <1800000 0>;
211		regulator-always-on;
212	};
213
214	/* External DU dot clocks */
215	x302_clk: x302-clock {
216		compatible = "fixed-clock";
217		#clock-cells = <0>;
218		clock-frequency = <33000000>;
219	};
220
221	x304_clk: x304-clock {
222		compatible = "fixed-clock";
223		#clock-cells = <0>;
224		clock-frequency = <25000000>;
225	};
226};
227
228&audio_clk_a {
229	clock-frequency = <24576000>;
230	assigned-clocks = <&versaclock6_bb 4>;
231	assigned-clock-rates = <24576000>;
232};
233
234&audio_clk_b {
235	clock-frequency = <22579200>;
236};
237
238&can0 {
239	pinctrl-0 = <&can0_pins>;
240	pinctrl-names = "default";
241	renesas,can-clock-select = <0x0>;
242	status = "okay";
243};
244
245&can1 {
246	pinctrl-0 = <&can1_pins>;
247	pinctrl-names = "default";
248	renesas,can-clock-select = <0x0>;
249	status = "okay";
250};
251
252&du {
253	pinctrl-0 = <&du_pins>;
254	pinctrl-names = "default";
255	status = "okay";
256
257	clocks = <&cpg CPG_MOD 724>,
258		<&cpg CPG_MOD 723>,
259		<&cpg CPG_MOD 722>,
260		<&versaclock5 1>,
261		<&x302_clk>,
262		<&versaclock5 2>;
263	clock-names = "du.0", "du.1", "du.2",
264		"dclkin.0", "dclkin.1", "dclkin.2";
265};
266
267&du_out_rgb {
268	remote-endpoint = <&rgb_panel>;
269};
270
271&ehci0 {
272	dr_mode = "otg";
273	status = "okay";
274	clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
275};
276
277&ehci1 {
278	status = "okay";
279	clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
280};
281
282&hdmi0 {
283	status = "okay";
284	ports {
285		#address-cells = <1>;
286		#size-cells = <0>;
287		port@0 {
288			reg = <0>;
289			dw_hdmi0_in: endpoint {
290				remote-endpoint = <&du_out_hdmi0>;
291			};
292		};
293		port@1 {
294			reg = <1>;
295			rcar_dw_hdmi0_out: endpoint {
296				remote-endpoint = <&hdmi0_con>;
297			};
298		};
299		port@2 {
300			reg = <2>;
301			dw_hdmi0_snd_in: endpoint {
302				remote-endpoint = <&rsnd_endpoint1>;
303			};
304		};
305	};
306};
307
308&hscif1 {
309	pinctrl-0 = <&hscif1_pins>;
310	pinctrl-names = "default";
311	uart-has-rtscts;
312	status = "okay";
313};
314
315&hsusb {
316	dr_mode = "otg";
317	status = "okay";
318};
319
320&i2c2 {
321	status = "okay";
322	clock-frequency = <100000>;
323	pinctrl-0 = <&i2c2_pins>;
324	pinctrl-names = "default";
325
326	gpio_exp2: gpio@21 {
327		compatible = "onnn,pca9654";
328		reg = <0x21>;
329		gpio-controller;
330		#gpio-cells = <2>;
331	};
332
333	gpio_exp3: gpio@22 {
334		compatible = "onnn,pca9654";
335		reg = <0x22>;
336		gpio-controller;
337		#gpio-cells = <2>;
338	};
339
340	gpio_exp4: gpio@23 {
341		compatible = "onnn,pca9654";
342		reg = <0x23>;
343		gpio-controller;
344		#gpio-cells = <2>;
345	};
346
347	versaclock6_bb: clock-controller@6a {
348		compatible = "idt,5p49v6965";
349		reg = <0x6a>;
350		#clock-cells = <1>;
351		clocks = <&x304_clk>;
352		clock-names = "xin";
353		/* CSI0_MCLK, CSI1_MCLK, AUDIO_CLKIN, USB_HUB_MCLK_BB */
354		assigned-clocks = <&versaclock6_bb 1>,
355				   <&versaclock6_bb 2>,
356				   <&versaclock6_bb 3>,
357				   <&versaclock6_bb 4>;
358		assigned-clock-rates =	<24000000>, <24000000>, <24000000>, <24576000>;
359	};
360};
361
362&i2c0 {
363	status = "okay";
364	clock-frequency = <400000>;
365
366	pinctrl-0 = <&i2c0_pins>;
367	pinctrl-names = "default";
368};
369
370&i2c5 {
371	status = "okay";
372	clock-frequency = <100000>;
373	pinctrl-0 = <&i2c5_pins>;
374	pinctrl-names = "default";
375
376	codec: wm8962@1a {
377		compatible = "wlf,wm8962";
378		reg = <0x1a>;
379		DCVDD-supply = <&reg_audio>;
380		DBVDD-supply = <&reg_audio>;
381		AVDD-supply = <&reg_audio>;
382		CPVDD-supply = <&reg_audio>;
383		MICVDD-supply = <&reg_audio>;
384		PLLVDD-supply = <&reg_audio>;
385		SPKVDD1-supply = <&reg_audio>;
386		SPKVDD2-supply = <&reg_audio>;
387		gpio-cfg = <
388			0x0000 /* 0:Default */
389			0x0000 /* 1:Default */
390			0x0000 /* 2:Default */
391			0x0000 /* 3:Default */
392			0x0000 /* 4:Default */
393			0x0000 /* 5:Default */
394		>;
395		port {
396			wm8962_endpoint: endpoint {
397				remote-endpoint = <&rsnd_endpoint0>;
398			};
399		};
400	};
401
402	/* 0 - lcd_reset */
403	/* 1 - lcd_pwr */
404	/* 2 - lcd_select */
405	/* 3 - backlight-enable */
406	/* 4 - Touch_shdwn */
407	/* 5 - LCD_H_pol */
408	/* 6 - lcd_V_pol */
409	gpio_exp1: gpio@20 {
410		compatible = "onnn,pca9654";
411		reg = <0x20>;
412		gpio-controller;
413		#gpio-cells = <2>;
414	};
415
416	touchscreen@26 {
417		compatible = "ilitek,ili2117";
418		reg = <0x26>;
419		interrupt-parent = <&gpio5>;
420		interrupts = <9 IRQ_TYPE_EDGE_RISING>;
421		wakeup-source;
422	};
423
424	hd3ss3220@47 {
425		compatible = "ti,hd3ss3220";
426		reg = <0x47>;
427		interrupt-parent = <&gpio6>;
428		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
429
430		connector {
431			compatible = "usb-c-connector";
432			label = "USB-C";
433			data-role = "dual";
434
435			ports {
436				#address-cells = <1>;
437				#size-cells = <0>;
438
439				port@1 {
440					reg = <1>;
441					hd3ss3220_ep: endpoint {
442						remote-endpoint = <&usb3_role_switch>;
443					};
444				};
445			};
446		};
447	};
448};
449
450&lvds0 {
451	status = "okay";
452
453	ports {
454		port@1 {
455			lvds0_out: endpoint {
456				remote-endpoint = <&panel_in>;
457			};
458		};
459	};
460};
461
462&ohci0 {
463	dr_mode = "otg";
464	status = "okay";
465};
466
467&ohci1 {
468	status = "okay";
469};
470
471&pciec0 {
472	status = "okay";
473};
474
475&pciec1 {
476	status = "okay";
477};
478
479&pcie_bus_clk {
480	clock-frequency = <100000000>;
481};
482
483&pfc {
484	can0_pins: can0 {
485		groups = "can0_data_a";
486		function = "can0";
487	};
488
489	can1_pins: can1 {
490		groups = "can1_data";
491		function = "can1";
492	};
493
494	du_pins: du {
495		groups = "du_rgb888", "du_sync", "du_clk_out_1", "du_disp";
496		function = "du";
497	};
498
499	i2c2_pins: i2c2 {
500		groups = "i2c2_a";
501		function = "i2c2";
502	};
503
504	i2c5_pins: i2c5 {
505		groups = "i2c5";
506		function = "i2c5";
507	};
508
509	led_pins: leds {
510		/* GP_0_4 , AVS1, AVS2, GP_7_3 */
511		pins = "GP_0_4", "GP_7_0", "GP_7_1", "GP_7_3";
512		bias-pull-down;
513	};
514
515	pwm0_pins: pwm0 {
516		groups = "pwm0";
517		function = "pwm0";
518	};
519
520	pwm2_pins: pwm2 {
521		groups = "pwm2_a";
522		function = "pwm2_a";
523	};
524
525	sdhi0_pins: sd0 {
526		groups = "sdhi0_data4", "sdhi0_ctrl";
527		function = "sdhi0";
528		power-source = <3300>;
529	};
530
531	sdhi0_pins_uhs: sd0_uhs {
532		groups = "sdhi0_data4", "sdhi0_ctrl";
533		function = "sdhi0";
534		power-source = <1800>;
535	};
536
537	sound_pins: sound {
538		groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
539		function = "ssi";
540	};
541
542	sound_clk_pins: sound_clk {
543		groups = "audio_clk_a_a";
544		function = "audio_clk";
545	};
546
547	usb0_pins: usb0 {
548		mux {
549			groups = "usb0";
550			function = "usb0";
551		};
552	};
553
554	usb1_pins: usb1 {
555		mux {
556			groups = "usb1";
557			function = "usb1";
558		};
559	};
560
561	usb30_pins: usb30 {
562		mux {
563			groups = "usb30";
564			function = "usb30";
565		};
566	};
567};
568
569&pwm0 {
570	pinctrl-0 = <&pwm0_pins>;
571	pinctrl-names = "default";
572	status = "okay";
573};
574
575&pwm2 {
576	pinctrl-0 = <&pwm2_pins>;
577	pinctrl-names = "default";
578	status = "okay";
579};
580
581&rcar_sound {
582	pinctrl-0 = <&sound_pins &sound_clk_pins>;
583	pinctrl-names = "default";
584
585	/* Single DAI */
586	#sound-dai-cells = <0>;
587
588	/* audio_clkout0/1/2/3 */
589	#clock-cells = <1>;
590	clock-frequency = <11289600>;
591
592	status = "okay";
593
594	clocks = <&cpg CPG_MOD 1005>,
595		 <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
596		 <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
597		 <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
598		 <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
599		 <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
600		 <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
601		 <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
602		 <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
603		 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
604		 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
605		 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
606		 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
607		 <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
608		 <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>,
609		 <&cpg CPG_CORE R8A774A1_CLK_S0D4>;
610
611	ports {
612		#address-cells = <1>;
613		#size-cells = <0>;
614		rsnd_port0: port@0 {
615			reg = <0>;
616			rsnd_endpoint0: endpoint {
617				remote-endpoint = <&wm8962_endpoint>;
618
619				dai-format = "i2s";
620				bitclock-master = <&rsnd_endpoint0>;
621				frame-master = <&rsnd_endpoint0>;
622
623				playback = <&ssi1 &dvc1 &src1>;
624				capture = <&ssi0>;
625			};
626		};
627		rsnd_port1: port@1 {
628		    reg = <0x01>;
629			rsnd_endpoint1: endpoint {
630				remote-endpoint = <&dw_hdmi0_snd_in>;
631
632				dai-format = "i2s";
633				bitclock-master = <&rsnd_endpoint1>;
634				frame-master = <&rsnd_endpoint1>;
635
636				playback = <&ssi2>;
637			};
638		};
639	};
640};
641
642&rwdt {
643	status = "okay";
644	timeout-sec = <60>;
645};
646
647&scif0 {
648	pinctrl-0 = <&scif0_pins>;
649	pinctrl-names = "default";
650	status = "okay";
651};
652
653&scif5 {
654	pinctrl-0 = <&scif5_pins>;
655	pinctrl-names = "default";
656	status = "okay";
657};
658
659&scif_clk {
660	clock-frequency = <14745600>;
661};
662
663&sdhi0 {
664	pinctrl-0 = <&sdhi0_pins>;
665	pinctrl-1 = <&sdhi0_pins_uhs>;
666	pinctrl-names = "default", "state_uhs";
667	vmmc-supply = <&reg_3p3v>;
668	vqmmc-supply = <&vccq_sdhi0>;
669	cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
670	bus-width = <4>;
671	sd-uhs-sdr50;
672	sd-uhs-sdr104;
673	status = "okay";
674};
675
676&ssi1 {
677	shared-pin;
678};
679
680&tmu0 {
681	status = "okay";
682};
683
684&tmu1 {
685	status = "okay";
686};
687
688&tmu2 {
689	status = "okay";
690};
691
692&tmu3 {
693	status = "okay";
694};
695
696&tmu4 {
697	status = "okay";
698};
699
700&usb2_phy0 {
701	pinctrl-0 = <&usb0_pins>;
702	pinctrl-names = "default";
703	status = "okay";
704};
705
706&usb2_phy1 {
707	pinctrl-0 = <&usb1_pins>;
708	pinctrl-names = "default";
709	status = "okay";
710};
711
712&usb3_peri0 {
713	companion = <&xhci0>;
714	status = "okay";
715	usb-role-switch;
716
717	port {
718		usb3_role_switch: endpoint {
719			remote-endpoint = <&hd3ss3220_ep>;
720		};
721	};
722};
723
724&usb3_phy0 {
725	status = "okay";
726};
727
728&vin0 {
729	status = "okay";
730};
731&vin1 {
732	status = "okay";
733};
734&vin2 {
735	status = "okay";
736};
737&vin3 {
738	status = "okay";
739};
740&vin4 {
741	status = "okay";
742};
743&vin5 {
744	status = "okay";
745};
746&vin6 {
747	status = "okay";
748};
749&vin7 {
750	status = "okay";
751};
752
753&xhci0
754{
755	pinctrl-0 = <&usb30_pins>;
756	pinctrl-names = "default";
757	status = "okay";
758};
759