1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device Tree Source for the Gose board
4 *
5 * Copyright (C) 2014-2015 Renesas Electronics Corporation
6 */
7
8/*
9 * SSI-AK4643
10 *
11 * SW1: 1: AK4643
12 *      2: CN22
13 *      3: ADV7511
14 *
15 * This command is required when Playback/Capture
16 *
17 *	amixer set "LINEOUT Mixer DACL" on
18 *	amixer set "DVC Out" 100%
19 *	amixer set "DVC In" 100%
20 *
21 * You can use Mute
22 *
23 *	amixer set "DVC Out Mute" on
24 *	amixer set "DVC In Mute" on
25 *
26 * You can use Volume Ramp
27 *
28 *	amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
29 *	amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
30 *	amixer set "DVC Out Ramp" on
31 *	aplay xxx.wav &
32 *	amixer set "DVC Out"  80%  // Volume Down
33 *	amixer set "DVC Out" 100%  // Volume Up
34 */
35
36/dts-v1/;
37#include "r8a7793.dtsi"
38#include <dt-bindings/gpio/gpio.h>
39#include <dt-bindings/input/input.h>
40
41/ {
42	model = "Gose";
43	compatible = "renesas,gose", "renesas,r8a7793";
44
45	aliases {
46		serial0 = &scif0;
47		serial1 = &scif1;
48		i2c9 = &gpioi2c2;
49		i2c10 = &gpioi2c4;
50		i2c11 = &i2chdmi;
51		i2c12 = &i2cexio4;
52	};
53
54	chosen {
55		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
56		stdout-path = "serial0:115200n8";
57	};
58
59	memory@40000000 {
60		device_type = "memory";
61		reg = <0 0x40000000 0 0x40000000>;
62	};
63
64	gpio-keys {
65		compatible = "gpio-keys";
66
67		key-1 {
68			gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
69			linux,code = <KEY_1>;
70			label = "SW2-1";
71			wakeup-source;
72			debounce-interval = <20>;
73		};
74		key-2 {
75			gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
76			linux,code = <KEY_2>;
77			label = "SW2-2";
78			wakeup-source;
79			debounce-interval = <20>;
80		};
81		key-3 {
82			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
83			linux,code = <KEY_3>;
84			label = "SW2-3";
85			wakeup-source;
86			debounce-interval = <20>;
87		};
88		key-4 {
89			gpios = <&gpio5 3 GPIO_ACTIVE_LOW>;
90			linux,code = <KEY_4>;
91			label = "SW2-4";
92			wakeup-source;
93			debounce-interval = <20>;
94		};
95		key-a {
96			gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
97			linux,code = <KEY_A>;
98			label = "SW30";
99			wakeup-source;
100			debounce-interval = <20>;
101		};
102		key-b {
103			gpios = <&gpio7 1 GPIO_ACTIVE_LOW>;
104			linux,code = <KEY_B>;
105			label = "SW31";
106			wakeup-source;
107			debounce-interval = <20>;
108		};
109		key-c {
110			gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
111			linux,code = <KEY_C>;
112			label = "SW32";
113			wakeup-source;
114			debounce-interval = <20>;
115		};
116		key-d {
117			gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
118			linux,code = <KEY_D>;
119			label = "SW33";
120			wakeup-source;
121			debounce-interval = <20>;
122		};
123		key-e {
124			gpios = <&gpio7 4 GPIO_ACTIVE_LOW>;
125			linux,code = <KEY_E>;
126			label = "SW34";
127			wakeup-source;
128			debounce-interval = <20>;
129		};
130		key-f {
131			gpios = <&gpio7 5 GPIO_ACTIVE_LOW>;
132			linux,code = <KEY_F>;
133			label = "SW35";
134			wakeup-source;
135			debounce-interval = <20>;
136		};
137		key-g {
138			gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
139			linux,code = <KEY_G>;
140			label = "SW36";
141			wakeup-source;
142			debounce-interval = <20>;
143		};
144	};
145
146	leds {
147		compatible = "gpio-leds";
148		led6 {
149			gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
150			label = "LED6";
151		};
152		led7 {
153			gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
154			label = "LED7";
155		};
156		led8 {
157			gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
158			label = "LED8";
159		};
160	};
161
162	vcc_sdhi0: regulator-vcc-sdhi0 {
163		compatible = "regulator-fixed";
164
165		regulator-name = "SDHI0 Vcc";
166		regulator-min-microvolt = <3300000>;
167		regulator-max-microvolt = <3300000>;
168
169		gpio = <&gpio7 17 GPIO_ACTIVE_HIGH>;
170		enable-active-high;
171	};
172
173	vccq_sdhi0: regulator-vccq-sdhi0 {
174		compatible = "regulator-gpio";
175
176		regulator-name = "SDHI0 VccQ";
177		regulator-min-microvolt = <1800000>;
178		regulator-max-microvolt = <3300000>;
179
180		gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>;
181		gpios-states = <1>;
182		states = <3300000 1>, <1800000 0>;
183	};
184
185	vcc_sdhi1: regulator-vcc-sdhi1 {
186		compatible = "regulator-fixed";
187
188		regulator-name = "SDHI1 Vcc";
189		regulator-min-microvolt = <3300000>;
190		regulator-max-microvolt = <3300000>;
191
192		gpio = <&gpio7 18 GPIO_ACTIVE_HIGH>;
193		enable-active-high;
194	};
195
196	vccq_sdhi1: regulator-vccq-sdhi1 {
197		compatible = "regulator-gpio";
198
199		regulator-name = "SDHI1 VccQ";
200		regulator-min-microvolt = <1800000>;
201		regulator-max-microvolt = <3300000>;
202
203		gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>;
204		gpios-states = <1>;
205		states = <3300000 1>, <1800000 0>;
206	};
207
208	vcc_sdhi2: regulator-vcc-sdhi2 {
209		compatible = "regulator-fixed";
210
211		regulator-name = "SDHI2 Vcc";
212		regulator-min-microvolt = <3300000>;
213		regulator-max-microvolt = <3300000>;
214
215		gpio = <&gpio7 19 GPIO_ACTIVE_HIGH>;
216		enable-active-high;
217	};
218
219	vccq_sdhi2: regulator-vccq-sdhi2 {
220		compatible = "regulator-gpio";
221
222		regulator-name = "SDHI2 VccQ";
223		regulator-min-microvolt = <1800000>;
224		regulator-max-microvolt = <3300000>;
225
226		gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
227		gpios-states = <1>;
228		states = <3300000 1>, <1800000 0>;
229	};
230
231	audio_clock: audio_clock {
232		compatible = "fixed-clock";
233		#clock-cells = <0>;
234		clock-frequency = <11289600>;
235	};
236
237	rsnd_ak4643: sound {
238		compatible = "simple-audio-card";
239
240		simple-audio-card,format = "left_j";
241		simple-audio-card,bitclock-master = <&sndcodec>;
242		simple-audio-card,frame-master = <&sndcodec>;
243
244		sndcpu: simple-audio-card,cpu {
245			sound-dai = <&rcar_sound>;
246		};
247
248		sndcodec: simple-audio-card,codec {
249			sound-dai = <&ak4643>;
250			clocks = <&audio_clock>;
251		};
252	};
253
254	hdmi-in {
255		compatible = "hdmi-connector";
256		type = "a";
257
258		port {
259			hdmi_con_in: endpoint {
260				remote-endpoint = <&adv7612_in>;
261			};
262		};
263	};
264
265	hdmi-out {
266		compatible = "hdmi-connector";
267		type = "a";
268
269		port {
270			hdmi_con_out: endpoint {
271				remote-endpoint = <&adv7511_out>;
272			};
273		};
274	};
275
276	composite-in {
277		compatible = "composite-video-connector";
278
279		port {
280			composite_con_in: endpoint {
281				remote-endpoint = <&adv7180_in>;
282			};
283		};
284	};
285
286	x2_clk: x2-clock {
287		compatible = "fixed-clock";
288		#clock-cells = <0>;
289		clock-frequency = <74250000>;
290	};
291
292	x13_clk: x13-clock {
293		compatible = "fixed-clock";
294		#clock-cells = <0>;
295		clock-frequency = <148500000>;
296	};
297
298	gpioi2c2: i2c-9 {
299		#address-cells = <1>;
300		#size-cells = <0>;
301		compatible = "i2c-gpio";
302		status = "disabled";
303		scl-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
304		sda-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
305		i2c-gpio,delay-us = <5>;
306	};
307
308	gpioi2c4: i2c-10 {
309		#address-cells = <1>;
310		#size-cells = <0>;
311		compatible = "i2c-gpio";
312		status = "disabled";
313		scl-gpios = <&gpio7 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
314		sda-gpios = <&gpio7 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
315		i2c-gpio,delay-us = <5>;
316	};
317
318	/*
319	 * A fallback to GPIO is provided for I2C2.
320	 */
321	i2chdmi: i2c-11 {
322		compatible = "i2c-demux-pinctrl";
323		i2c-parent = <&i2c2>, <&gpioi2c2>;
324		i2c-bus-name = "i2c-hdmi";
325		#address-cells = <1>;
326		#size-cells = <0>;
327
328		ak4643: codec@12 {
329			compatible = "asahi-kasei,ak4643";
330			#sound-dai-cells = <0>;
331			reg = <0x12>;
332		};
333
334		composite-in@20 {
335			compatible = "adi,adv7180cp";
336			reg = <0x20>;
337			remote = <&vin1>;
338
339			port {
340				#address-cells = <1>;
341				#size-cells = <0>;
342
343				port@0 {
344					reg = <0>;
345					adv7180_in: endpoint {
346						remote-endpoint = <&composite_con_in>;
347					};
348				};
349
350				port@3 {
351					reg = <3>;
352					adv7180_out: endpoint {
353						bus-width = <8>;
354						remote-endpoint = <&vin1ep>;
355					};
356				};
357			};
358		};
359
360		hdmi@39 {
361			compatible = "adi,adv7511w";
362			reg = <0x39>;
363			interrupt-parent = <&gpio3>;
364			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
365
366			adi,input-depth = <8>;
367			adi,input-colorspace = "rgb";
368			adi,input-clock = "1x";
369			adi,input-style = <1>;
370			adi,input-justification = "evenly";
371
372			ports {
373				#address-cells = <1>;
374				#size-cells = <0>;
375
376				port@0 {
377					reg = <0>;
378					adv7511_in: endpoint {
379						remote-endpoint = <&du_out_rgb>;
380					};
381				};
382
383				port@1 {
384					reg = <1>;
385					adv7511_out: endpoint {
386						remote-endpoint = <&hdmi_con_out>;
387					};
388				};
389			};
390		};
391
392		hdmi-in@4c {
393			compatible = "adi,adv7612";
394			reg = <0x4c>;
395			interrupt-parent = <&gpio4>;
396			interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
397			default-input = <0>;
398
399			port {
400				#address-cells = <1>;
401				#size-cells = <0>;
402
403				port@0 {
404					reg = <0>;
405					adv7612_in: endpoint {
406						remote-endpoint = <&hdmi_con_in>;
407					};
408				};
409
410				port@2 {
411					reg = <2>;
412					adv7612_out: endpoint {
413						remote-endpoint = <&vin0ep2>;
414					};
415				};
416			};
417		};
418
419		eeprom@50 {
420			compatible = "renesas,r1ex24002", "atmel,24c02";
421			reg = <0x50>;
422			pagesize = <16>;
423		};
424	};
425
426	/*
427	 * I2C4 is routed to EXIO connector E, pins 37 (SCL) + 39 (SDA).
428	 * A fallback to GPIO is provided.
429	 */
430	i2cexio4: i2c-12 {
431		compatible = "i2c-demux-pinctrl";
432		i2c-parent = <&i2c4>, <&gpioi2c4>;
433		i2c-bus-name = "i2c-exio4";
434		#address-cells = <1>;
435		#size-cells = <0>;
436	};
437};
438
439&du {
440	pinctrl-0 = <&du_pins>;
441	pinctrl-names = "default";
442	status = "okay";
443
444	clocks = <&cpg CPG_MOD 724>, <&cpg CPG_MOD 723>,
445		 <&x13_clk>, <&x2_clk>;
446	clock-names = "du.0", "du.1", "dclkin.0", "dclkin.1";
447
448	ports {
449		port@0 {
450			endpoint {
451				remote-endpoint = <&adv7511_in>;
452			};
453		};
454	};
455};
456
457&lvds0 {
458	ports {
459		port@1 {
460			lvds_connector: endpoint {
461			};
462		};
463	};
464};
465
466&extal_clk {
467	clock-frequency = <20000000>;
468};
469
470&pfc {
471	pinctrl-0 = <&scif_clk_pins>;
472	pinctrl-names = "default";
473
474	i2c2_pins: i2c2 {
475		groups = "i2c2";
476		function = "i2c2";
477	};
478
479	i2c4_pins: i2c4 {
480		groups = "i2c4_c";
481		function = "i2c4";
482	};
483
484	du_pins: du {
485		groups = "du_rgb888", "du_sync", "du_disp", "du_clk_out_0";
486		function = "du";
487	};
488
489	scif0_pins: scif0 {
490		groups = "scif0_data_d";
491		function = "scif0";
492	};
493
494	scif1_pins: scif1 {
495		groups = "scif1_data_d";
496		function = "scif1";
497	};
498
499	scif_clk_pins: scif_clk {
500		groups = "scif_clk";
501		function = "scif_clk";
502	};
503
504	ether_pins: ether {
505		groups = "eth_link", "eth_mdio", "eth_rmii";
506		function = "eth";
507	};
508
509	phy1_pins: phy1 {
510		groups = "intc_irq0";
511		function = "intc";
512	};
513
514	pmic_irq_pins: pmicirq {
515		groups = "intc_irq2";
516		function = "intc";
517	};
518
519	sdhi0_pins: sd0 {
520		groups = "sdhi0_data4", "sdhi0_ctrl";
521		function = "sdhi0";
522		power-source = <3300>;
523	};
524
525	sdhi0_pins_uhs: sd0_uhs {
526		groups = "sdhi0_data4", "sdhi0_ctrl";
527		function = "sdhi0";
528		power-source = <1800>;
529	};
530
531	sdhi1_pins: sd1 {
532		groups = "sdhi1_data4", "sdhi1_ctrl";
533		function = "sdhi1";
534		power-source = <3300>;
535	};
536
537	sdhi1_pins_uhs: sd1_uhs {
538		groups = "sdhi1_data4", "sdhi1_ctrl";
539		function = "sdhi1";
540		power-source = <1800>;
541	};
542
543	sdhi2_pins: sd2 {
544		groups = "sdhi2_data4", "sdhi2_ctrl";
545		function = "sdhi2";
546		power-source = <3300>;
547	};
548
549	sdhi2_pins_uhs: sd2_uhs {
550		groups = "sdhi2_data4", "sdhi2_ctrl";
551		function = "sdhi2";
552		power-source = <1800>;
553	};
554
555	qspi_pins: qspi {
556		groups = "qspi_ctrl", "qspi_data4";
557		function = "qspi";
558	};
559
560	sound_pins: sound {
561		groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
562		function = "ssi";
563	};
564
565	sound_clk_pins: sound_clk {
566		groups = "audio_clk_a";
567		function = "audio_clk";
568	};
569
570	vin0_pins: vin0 {
571		groups = "vin0_data24", "vin0_sync", "vin0_clkenb", "vin0_clk";
572		function = "vin0";
573	};
574
575	vin1_pins: vin1 {
576		groups = "vin1_data8", "vin1_clk";
577		function = "vin1";
578	};
579};
580
581&ether {
582	pinctrl-0 = <&ether_pins &phy1_pins>;
583	pinctrl-names = "default";
584
585	phy-handle = <&phy1>;
586	renesas,ether-link-active-low;
587	status = "okay";
588
589	phy1: ethernet-phy@1 {
590		reg = <1>;
591		interrupt-parent = <&irqc0>;
592		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
593		micrel,led-mode = <1>;
594	};
595};
596
597&cmt0 {
598	status = "okay";
599};
600
601&cpu0 {
602	cpu0-supply = <&vdd_dvfs>;
603};
604
605&rwdt {
606	timeout-sec = <60>;
607	status = "okay";
608};
609
610&scif0 {
611	pinctrl-0 = <&scif0_pins>;
612	pinctrl-names = "default";
613
614	status = "okay";
615};
616
617&scif1 {
618	pinctrl-0 = <&scif1_pins>;
619	pinctrl-names = "default";
620
621	status = "okay";
622};
623
624&scif_clk {
625	clock-frequency = <14745600>;
626};
627
628&sdhi0 {
629	pinctrl-0 = <&sdhi0_pins>;
630	pinctrl-1 = <&sdhi0_pins_uhs>;
631	pinctrl-names = "default", "state_uhs";
632
633	vmmc-supply = <&vcc_sdhi0>;
634	vqmmc-supply = <&vccq_sdhi0>;
635	cd-gpios = <&gpio6 6 GPIO_ACTIVE_LOW>;
636	wp-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
637	sd-uhs-sdr50;
638	sd-uhs-sdr104;
639	status = "okay";
640};
641
642&sdhi1 {
643	pinctrl-0 = <&sdhi1_pins>;
644	pinctrl-1 = <&sdhi1_pins_uhs>;
645	pinctrl-names = "default", "state_uhs";
646
647	vmmc-supply = <&vcc_sdhi1>;
648	vqmmc-supply = <&vccq_sdhi1>;
649	cd-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
650	wp-gpios = <&gpio6 15 GPIO_ACTIVE_HIGH>;
651	sd-uhs-sdr50;
652	status = "okay";
653};
654
655&sdhi2 {
656	pinctrl-0 = <&sdhi2_pins>;
657	pinctrl-1 = <&sdhi2_pins_uhs>;
658	pinctrl-names = "default", "state_uhs";
659
660	vmmc-supply = <&vcc_sdhi2>;
661	vqmmc-supply = <&vccq_sdhi2>;
662	cd-gpios = <&gpio6 22 GPIO_ACTIVE_LOW>;
663	sd-uhs-sdr50;
664	status = "okay";
665};
666
667&qspi {
668	pinctrl-0 = <&qspi_pins>;
669	pinctrl-names = "default";
670
671	status = "okay";
672
673	flash@0 {
674		compatible = "spansion,s25fl512s", "jedec,spi-nor";
675		reg = <0>;
676		spi-max-frequency = <30000000>;
677		spi-tx-bus-width = <4>;
678		spi-rx-bus-width = <4>;
679		spi-cpol;
680		spi-cpha;
681		m25p,fast-read;
682
683		partitions {
684			compatible = "fixed-partitions";
685			#address-cells = <1>;
686			#size-cells = <1>;
687
688			partition@0 {
689				label = "loader";
690				reg = <0x00000000 0x00040000>;
691				read-only;
692			};
693			partition@40000 {
694				label = "user";
695				reg = <0x00040000 0x00400000>;
696				read-only;
697			};
698			partition@440000 {
699				label = "flash";
700				reg = <0x00440000 0x03bc0000>;
701			};
702		};
703	};
704};
705
706&i2c2 {
707	pinctrl-0 = <&i2c2_pins>;
708	pinctrl-names = "i2c-hdmi";
709
710	status = "okay";
711	clock-frequency = <100000>;
712
713};
714
715&i2c6 {
716	pinctrl-names = "default";
717	pinctrl-0 = <&pmic_irq_pins>;
718	status = "okay";
719	clock-frequency = <100000>;
720
721	pmic@58 {
722		compatible = "dlg,da9063";
723		reg = <0x58>;
724		interrupt-parent = <&irqc0>;
725		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
726		interrupt-controller;
727
728		rtc {
729			compatible = "dlg,da9063-rtc";
730		};
731
732		wdt {
733			compatible = "dlg,da9063-watchdog";
734		};
735	};
736
737	vdd_dvfs: regulator@68 {
738		compatible = "dlg,da9210";
739		reg = <0x68>;
740		interrupt-parent = <&irqc0>;
741		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
742
743		regulator-min-microvolt = <1000000>;
744		regulator-max-microvolt = <1000000>;
745		regulator-boot-on;
746		regulator-always-on;
747	};
748};
749
750&i2c4 {
751	pinctrl-0 = <&i2c4_pins>;
752	pinctrl-names = "i2c-exio4";
753};
754
755&rcar_sound {
756	pinctrl-0 = <&sound_pins &sound_clk_pins>;
757	pinctrl-names = "default";
758
759	/* Single DAI */
760	#sound-dai-cells = <0>;
761
762	status = "okay";
763
764	rcar_sound,dai {
765		dai0 {
766			playback = <&ssi0 &src2 &dvc0>;
767			capture  = <&ssi1 &src3 &dvc1>;
768		};
769	};
770};
771
772&ssi1 {
773	shared-pin;
774};
775
776/* HDMI video input */
777&vin0 {
778	status = "okay";
779	pinctrl-0 = <&vin0_pins>;
780	pinctrl-names = "default";
781
782	port {
783		vin0ep2: endpoint {
784			remote-endpoint = <&adv7612_out>;
785			bus-width = <24>;
786			hsync-active = <0>;
787			vsync-active = <0>;
788			pclk-sample = <1>;
789			data-active = <1>;
790		};
791	};
792};
793
794/* composite video input */
795&vin1 {
796	pinctrl-0 = <&vin1_pins>;
797	pinctrl-names = "default";
798
799	status = "okay";
800
801	port {
802		vin1ep: endpoint {
803			remote-endpoint = <&adv7180_out>;
804			bus-width = <8>;
805		};
806	};
807};
808