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