1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2/*
3 * Device Tree Source for the R-Car V4M Gray Hawk Single board
4 *
5 * Copyright (C) 2023 Renesas Electronics Corp.
6 * Copyright (C) 2024 Glider bv
7 */
8/*
9 * [How to use Sound]
10 *
11 * Because R-Car V4M has only 1 SSI, it cannot handle both Playback/Capture
12 * at the same time. You need to switch the direction which is controlled
13 * by the GP0_01 pin via amixer.
14 *
15 * Playback (CN9500)
16 *	> amixer set "MUX" "Playback"	// for GP0_01
17 *	> amixer set "DAC 1" 85%
18 *	> aplay xxx.wav
19 *
20 * Capture (CN9501)
21 *	> amixer set "MUX" "Capture"	// for GP0_01
22 *	> amixer set "Mic 1" 80%
23 *	> amixer set "ADC 1" on
24 *	> amixer set 'ADC 1' 80%
25 *	> arecord xxx hoge.wav
26 */
27
28/dts-v1/;
29
30#include <dt-bindings/gpio/gpio.h>
31#include <dt-bindings/input/input.h>
32#include <dt-bindings/leds/common.h>
33#include <dt-bindings/media/video-interfaces.h>
34
35#include "r8a779h0.dtsi"
36
37/ {
38	model = "Renesas Gray Hawk Single board based on r8a779h0";
39	compatible = "renesas,gray-hawk-single", "renesas,r8a779h0";
40
41	aliases {
42		i2c0 = &i2c0;
43		i2c1 = &i2c1;
44		i2c2 = &i2c2;
45		i2c3 = &i2c3;
46		serial0 = &hscif0;
47		serial1 = &hscif2;
48		ethernet0 = &avb0;
49	};
50
51	can_transceiver0: can-phy0 {
52		compatible = "nxp,tjr1443";
53		#phy-cells = <0>;
54		enable-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
55		max-bitrate = <5000000>;
56	};
57
58	chosen {
59		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
60		stdout-path = "serial0:921600n8";
61	};
62
63	sn65dsi86_refclk: clk-x6 {
64		compatible = "fixed-clock";
65		#clock-cells = <0>;
66		clock-frequency = <38400000>;
67	};
68
69	keys {
70		compatible = "gpio-keys";
71
72		pinctrl-0 = <&keys_pins>;
73		pinctrl-names = "default";
74
75		key-1 {
76			gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
77			linux,code = <KEY_1>;
78			label = "SW47";
79			wakeup-source;
80			debounce-interval = <20>;
81		};
82
83		key-2 {
84			gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
85			linux,code = <KEY_2>;
86			label = "SW48";
87			wakeup-source;
88			debounce-interval = <20>;
89		};
90
91		key-3 {
92			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
93			linux,code = <KEY_3>;
94			label = "SW49";
95			wakeup-source;
96			debounce-interval = <20>;
97		};
98	};
99
100	leds {
101		compatible = "gpio-leds";
102
103		led-1 {
104			gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
105			color = <LED_COLOR_ID_GREEN>;
106			function = LED_FUNCTION_INDICATOR;
107			function-enumerator = <1>;
108		};
109
110		led-2 {
111			gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
112			color = <LED_COLOR_ID_GREEN>;
113			function = LED_FUNCTION_INDICATOR;
114			function-enumerator = <2>;
115		};
116
117		led-3 {
118			gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>;
119			color = <LED_COLOR_ID_GREEN>;
120			function = LED_FUNCTION_INDICATOR;
121			function-enumerator = <3>;
122		};
123	};
124
125	memory@48000000 {
126		device_type = "memory";
127		/* first 128MB is reserved for secure area. */
128		reg = <0x0 0x48000000 0x0 0x78000000>;
129	};
130
131	memory@480000000 {
132		device_type = "memory";
133		reg = <0x4 0x80000000 0x1 0x80000000>;
134	};
135
136	pcie_clk: clk-9fgv0841-pci {
137		compatible = "fixed-clock";
138		clock-frequency = <100000000>;
139		#clock-cells = <0>;
140	};
141
142	mini-dp-con {
143		compatible = "dp-connector";
144		label = "CN5";
145		type = "mini";
146
147		port {
148			mini_dp_con_in: endpoint {
149				remote-endpoint = <&sn65dsi86_out0>;
150			};
151		};
152	};
153
154	reg_1p2v: regulator-1p2v {
155		compatible = "regulator-fixed";
156		regulator-name = "fixed-1.2V";
157		regulator-min-microvolt = <1200000>;
158		regulator-max-microvolt = <1200000>;
159		regulator-boot-on;
160		regulator-always-on;
161	};
162
163	reg_1p8v: regulator-1p8v {
164		compatible = "regulator-fixed";
165		regulator-name = "fixed-1.8V";
166		regulator-min-microvolt = <1800000>;
167		regulator-max-microvolt = <1800000>;
168		regulator-boot-on;
169		regulator-always-on;
170	};
171
172	reg_3p3v: regulator-3p3v {
173		compatible = "regulator-fixed";
174		regulator-name = "fixed-3.3V";
175		regulator-min-microvolt = <3300000>;
176		regulator-max-microvolt = <3300000>;
177		regulator-boot-on;
178		regulator-always-on;
179	};
180
181	sound_mux: sound-mux {
182		compatible = "simple-audio-mux";
183		mux-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
184		state-labels = "Playback", "Capture";
185	};
186
187	sound_card: sound {
188		compatible = "audio-graph-card2";
189		label = "rcar-sound";
190		aux-devs = <&sound_mux>; // for GP0_01
191
192		links = <&rsnd_port>; // AK4619 Audio Codec
193	};
194};
195
196&audio_clkin {
197	clock-frequency = <24576000>;
198};
199
200&avb0 {
201	pinctrl-0 = <&avb0_pins>;
202	pinctrl-names = "default";
203	phy-handle = <&phy0>;
204	tx-internal-delay-ps = <2000>;
205	status = "okay";
206
207	phy0: ethernet-phy@0 {
208		compatible = "ethernet-phy-id0022.1622",
209			     "ethernet-phy-ieee802.3-c22";
210		rxc-skew-ps = <1500>;
211		reg = <0>;
212		interrupts-extended = <&gpio7 5 IRQ_TYPE_LEVEL_LOW>;
213		reset-gpios = <&gpio7 10 GPIO_ACTIVE_LOW>;
214	};
215};
216
217&can_clk {
218	clock-frequency = <40000000>;
219};
220
221&canfd {
222	pinctrl-0 = <&canfd0_pins>, <&canfd1_pins>, <&can_clk_pins>;
223	pinctrl-names = "default";
224	status = "okay";
225
226	channel0 {
227		status = "okay";
228		phys = <&can_transceiver0>;
229	};
230
231	channel1 {
232		status = "okay";
233	};
234};
235
236&dsi0 {
237	status = "okay";
238
239	ports {
240		port@1 {
241			reg = <1>;
242
243			dsi0_out: endpoint {
244				remote-endpoint = <&sn65dsi86_in0>;
245				data-lanes = <1 2 3 4>;
246			};
247		};
248	};
249};
250
251&du {
252	status = "okay";
253};
254
255&csi40 {
256	status = "okay";
257
258	ports {
259		#address-cells = <1>;
260		#size-cells = <0>;
261
262		port@0 {
263			reg = <0>;
264
265			csi40_in: endpoint {
266				bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
267				clock-lanes = <0>;
268				data-lanes = <1 2 3 4>;
269				remote-endpoint = <&max96724_out0>;
270			};
271		};
272	};
273};
274
275&csi41 {
276	status = "okay";
277
278	ports {
279		#address-cells = <1>;
280		#size-cells = <0>;
281
282		port@0 {
283			reg = <0>;
284
285			csi41_in: endpoint {
286				bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
287				clock-lanes = <0>;
288				data-lanes = <1 2 3 4>;
289				remote-endpoint = <&max96724_out1>;
290			};
291		};
292	};
293};
294
295&extal_clk {
296	clock-frequency = <16666666>;
297};
298
299&extalr_clk {
300	clock-frequency = <32768>;
301};
302
303&gpio1 {
304	audio-power-hog {
305		gpio-hog;
306		gpios = <8 GPIO_ACTIVE_HIGH>;
307		output-high;
308		line-name = "Audio-Power";
309	};
310};
311
312&hscif0 {
313	pinctrl-0 = <&hscif0_pins>;
314	pinctrl-names = "default";
315
316	uart-has-rtscts;
317	status = "okay";
318};
319
320&hscif2 {
321	pinctrl-0 = <&hscif2_pins>;
322	pinctrl-names = "default";
323
324	uart-has-rtscts;
325	status = "okay";
326};
327
328&i2c0 {
329	pinctrl-0 = <&i2c0_pins>;
330	pinctrl-names = "default";
331
332	status = "okay";
333	clock-frequency = <400000>;
334
335	io_expander_a: gpio@20 {
336		compatible = "onnn,pca9654";
337		reg = <0x20>;
338		interrupts-extended = <&gpio0 0 IRQ_TYPE_LEVEL_LOW>;
339		gpio-controller;
340		#gpio-cells = <2>;
341		interrupt-controller;
342		#interrupt-cells = <2>;
343	};
344
345	io_expander_b: gpio@21 {
346		compatible = "onnn,pca9654";
347		reg = <0x21>;
348		gpio-controller;
349		#gpio-cells = <2>;
350	};
351
352	io_expander_c: gpio@22 {
353		compatible = "onnn,pca9654";
354		reg = <0x22>;
355		gpio-controller;
356		#gpio-cells = <2>;
357	};
358
359	eeprom@50 {
360		compatible = "rohm,br24g01", "atmel,24c01";
361		label = "cpu-board";
362		reg = <0x50>;
363		pagesize = <8>;
364	};
365
366	eeprom@51 {
367		compatible = "rohm,br24g01", "atmel,24c01";
368		label = "breakout-board";
369		reg = <0x51>;
370		pagesize = <8>;
371	};
372
373	eeprom@52 {
374		compatible = "rohm,br24g01", "atmel,24c01";
375		label = "csi-dsi-sub-board-id";
376		reg = <0x52>;
377		pagesize = <8>;
378	};
379
380	eeprom@53 {
381		compatible = "rohm,br24g01", "atmel,24c01";
382		label = "ethernet-sub-board-id";
383		reg = <0x53>;
384		pagesize = <8>;
385	};
386};
387
388&i2c1 {
389	pinctrl-0 = <&i2c1_pins>;
390	pinctrl-names = "default";
391
392	status = "okay";
393	clock-frequency = <400000>;
394
395	bridge@2c {
396		pinctrl-0 = <&irq0_pins>;
397		pinctrl-names = "default";
398
399		compatible = "ti,sn65dsi86";
400		reg = <0x2c>;
401
402		clocks = <&sn65dsi86_refclk>;
403		clock-names = "refclk";
404
405		interrupts-extended = <&intc_ex 0 IRQ_TYPE_LEVEL_HIGH>;
406
407		enable-gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
408
409		vccio-supply = <&reg_1p8v>;
410		vpll-supply = <&reg_1p8v>;
411		vcca-supply = <&reg_1p2v>;
412		vcc-supply = <&reg_1p2v>;
413
414		ports {
415			#address-cells = <1>;
416			#size-cells = <0>;
417
418			port@0 {
419				reg = <0>;
420
421				sn65dsi86_in0: endpoint {
422					remote-endpoint = <&dsi0_out>;
423				};
424			};
425
426			port@1 {
427				reg = <1>;
428
429				sn65dsi86_out0: endpoint {
430					remote-endpoint = <&mini_dp_con_in>;
431				};
432			};
433		};
434	};
435
436	gmsl0: gmsl-deserializer@4e {
437		compatible = "maxim,max96724";
438		reg = <0x4e>;
439		enable-gpios = <&io_expander_b 0 GPIO_ACTIVE_HIGH>;
440
441		ports {
442			#address-cells = <1>;
443			#size-cells = <0>;
444
445			port@4 {
446				reg = <4>;
447				max96724_out0: endpoint {
448					bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
449					clock-lanes = <0>;
450					data-lanes = <1 2 3 4>;
451					remote-endpoint = <&csi40_in>;
452				};
453			};
454		};
455	};
456
457	gmsl1: gmsl-deserializer@4f {
458		compatible = "maxim,max96724";
459		reg = <0x4f>;
460		enable-gpios = <&io_expander_c 0 GPIO_ACTIVE_HIGH>;
461
462		ports {
463			#address-cells = <1>;
464			#size-cells = <0>;
465
466			port@4 {
467				reg = <4>;
468				max96724_out1: endpoint {
469					bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>;
470					clock-lanes = <0>;
471					data-lanes = <1 2 3 4>;
472					remote-endpoint = <&csi41_in>;
473				};
474			};
475		};
476	};
477};
478
479&i2c3 {
480	pinctrl-0 = <&i2c3_pins>;
481	pinctrl-names = "default";
482
483	status = "okay";
484	clock-frequency = <400000>;
485
486	codec@10 {
487		compatible = "asahi-kasei,ak4619";
488		reg = <0x10>;
489
490		clocks = <&rcar_sound>;
491		clock-names = "mclk";
492
493		#sound-dai-cells = <0>;
494		port {
495			ak4619_endpoint: endpoint {
496				remote-endpoint = <&rsnd_endpoint>;
497			};
498		};
499	};
500};
501
502&isp0 {
503	status = "okay";
504};
505
506&isp1 {
507	status = "okay";
508};
509
510&mmc0 {
511	pinctrl-0 = <&mmc_pins>;
512	pinctrl-1 = <&mmc_pins>;
513	pinctrl-names = "default", "state_uhs";
514
515	vmmc-supply = <&reg_3p3v>;
516	vqmmc-supply = <&reg_1p8v>;
517	mmc-hs200-1_8v;
518	mmc-hs400-1_8v;
519	bus-width = <8>;
520	no-sd;
521	no-sdio;
522	non-removable;
523	full-pwr-cycle-in-suspend;
524	status = "okay";
525};
526
527&pcie0_clkref {
528	compatible = "gpio-gate-clock";
529	clocks = <&pcie_clk>;
530	enable-gpios = <&gpio4 21 GPIO_ACTIVE_LOW>;
531	/delete-property/ clock-frequency;
532};
533
534&pciec0 {
535	reset-gpios = <&io_expander_a 0 GPIO_ACTIVE_LOW>;
536	status = "okay";
537};
538
539&pfc {
540	pinctrl-0 = <&scif_clk_pins>, <&scif_clk2_pins>;
541	pinctrl-names = "default";
542
543	avb0_pins: avb0 {
544		mux {
545			groups = "avb0_link", "avb0_mdio", "avb0_rgmii",
546				 "avb0_txcrefclk";
547			function = "avb0";
548		};
549
550		pins_mdio {
551			groups = "avb0_mdio";
552			drive-strength = <21>;
553		};
554
555		pins_mii {
556			groups = "avb0_rgmii";
557			drive-strength = <21>;
558		};
559	};
560
561	can_clk_pins: can-clk {
562		groups = "can_clk";
563		function = "can_clk";
564	};
565
566	canfd0_pins: canfd0 {
567		groups = "canfd0_data";
568		function = "canfd0";
569	};
570
571	canfd1_pins: canfd1 {
572		groups = "canfd1_data";
573		function = "canfd1";
574	};
575
576	hscif0_pins: hscif0 {
577		groups = "hscif0_data", "hscif0_ctrl";
578		function = "hscif0";
579	};
580
581	hscif2_pins: hscif2 {
582		groups = "hscif2_data", "hscif2_ctrl";
583		function = "hscif2";
584	};
585
586	i2c0_pins: i2c0 {
587		groups = "i2c0";
588		function = "i2c0";
589	};
590
591	i2c1_pins: i2c1 {
592		groups = "i2c1";
593		function = "i2c1";
594	};
595
596	i2c3_pins: i2c3 {
597		groups = "i2c3";
598		function = "i2c3";
599	};
600
601	irq0_pins: irq0_pins {
602		groups = "intc_ex_irq0_a";
603		function = "intc_ex";
604	};
605
606	keys_pins: keys {
607		pins = "GP_5_0", "GP_5_1", "GP_5_2";
608		bias-pull-up;
609	};
610
611	mmc_pins: mmc {
612		groups = "mmc_data8", "mmc_ctrl", "mmc_ds";
613		function = "mmc";
614		power-source = <1800>;
615	};
616
617	qspi0_pins: qspi0 {
618		groups = "qspi0_ctrl", "qspi0_data4";
619		function = "qspi0";
620	};
621
622	scif_clk_pins: scif-clk {
623		groups = "scif_clk";
624		function = "scif_clk";
625	};
626
627	scif_clk2_pins: scif-clk2 {
628		groups = "scif_clk2";
629		function = "scif_clk2";
630	};
631
632	sound_clk_pins: sound_clk {
633		groups = "audio_clkin", "audio_clkout";
634		function = "audio_clk";
635	};
636
637	sound_pins: sound {
638		groups = "ssi_ctrl", "ssi_data";
639		function = "ssi";
640	};
641};
642
643&rcar_sound {
644	pinctrl-0 = <&sound_clk_pins>, <&sound_pins>;
645	pinctrl-names = "default";
646
647	status = "okay";
648
649	/* audio_clkout */
650	clock-frequency = <12288000>;
651
652	ports {
653		rsnd_port: port {
654			rsnd_endpoint: endpoint {
655				remote-endpoint = <&ak4619_endpoint>;
656				bitclock-master;
657				frame-master;
658
659				/* see above [How to use Sound] */
660				playback = <&ssi0>;
661				capture  = <&ssi0>;
662			};
663		};
664	};
665};
666
667&rpc {
668	pinctrl-0 = <&qspi0_pins>;
669	pinctrl-names = "default";
670
671	status = "okay";
672
673	flash@0 {
674		compatible = "spansion,s25fs512s", "jedec,spi-nor";
675		reg = <0>;
676		spi-max-frequency = <40000000>;
677		spi-rx-bus-width = <4>;
678
679		partitions {
680			compatible = "fixed-partitions";
681			#address-cells = <1>;
682			#size-cells = <1>;
683
684			boot@0 {
685				reg = <0x0 0x1200000>;
686				read-only;
687			};
688			user@1200000 {
689				reg = <0x1200000 0x2e00000>;
690			};
691		};
692	};
693};
694
695&rwdt {
696	timeout-sec = <60>;
697	status = "okay";
698};
699
700&scif_clk {
701	clock-frequency = <24000000>;
702};
703
704&scif_clk2 {
705	clock-frequency = <24000000>;
706};
707
708&vin00 {
709	status = "okay";
710};
711
712&vin01 {
713	status = "okay";
714};
715
716&vin02 {
717	status = "okay";
718};
719
720&vin03 {
721	status = "okay";
722};
723
724&vin04 {
725	status = "okay";
726};
727
728&vin05 {
729	status = "okay";
730};
731
732&vin06 {
733	status = "okay";
734};
735
736&vin07 {
737	status = "okay";
738};
739
740&vin08 {
741	status = "okay";
742};
743
744&vin09 {
745	status = "okay";
746};
747
748&vin10 {
749	status = "okay";
750};
751
752&vin11 {
753	status = "okay";
754};
755
756&vin12 {
757	status = "okay";
758};
759
760&vin13 {
761	status = "okay";
762};
763
764&vin14 {
765	status = "okay";
766};
767
768&vin15 {
769	status = "okay";
770};
771