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_HIGH>;
14		pwms = <&pwm2 0 25000>;
15		brightness-levels = <0 4 8 16 32 64 128 255>;
16		default-brightness-level = <6>;
17	};
18
19	backlight_dpi: backlight-dpi {
20		compatible = "pwm-backlight";
21		power-supply = <&reg_lcd>;
22		enable-gpios = <&gpio_exp1 7 GPIO_ACTIVE_LOW>;
23		pwms = <&pwm0 0 25000>;
24		brightness-levels = <0 25 33 50 63 75 88 100>;
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 = <1>;
122			hsync-active = <1>;
123			vsync-active = <3>;
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_dpi>;
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_exp4 1 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	connector {
228		compatible = "usb-c-connector";
229		label = "USB-C";
230		data-role = "dual";
231
232		ports {
233			#address-cells = <1>;
234			#size-cells = <0>;
235			port@0 {
236				reg = <0>;
237				hs_ep: endpoint {
238					remote-endpoint = <&usb3_hs_ep>;
239				};
240			};
241			port@1 {
242				reg = <1>;
243				ss_ep: endpoint {
244					remote-endpoint = <&hd3ss3220_in_ep>;
245				};
246			};
247		};
248	};
249};
250
251&audio_clk_a {
252	clock-frequency = <24576000>;
253	assigned-clocks = <&versaclock6_bb 4>;
254	assigned-clock-rates = <24576000>;
255};
256
257&audio_clk_b {
258	clock-frequency = <22579200>;
259};
260
261&can0 {
262	pinctrl-0 = <&can0_pins>;
263	pinctrl-names = "default";
264	renesas,can-clock-select = <0x0>;
265	status = "okay";
266};
267
268&can1 {
269	pinctrl-0 = <&can1_pins>;
270	pinctrl-names = "default";
271	renesas,can-clock-select = <0x0>;
272	status = "okay";
273};
274
275&du {
276	pinctrl-0 = <&du_pins>;
277	pinctrl-names = "default";
278	status = "okay";
279
280	clocks = <&cpg CPG_MOD 724>,
281		<&cpg CPG_MOD 723>,
282		<&cpg CPG_MOD 722>,
283		<&versaclock5 1>,
284		<&x302_clk>,
285		<&versaclock5 2>;
286	clock-names = "du.0", "du.1", "du.2",
287		"dclkin.0", "dclkin.1", "dclkin.2";
288};
289
290&du_out_rgb {
291	remote-endpoint = <&rgb_panel>;
292};
293
294&ehci0 {
295	dr_mode = "otg";
296	status = "okay";
297	clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
298};
299
300&ehci1 {
301	status = "okay";
302	clocks = <&cpg CPG_MOD 703>, <&cpg CPG_MOD 704>;
303};
304
305&hdmi0 {
306	status = "okay";
307	ports {
308		#address-cells = <1>;
309		#size-cells = <0>;
310		port@0 {
311			reg = <0>;
312			dw_hdmi0_in: endpoint {
313				remote-endpoint = <&du_out_hdmi0>;
314			};
315		};
316		port@1 {
317			reg = <1>;
318			rcar_dw_hdmi0_out: endpoint {
319				remote-endpoint = <&hdmi0_con>;
320			};
321		};
322		port@2 {
323			reg = <2>;
324			dw_hdmi0_snd_in: endpoint {
325				remote-endpoint = <&rsnd_endpoint1>;
326			};
327		};
328	};
329};
330
331&hscif1 {
332	pinctrl-0 = <&hscif1_pins>;
333	pinctrl-names = "default";
334	uart-has-rtscts;
335	status = "okay";
336};
337
338&hsusb {
339	dr_mode = "otg";
340	status = "okay";
341};
342
343&i2c2 {
344	status = "okay";
345	clock-frequency = <100000>;
346	pinctrl-0 = <&i2c2_pins>;
347	pinctrl-names = "default";
348
349	gpio_exp2: gpio@21 {
350		compatible = "onnn,pca9654";
351		reg = <0x21>;
352		gpio-controller;
353		#gpio-cells = <2>;
354	};
355
356	gpio_exp3: gpio@22 {
357		compatible = "onnn,pca9654";
358		reg = <0x22>;
359		gpio-controller;
360		#gpio-cells = <2>;
361	};
362
363	gpio_exp4: gpio@23 {
364		compatible = "onnn,pca9654";
365		reg = <0x23>;
366		gpio-controller;
367		#gpio-cells = <2>;
368	};
369
370	versaclock6_bb: clock-controller@6a {
371		compatible = "idt,5p49v6965";
372		reg = <0x6a>;
373		#clock-cells = <1>;
374		clocks = <&x304_clk>;
375		clock-names = "xin";
376		/* CSI0_MCLK, CSI1_MCLK, AUDIO_CLKIN, USB_HUB_MCLK_BB */
377		assigned-clocks = <&versaclock6_bb 1>,
378				   <&versaclock6_bb 2>,
379				   <&versaclock6_bb 3>,
380				   <&versaclock6_bb 4>;
381		assigned-clock-rates =	<24000000>, <24000000>, <24000000>, <24576000>;
382	};
383};
384
385&i2c0 {
386	status = "okay";
387	clock-frequency = <400000>;
388
389	pinctrl-0 = <&i2c0_pins>;
390	pinctrl-names = "default";
391};
392
393&i2c5 {
394	status = "okay";
395	clock-frequency = <100000>;
396	pinctrl-0 = <&i2c5_pins>;
397	pinctrl-names = "default";
398
399	codec: wm8962@1a {
400		compatible = "wlf,wm8962";
401		reg = <0x1a>;
402		DCVDD-supply = <&reg_audio>;
403		DBVDD-supply = <&reg_audio>;
404		AVDD-supply = <&reg_audio>;
405		CPVDD-supply = <&reg_audio>;
406		MICVDD-supply = <&reg_audio>;
407		PLLVDD-supply = <&reg_audio>;
408		SPKVDD1-supply = <&reg_audio>;
409		SPKVDD2-supply = <&reg_audio>;
410		gpio-cfg = <
411			0x0000 /* 0:Default */
412			0x0000 /* 1:Default */
413			0x0000 /* 2:Default */
414			0x0000 /* 3:Default */
415			0x0000 /* 4:Default */
416			0x0000 /* 5:Default */
417		>;
418		port {
419			wm8962_endpoint: endpoint {
420				remote-endpoint = <&rsnd_endpoint0>;
421			};
422		};
423	};
424
425	/* 0 - lcd_reset */
426	/* 1 - lcd_pwr */
427	/* 2 - lcd_select */
428	/* 3 - backlight-enable */
429	/* 4 - Touch_shdwn */
430	/* 5 - LCD_H_pol */
431	/* 6 - lcd_V_pol */
432	gpio_exp1: gpio@20 {
433		compatible = "onnn,pca9654";
434		reg = <0x20>;
435		gpio-controller;
436		#gpio-cells = <2>;
437	};
438
439	touchscreen@26 {
440		compatible = "ilitek,ili2117";
441		reg = <0x26>;
442		interrupt-parent = <&gpio5>;
443		interrupts = <9 IRQ_TYPE_EDGE_RISING>;
444		wakeup-source;
445	};
446
447	hd3ss3220@47 {
448		compatible = "ti,hd3ss3220";
449		reg = <0x47>;
450		interrupt-parent = <&gpio6>;
451		interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
452
453		ports {
454			#address-cells = <1>;
455			#size-cells = <0>;
456			port@0 {
457				reg = <0>;
458				hd3ss3220_in_ep: endpoint {
459					remote-endpoint = <&ss_ep>;
460				};
461			};
462			port@1 {
463				reg = <1>;
464				hd3ss3220_out_ep: endpoint {
465					remote-endpoint = <&usb3_role_switch>;
466				};
467			};
468		};
469	};
470};
471
472&lvds0 {
473	status = "okay";
474
475	ports {
476		port@1 {
477			lvds0_out: endpoint {
478				remote-endpoint = <&panel_in>;
479			};
480		};
481	};
482};
483
484&ohci0 {
485	dr_mode = "otg";
486	status = "okay";
487};
488
489&ohci1 {
490	status = "okay";
491};
492
493&pciec0 {
494	status = "okay";
495};
496
497&pciec1 {
498	status = "okay";
499};
500
501&pcie_bus_clk {
502	clock-frequency = <100000000>;
503};
504
505&pfc {
506	can0_pins: can0 {
507		groups = "can0_data_a";
508		function = "can0";
509	};
510
511	can1_pins: can1 {
512		groups = "can1_data";
513		function = "can1";
514	};
515
516	du_pins: du {
517		groups = "du_rgb888", "du_sync", "du_clk_out_1", "du_disp";
518		function = "du";
519	};
520
521	i2c2_pins: i2c2 {
522		groups = "i2c2_a";
523		function = "i2c2";
524	};
525
526	i2c5_pins: i2c5 {
527		groups = "i2c5";
528		function = "i2c5";
529	};
530
531	led_pins: leds {
532		/* GP_0_4 , AVS1, AVS2, GP_7_3 */
533		pins = "GP_0_4", "GP_7_0", "GP_7_1", "GP_7_3";
534		bias-pull-down;
535	};
536
537	pwm0_pins: pwm0 {
538		groups = "pwm0";
539		function = "pwm0";
540	};
541
542	pwm2_pins: pwm2 {
543		groups = "pwm2_a";
544		function = "pwm2";
545	};
546
547	sdhi0_pins: sd0 {
548		groups = "sdhi0_data4", "sdhi0_ctrl";
549		function = "sdhi0";
550		power-source = <3300>;
551	};
552
553	sdhi0_pins_uhs: sd0_uhs {
554		groups = "sdhi0_data4", "sdhi0_ctrl";
555		function = "sdhi0";
556		power-source = <1800>;
557	};
558
559	sound_pins: sound {
560		groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
561		function = "ssi";
562	};
563
564	sound_clk_pins: sound_clk {
565		groups = "audio_clk_a_a";
566		function = "audio_clk";
567	};
568
569	usb0_pins: usb0 {
570		mux {
571			groups = "usb0";
572			function = "usb0";
573		};
574	};
575
576	usb1_pins: usb1 {
577		mux {
578			groups = "usb1";
579			function = "usb1";
580		};
581	};
582
583	usb30_pins: usb30 {
584		mux {
585			groups = "usb30";
586			function = "usb30";
587		};
588	};
589};
590
591&pwm0 {
592	pinctrl-0 = <&pwm0_pins>;
593	pinctrl-names = "default";
594	status = "okay";
595};
596
597&pwm2 {
598	pinctrl-0 = <&pwm2_pins>;
599	pinctrl-names = "default";
600	status = "okay";
601};
602
603&rcar_sound {
604	pinctrl-0 = <&sound_pins &sound_clk_pins>;
605	pinctrl-names = "default";
606
607	/* Single DAI */
608	#sound-dai-cells = <0>;
609
610	/* audio_clkout0/1/2/3 */
611	#clock-cells = <1>;
612	clock-frequency = <11289600>;
613
614	status = "okay";
615
616	clocks = <&cpg CPG_MOD 1005>,
617		 <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
618		 <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
619		 <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
620		 <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
621		 <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
622		 <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
623		 <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
624		 <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
625		 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
626		 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
627		 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
628		 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
629		 <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
630		 <&audio_clk_a>, <&audio_clk_b>, <&audio_clk_c>,
631		 <&cpg CPG_CORE R8A774A1_CLK_S0D4>;
632
633	ports {
634		#address-cells = <1>;
635		#size-cells = <0>;
636		rsnd_port0: port@0 {
637			reg = <0>;
638			rsnd_endpoint0: endpoint {
639				remote-endpoint = <&wm8962_endpoint>;
640
641				dai-format = "i2s";
642				bitclock-master = <&rsnd_endpoint0>;
643				frame-master = <&rsnd_endpoint0>;
644
645				playback = <&ssi1 &dvc1 &src1>;
646				capture = <&ssi0>;
647			};
648		};
649		rsnd_port1: port@1 {
650		    reg = <0x01>;
651			rsnd_endpoint1: endpoint {
652				remote-endpoint = <&dw_hdmi0_snd_in>;
653
654				dai-format = "i2s";
655				bitclock-master = <&rsnd_endpoint1>;
656				frame-master = <&rsnd_endpoint1>;
657
658				playback = <&ssi2>;
659			};
660		};
661	};
662};
663
664&rwdt {
665	status = "okay";
666	timeout-sec = <60>;
667};
668
669&scif0 {
670	pinctrl-0 = <&scif0_pins>;
671	pinctrl-names = "default";
672	status = "okay";
673};
674
675&scif5 {
676	pinctrl-0 = <&scif5_pins>;
677	pinctrl-names = "default";
678	status = "okay";
679};
680
681&scif_clk {
682	clock-frequency = <14745600>;
683};
684
685&sdhi0 {
686	pinctrl-0 = <&sdhi0_pins>;
687	pinctrl-1 = <&sdhi0_pins_uhs>;
688	pinctrl-names = "default", "state_uhs";
689	vmmc-supply = <&reg_3p3v>;
690	vqmmc-supply = <&vccq_sdhi0>;
691	cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
692	bus-width = <4>;
693	sd-uhs-sdr50;
694	sd-uhs-sdr104;
695	status = "okay";
696};
697
698&ssi1 {
699	shared-pin;
700};
701
702&tmu0 {
703	status = "okay";
704};
705
706&tmu1 {
707	status = "okay";
708};
709
710&tmu2 {
711	status = "okay";
712};
713
714&tmu3 {
715	status = "okay";
716};
717
718&tmu4 {
719	status = "okay";
720};
721
722&usb2_phy0 {
723	pinctrl-0 = <&usb0_pins>;
724	pinctrl-names = "default";
725	status = "okay";
726};
727
728&usb2_phy1 {
729	pinctrl-0 = <&usb1_pins>;
730	pinctrl-names = "default";
731	status = "okay";
732};
733
734&usb3_peri0 {
735	companion = <&xhci0>;
736	status = "okay";
737	usb-role-switch;
738
739	ports {
740		#address-cells = <1>;
741		#size-cells = <0>;
742		port@0 {
743			reg = <0>;
744			usb3_hs_ep: endpoint {
745				remote-endpoint = <&hs_ep>;
746			};
747		};
748		port@1 {
749			reg = <1>;
750			usb3_role_switch: endpoint {
751				remote-endpoint = <&hd3ss3220_out_ep>;
752			};
753		};
754	};
755};
756
757&usb3_phy0 {
758	status = "okay";
759};
760
761&vin0 {
762	status = "okay";
763};
764&vin1 {
765	status = "okay";
766};
767&vin2 {
768	status = "okay";
769};
770&vin3 {
771	status = "okay";
772};
773&vin4 {
774	status = "okay";
775};
776&vin5 {
777	status = "okay";
778};
779&vin6 {
780	status = "okay";
781};
782&vin7 {
783	status = "okay";
784};
785
786&xhci0
787{
788	pinctrl-0 = <&usb30_pins>;
789	pinctrl-names = "default";
790	status = "okay";
791};
792