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