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		mmc0 = &sdhi0;
53		mmc1 = &sdhi1;
54		mmc2 = &sdhi2;
55	};
56
57	chosen {
58		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
59		stdout-path = "serial0:115200n8";
60	};
61
62	memory@40000000 {
63		device_type = "memory";
64		reg = <0 0x40000000 0 0x40000000>;
65	};
66
67	gpio-keys {
68		compatible = "gpio-keys";
69
70		key-1 {
71			gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
72			linux,code = <KEY_1>;
73			label = "SW2-1";
74			wakeup-source;
75			debounce-interval = <20>;
76		};
77		key-2 {
78			gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
79			linux,code = <KEY_2>;
80			label = "SW2-2";
81			wakeup-source;
82			debounce-interval = <20>;
83		};
84		key-3 {
85			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
86			linux,code = <KEY_3>;
87			label = "SW2-3";
88			wakeup-source;
89			debounce-interval = <20>;
90		};
91		key-4 {
92			gpios = <&gpio5 3 GPIO_ACTIVE_LOW>;
93			linux,code = <KEY_4>;
94			label = "SW2-4";
95			wakeup-source;
96			debounce-interval = <20>;
97		};
98		key-a {
99			gpios = <&gpio7 0 GPIO_ACTIVE_LOW>;
100			linux,code = <KEY_A>;
101			label = "SW30";
102			wakeup-source;
103			debounce-interval = <20>;
104		};
105		key-b {
106			gpios = <&gpio7 1 GPIO_ACTIVE_LOW>;
107			linux,code = <KEY_B>;
108			label = "SW31";
109			wakeup-source;
110			debounce-interval = <20>;
111		};
112		key-c {
113			gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
114			linux,code = <KEY_C>;
115			label = "SW32";
116			wakeup-source;
117			debounce-interval = <20>;
118		};
119		key-d {
120			gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
121			linux,code = <KEY_D>;
122			label = "SW33";
123			wakeup-source;
124			debounce-interval = <20>;
125		};
126		key-e {
127			gpios = <&gpio7 4 GPIO_ACTIVE_LOW>;
128			linux,code = <KEY_E>;
129			label = "SW34";
130			wakeup-source;
131			debounce-interval = <20>;
132		};
133		key-f {
134			gpios = <&gpio7 5 GPIO_ACTIVE_LOW>;
135			linux,code = <KEY_F>;
136			label = "SW35";
137			wakeup-source;
138			debounce-interval = <20>;
139		};
140		key-g {
141			gpios = <&gpio7 6 GPIO_ACTIVE_LOW>;
142			linux,code = <KEY_G>;
143			label = "SW36";
144			wakeup-source;
145			debounce-interval = <20>;
146		};
147	};
148
149	leds {
150		compatible = "gpio-leds";
151		led6 {
152			gpios = <&gpio2 19 GPIO_ACTIVE_HIGH>;
153			label = "LED6";
154		};
155		led7 {
156			gpios = <&gpio2 20 GPIO_ACTIVE_HIGH>;
157			label = "LED7";
158		};
159		led8 {
160			gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
161			label = "LED8";
162		};
163	};
164
165	vcc_sdhi0: regulator-vcc-sdhi0 {
166		compatible = "regulator-fixed";
167
168		regulator-name = "SDHI0 Vcc";
169		regulator-min-microvolt = <3300000>;
170		regulator-max-microvolt = <3300000>;
171
172		gpio = <&gpio7 17 GPIO_ACTIVE_HIGH>;
173		enable-active-high;
174	};
175
176	vccq_sdhi0: regulator-vccq-sdhi0 {
177		compatible = "regulator-gpio";
178
179		regulator-name = "SDHI0 VccQ";
180		regulator-min-microvolt = <1800000>;
181		regulator-max-microvolt = <3300000>;
182
183		gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>;
184		gpios-states = <1>;
185		states = <3300000 1>, <1800000 0>;
186	};
187
188	vcc_sdhi1: regulator-vcc-sdhi1 {
189		compatible = "regulator-fixed";
190
191		regulator-name = "SDHI1 Vcc";
192		regulator-min-microvolt = <3300000>;
193		regulator-max-microvolt = <3300000>;
194
195		gpio = <&gpio7 18 GPIO_ACTIVE_HIGH>;
196		enable-active-high;
197	};
198
199	vccq_sdhi1: regulator-vccq-sdhi1 {
200		compatible = "regulator-gpio";
201
202		regulator-name = "SDHI1 VccQ";
203		regulator-min-microvolt = <1800000>;
204		regulator-max-microvolt = <3300000>;
205
206		gpios = <&gpio2 13 GPIO_ACTIVE_HIGH>;
207		gpios-states = <1>;
208		states = <3300000 1>, <1800000 0>;
209	};
210
211	vcc_sdhi2: regulator-vcc-sdhi2 {
212		compatible = "regulator-fixed";
213
214		regulator-name = "SDHI2 Vcc";
215		regulator-min-microvolt = <3300000>;
216		regulator-max-microvolt = <3300000>;
217
218		gpio = <&gpio7 19 GPIO_ACTIVE_HIGH>;
219		enable-active-high;
220	};
221
222	vccq_sdhi2: regulator-vccq-sdhi2 {
223		compatible = "regulator-gpio";
224
225		regulator-name = "SDHI2 VccQ";
226		regulator-min-microvolt = <1800000>;
227		regulator-max-microvolt = <3300000>;
228
229		gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
230		gpios-states = <1>;
231		states = <3300000 1>, <1800000 0>;
232	};
233
234	audio_clock: audio_clock {
235		compatible = "fixed-clock";
236		#clock-cells = <0>;
237		clock-frequency = <11289600>;
238	};
239
240	rsnd_ak4643: sound {
241		compatible = "simple-audio-card";
242
243		simple-audio-card,format = "left_j";
244		simple-audio-card,bitclock-master = <&sndcodec>;
245		simple-audio-card,frame-master = <&sndcodec>;
246
247		sndcpu: simple-audio-card,cpu {
248			sound-dai = <&rcar_sound>;
249		};
250
251		sndcodec: simple-audio-card,codec {
252			sound-dai = <&ak4643>;
253			clocks = <&audio_clock>;
254		};
255	};
256
257	hdmi-in {
258		compatible = "hdmi-connector";
259		type = "a";
260
261		port {
262			hdmi_con_in: endpoint {
263				remote-endpoint = <&adv7612_in>;
264			};
265		};
266	};
267
268	hdmi-out {
269		compatible = "hdmi-connector";
270		type = "a";
271
272		port {
273			hdmi_con_out: endpoint {
274				remote-endpoint = <&adv7511_out>;
275			};
276		};
277	};
278
279	composite-in {
280		compatible = "composite-video-connector";
281
282		port {
283			composite_con_in: endpoint {
284				remote-endpoint = <&adv7180_in>;
285			};
286		};
287	};
288
289	x2_clk: x2-clock {
290		compatible = "fixed-clock";
291		#clock-cells = <0>;
292		clock-frequency = <74250000>;
293	};
294
295	x13_clk: x13-clock {
296		compatible = "fixed-clock";
297		#clock-cells = <0>;
298		clock-frequency = <148500000>;
299	};
300
301	gpioi2c2: i2c-9 {
302		#address-cells = <1>;
303		#size-cells = <0>;
304		compatible = "i2c-gpio";
305		status = "disabled";
306		scl-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
307		sda-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
308		i2c-gpio,delay-us = <5>;
309	};
310
311	gpioi2c4: i2c-10 {
312		#address-cells = <1>;
313		#size-cells = <0>;
314		compatible = "i2c-gpio";
315		status = "disabled";
316		scl-gpios = <&gpio7 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
317		sda-gpios = <&gpio7 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
318		i2c-gpio,delay-us = <5>;
319	};
320
321	/*
322	 * A fallback to GPIO is provided for I2C2.
323	 */
324	i2chdmi: i2c-11 {
325		compatible = "i2c-demux-pinctrl";
326		i2c-parent = <&i2c2>, <&gpioi2c2>;
327		i2c-bus-name = "i2c-hdmi";
328		#address-cells = <1>;
329		#size-cells = <0>;
330
331		ak4643: codec@12 {
332			compatible = "asahi-kasei,ak4643";
333			#sound-dai-cells = <0>;
334			reg = <0x12>;
335		};
336
337		composite-in@20 {
338			compatible = "adi,adv7180cp";
339			reg = <0x20>;
340
341			ports {
342				#address-cells = <1>;
343				#size-cells = <0>;
344
345				port@0 {
346					reg = <0>;
347					adv7180_in: endpoint {
348						remote-endpoint = <&composite_con_in>;
349					};
350				};
351
352				port@3 {
353					reg = <3>;
354					adv7180_out: endpoint {
355						bus-width = <8>;
356						remote-endpoint = <&vin1ep>;
357					};
358				};
359			};
360		};
361
362		hdmi@39 {
363			compatible = "adi,adv7511w";
364			reg = <0x39>;
365			interrupt-parent = <&gpio3>;
366			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
367
368			adi,input-depth = <8>;
369			adi,input-colorspace = "rgb";
370			adi,input-clock = "1x";
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			ports {
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		reset-gpios = <&gpio5 22 GPIO_ACTIVE_LOW>;
595	};
596};
597
598&cmt0 {
599	status = "okay";
600};
601
602&cpu0 {
603	cpu0-supply = <&vdd_dvfs>;
604};
605
606&rwdt {
607	timeout-sec = <60>;
608	status = "okay";
609};
610
611&scif0 {
612	pinctrl-0 = <&scif0_pins>;
613	pinctrl-names = "default";
614
615	status = "okay";
616};
617
618&scif1 {
619	pinctrl-0 = <&scif1_pins>;
620	pinctrl-names = "default";
621
622	status = "okay";
623};
624
625&scif_clk {
626	clock-frequency = <14745600>;
627};
628
629&sdhi0 {
630	pinctrl-0 = <&sdhi0_pins>;
631	pinctrl-1 = <&sdhi0_pins_uhs>;
632	pinctrl-names = "default", "state_uhs";
633
634	vmmc-supply = <&vcc_sdhi0>;
635	vqmmc-supply = <&vccq_sdhi0>;
636	cd-gpios = <&gpio6 6 GPIO_ACTIVE_LOW>;
637	wp-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
638	sd-uhs-sdr50;
639	sd-uhs-sdr104;
640	status = "okay";
641};
642
643&sdhi1 {
644	pinctrl-0 = <&sdhi1_pins>;
645	pinctrl-1 = <&sdhi1_pins_uhs>;
646	pinctrl-names = "default", "state_uhs";
647
648	vmmc-supply = <&vcc_sdhi1>;
649	vqmmc-supply = <&vccq_sdhi1>;
650	cd-gpios = <&gpio6 14 GPIO_ACTIVE_LOW>;
651	wp-gpios = <&gpio6 15 GPIO_ACTIVE_HIGH>;
652	sd-uhs-sdr50;
653	status = "okay";
654};
655
656&sdhi2 {
657	pinctrl-0 = <&sdhi2_pins>;
658	pinctrl-1 = <&sdhi2_pins_uhs>;
659	pinctrl-names = "default", "state_uhs";
660
661	vmmc-supply = <&vcc_sdhi2>;
662	vqmmc-supply = <&vccq_sdhi2>;
663	cd-gpios = <&gpio6 22 GPIO_ACTIVE_LOW>;
664	sd-uhs-sdr50;
665	status = "okay";
666};
667
668&qspi {
669	pinctrl-0 = <&qspi_pins>;
670	pinctrl-names = "default";
671
672	status = "okay";
673
674	flash@0 {
675		compatible = "spansion,s25fl512s", "jedec,spi-nor";
676		reg = <0>;
677		spi-max-frequency = <30000000>;
678		spi-tx-bus-width = <4>;
679		spi-rx-bus-width = <4>;
680		spi-cpol;
681		spi-cpha;
682		m25p,fast-read;
683
684		partitions {
685			compatible = "fixed-partitions";
686			#address-cells = <1>;
687			#size-cells = <1>;
688
689			partition@0 {
690				label = "loader";
691				reg = <0x00000000 0x00040000>;
692				read-only;
693			};
694			partition@40000 {
695				label = "user";
696				reg = <0x00040000 0x00400000>;
697				read-only;
698			};
699			partition@440000 {
700				label = "flash";
701				reg = <0x00440000 0x03bc0000>;
702			};
703		};
704	};
705};
706
707&i2c2 {
708	pinctrl-0 = <&i2c2_pins>;
709	pinctrl-names = "i2c-hdmi";
710
711	status = "okay";
712	clock-frequency = <100000>;
713
714};
715
716&i2c6 {
717	pinctrl-names = "default";
718	pinctrl-0 = <&pmic_irq_pins>;
719	status = "okay";
720	clock-frequency = <100000>;
721
722	pmic@58 {
723		compatible = "dlg,da9063";
724		reg = <0x58>;
725		interrupt-parent = <&irqc0>;
726		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
727		interrupt-controller;
728
729		rtc {
730			compatible = "dlg,da9063-rtc";
731		};
732
733		wdt {
734			compatible = "dlg,da9063-watchdog";
735		};
736	};
737
738	vdd_dvfs: regulator@68 {
739		compatible = "dlg,da9210";
740		reg = <0x68>;
741		interrupt-parent = <&irqc0>;
742		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
743
744		regulator-min-microvolt = <1000000>;
745		regulator-max-microvolt = <1000000>;
746		regulator-boot-on;
747		regulator-always-on;
748	};
749};
750
751&i2c4 {
752	pinctrl-0 = <&i2c4_pins>;
753	pinctrl-names = "i2c-exio4";
754};
755
756&rcar_sound {
757	pinctrl-0 = <&sound_pins>, <&sound_clk_pins>;
758	pinctrl-names = "default";
759
760	/* Single DAI */
761	#sound-dai-cells = <0>;
762
763	status = "okay";
764
765	rcar_sound,dai {
766		dai0 {
767			playback = <&ssi0>, <&src2>, <&dvc0>;
768			capture  = <&ssi1>, <&src3>, <&dvc1>;
769		};
770	};
771};
772
773&ssi1 {
774	shared-pin;
775};
776
777/* HDMI video input */
778&vin0 {
779	status = "okay";
780	pinctrl-0 = <&vin0_pins>;
781	pinctrl-names = "default";
782
783	port {
784		vin0ep2: endpoint {
785			remote-endpoint = <&adv7612_out>;
786			bus-width = <24>;
787			hsync-active = <0>;
788			vsync-active = <0>;
789			pclk-sample = <1>;
790			data-active = <1>;
791		};
792	};
793};
794
795/* composite video input */
796&vin1 {
797	pinctrl-0 = <&vin1_pins>;
798	pinctrl-names = "default";
799
800	status = "okay";
801
802	port {
803		vin1ep: endpoint {
804			remote-endpoint = <&adv7180_out>;
805			bus-width = <8>;
806		};
807	};
808};
809