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