1/*
2 * Device Tree Source for common parts of Salvator-X board variants
3 *
4 * Copyright (C) 2015-2016 Renesas Electronics Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2.  This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/*
12 * SSI-AK4613
13 *
14 * This command is required when Playback/Capture
15 *
16 *	amixer set "DVC Out" 100%
17 *	amixer set "DVC In" 100%
18 *
19 * You can use Mute
20 *
21 *	amixer set "DVC Out Mute" on
22 *	amixer set "DVC In Mute" on
23 *
24 * You can use Volume Ramp
25 *
26 *	amixer set "DVC Out Ramp Up Rate"   "0.125 dB/64 steps"
27 *	amixer set "DVC Out Ramp Down Rate" "0.125 dB/512 steps"
28 *	amixer set "DVC Out Ramp" on
29 *	aplay xxx.wav &
30 *	amixer set "DVC Out"  80%  // Volume Down
31 *	amixer set "DVC Out" 100%  // Volume Up
32 */
33
34#include <dt-bindings/gpio/gpio.h>
35
36/ {
37	aliases {
38		serial0 = &scif2;
39		serial1 = &scif1;
40		ethernet0 = &avb;
41	};
42
43	chosen {
44		bootargs = "ignore_loglevel rw root=/dev/nfs ip=dhcp";
45		stdout-path = "serial0:115200n8";
46	};
47
48	audio_clkout: audio-clkout {
49		/*
50		 * This is same as <&rcar_sound 0>
51		 * but needed to avoid cs2000/rcar_sound probe dead-lock
52		 */
53		compatible = "fixed-clock";
54		#clock-cells = <0>;
55		clock-frequency = <12288000>;
56	};
57
58	backlight: backlight {
59		compatible = "pwm-backlight";
60		pwms = <&pwm1 0 50000>;
61
62		brightness-levels = <256 128 64 16 8 4 0>;
63		default-brightness-level = <6>;
64
65		power-supply = <&reg_12v>;
66		enable-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
67	};
68
69	cvbs-in {
70		compatible = "composite-video-connector";
71		label = "CVBS IN";
72
73		port {
74			cvbs_con: endpoint {
75				remote-endpoint = <&adv7482_ain7>;
76			};
77		};
78	};
79
80	hdmi-in {
81		compatible = "hdmi-connector";
82		label = "HDMI IN";
83		type = "a";
84
85		port {
86			hdmi_in_con: endpoint {
87				remote-endpoint = <&adv7482_hdmi>;
88			};
89		};
90	};
91
92	reg_1p8v: regulator0 {
93		compatible = "regulator-fixed";
94		regulator-name = "fixed-1.8V";
95		regulator-min-microvolt = <1800000>;
96		regulator-max-microvolt = <1800000>;
97		regulator-boot-on;
98		regulator-always-on;
99	};
100
101	reg_3p3v: regulator1 {
102		compatible = "regulator-fixed";
103		regulator-name = "fixed-3.3V";
104		regulator-min-microvolt = <3300000>;
105		regulator-max-microvolt = <3300000>;
106		regulator-boot-on;
107		regulator-always-on;
108	};
109
110	reg_12v: regulator2 {
111		compatible = "regulator-fixed";
112		regulator-name = "fixed-12V";
113		regulator-min-microvolt = <12000000>;
114		regulator-max-microvolt = <12000000>;
115		regulator-boot-on;
116		regulator-always-on;
117	};
118
119	sound_card: sound {
120		compatible = "audio-graph-card";
121
122		label = "rcar-sound";
123
124		dais = <&rsnd_port0>;
125	};
126
127	vbus0_usb2: regulator-vbus0-usb2 {
128		compatible = "regulator-fixed";
129
130		regulator-name = "USB20_VBUS0";
131		regulator-min-microvolt = <5000000>;
132		regulator-max-microvolt = <5000000>;
133
134		gpio = <&gpio6 16 GPIO_ACTIVE_HIGH>;
135		enable-active-high;
136	};
137
138	vcc_sdhi0: regulator-vcc-sdhi0 {
139		compatible = "regulator-fixed";
140
141		regulator-name = "SDHI0 Vcc";
142		regulator-min-microvolt = <3300000>;
143		regulator-max-microvolt = <3300000>;
144
145		gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>;
146		enable-active-high;
147	};
148
149	vccq_sdhi0: regulator-vccq-sdhi0 {
150		compatible = "regulator-gpio";
151
152		regulator-name = "SDHI0 VccQ";
153		regulator-min-microvolt = <1800000>;
154		regulator-max-microvolt = <3300000>;
155
156		gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
157		gpios-states = <1>;
158		states = <3300000 1
159			  1800000 0>;
160	};
161
162	vcc_sdhi3: regulator-vcc-sdhi3 {
163		compatible = "regulator-fixed";
164
165		regulator-name = "SDHI3 Vcc";
166		regulator-min-microvolt = <3300000>;
167		regulator-max-microvolt = <3300000>;
168
169		gpio = <&gpio3 15 GPIO_ACTIVE_HIGH>;
170		enable-active-high;
171	};
172
173	vccq_sdhi3: regulator-vccq-sdhi3 {
174		compatible = "regulator-gpio";
175
176		regulator-name = "SDHI3 VccQ";
177		regulator-min-microvolt = <1800000>;
178		regulator-max-microvolt = <3300000>;
179
180		gpios = <&gpio3 14 GPIO_ACTIVE_HIGH>;
181		gpios-states = <1>;
182		states = <3300000 1
183			  1800000 0>;
184	};
185
186	hdmi0-out {
187		compatible = "hdmi-connector";
188		label = "HDMI0 OUT";
189		type = "a";
190
191		port {
192			hdmi0_con: endpoint {
193			};
194		};
195	};
196
197	hdmi1-out {
198		compatible = "hdmi-connector";
199		label = "HDMI1 OUT";
200		type = "a";
201
202		port {
203			hdmi1_con: endpoint {
204			};
205		};
206	};
207
208	vga {
209		compatible = "vga-connector";
210
211		port {
212			vga_in: endpoint {
213				remote-endpoint = <&adv7123_out>;
214			};
215		};
216	};
217
218	vga-encoder {
219		compatible = "adi,adv7123";
220
221		ports {
222			#address-cells = <1>;
223			#size-cells = <0>;
224
225			port@0 {
226				reg = <0>;
227				adv7123_in: endpoint {
228					remote-endpoint = <&du_out_rgb>;
229				};
230			};
231			port@1 {
232				reg = <1>;
233				adv7123_out: endpoint {
234					remote-endpoint = <&vga_in>;
235				};
236			};
237		};
238	};
239
240	x12_clk: x12 {
241		compatible = "fixed-clock";
242		#clock-cells = <0>;
243		clock-frequency = <24576000>;
244	};
245
246	/* External DU dot clocks */
247	x21_clk: x21-clock {
248		compatible = "fixed-clock";
249		#clock-cells = <0>;
250		clock-frequency = <33000000>;
251	};
252
253	x22_clk: x22-clock {
254		compatible = "fixed-clock";
255		#clock-cells = <0>;
256		clock-frequency = <33000000>;
257	};
258
259	x23_clk: x23-clock {
260		compatible = "fixed-clock";
261		#clock-cells = <0>;
262		clock-frequency = <25000000>;
263	};
264};
265
266&audio_clk_a {
267	clock-frequency = <22579200>;
268};
269
270&avb {
271	pinctrl-0 = <&avb_pins>;
272	pinctrl-names = "default";
273	phy-handle = <&phy0>;
274	phy-mode = "rgmii-txid";
275	status = "okay";
276
277	phy0: ethernet-phy@0 {
278		rxc-skew-ps = <1500>;
279		reg = <0>;
280		interrupt-parent = <&gpio2>;
281		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
282		reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
283	};
284};
285
286&csi20 {
287	status = "okay";
288
289	ports {
290		port@0 {
291			reg = <0>;
292			csi20_in: endpoint {
293				clock-lanes = <0>;
294				data-lanes = <1>;
295				remote-endpoint = <&adv7482_txb>;
296			};
297		};
298	};
299};
300
301&csi40 {
302	status = "okay";
303
304	ports {
305		port@0 {
306			reg = <0>;
307
308			csi40_in: endpoint {
309				clock-lanes = <0>;
310				data-lanes = <1 2 3 4>;
311				remote-endpoint = <&adv7482_txa>;
312			};
313		};
314	};
315};
316
317&du {
318	pinctrl-0 = <&du_pins>;
319	pinctrl-names = "default";
320	status = "okay";
321
322	ports {
323		port@0 {
324			endpoint {
325				remote-endpoint = <&adv7123_in>;
326			};
327		};
328	};
329};
330
331&ehci0 {
332	dr_mode = "otg";
333	status = "okay";
334};
335
336&ehci1 {
337	status = "okay";
338};
339
340&extalr_clk {
341	clock-frequency = <32768>;
342};
343
344&hsusb {
345	dr_mode = "otg";
346	status = "okay";
347};
348
349&i2c2 {
350	pinctrl-0 = <&i2c2_pins>;
351	pinctrl-names = "default";
352
353	status = "okay";
354
355	clock-frequency = <100000>;
356
357	ak4613: codec@10 {
358		compatible = "asahi-kasei,ak4613";
359		#sound-dai-cells = <0>;
360		reg = <0x10>;
361		clocks = <&rcar_sound 3>;
362
363		asahi-kasei,in1-single-end;
364		asahi-kasei,in2-single-end;
365		asahi-kasei,out1-single-end;
366		asahi-kasei,out2-single-end;
367		asahi-kasei,out3-single-end;
368		asahi-kasei,out4-single-end;
369		asahi-kasei,out5-single-end;
370		asahi-kasei,out6-single-end;
371
372		port {
373			ak4613_endpoint: endpoint {
374				remote-endpoint = <&rsnd_endpoint0>;
375			};
376		};
377	};
378
379	cs2000: clk_multiplier@4f {
380		#clock-cells = <0>;
381		compatible = "cirrus,cs2000-cp";
382		reg = <0x4f>;
383		clocks = <&audio_clkout>, <&x12_clk>;
384		clock-names = "clk_in", "ref_clk";
385
386		assigned-clocks = <&cs2000>;
387		assigned-clock-rates = <24576000>; /* 1/1 divide */
388	};
389};
390
391&i2c4 {
392	status = "okay";
393
394	pca9654: gpio@20 {
395		compatible = "onnn,pca9654";
396		reg = <0x20>;
397		gpio-controller;
398		#gpio-cells = <2>;
399	};
400
401	csa_vdd: adc@7c {
402		compatible = "maxim,max9611";
403		reg = <0x7c>;
404
405		shunt-resistor-micro-ohms = <5000>;
406	};
407
408	csa_dvfs: adc@7f {
409		compatible = "maxim,max9611";
410		reg = <0x7f>;
411
412		shunt-resistor-micro-ohms = <5000>;
413	};
414
415	video-receiver@70 {
416		compatible = "adi,adv7482";
417		reg = <0x70>;
418
419		#address-cells = <1>;
420		#size-cells = <0>;
421
422		interrupt-parent = <&gpio6>;
423		interrupt-names = "intrq1", "intrq2";
424		interrupts = <30 IRQ_TYPE_LEVEL_LOW>,
425			     <31 IRQ_TYPE_LEVEL_LOW>;
426
427		port@7 {
428			reg = <7>;
429
430			adv7482_ain7: endpoint {
431				remote-endpoint = <&cvbs_con>;
432			};
433		};
434
435		port@8 {
436			reg = <8>;
437
438			adv7482_hdmi: endpoint {
439				remote-endpoint = <&hdmi_in_con>;
440			};
441		};
442
443		port@10 {
444			reg = <10>;
445
446			adv7482_txa: endpoint {
447				clock-lanes = <0>;
448				data-lanes = <1 2 3 4>;
449				remote-endpoint = <&csi40_in>;
450			};
451		};
452
453		port@11 {
454			reg = <11>;
455
456			adv7482_txb: endpoint {
457				clock-lanes = <0>;
458				data-lanes = <1>;
459				remote-endpoint = <&csi20_in>;
460			};
461		};
462	};
463};
464
465&i2c_dvfs {
466	status = "okay";
467
468	pmic: pmic@30 {
469		pinctrl-0 = <&irq0_pins>;
470		pinctrl-names = "default";
471
472		compatible = "rohm,bd9571mwv";
473		reg = <0x30>;
474		interrupt-parent = <&intc_ex>;
475		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
476		interrupt-controller;
477		#interrupt-cells = <2>;
478		gpio-controller;
479		#gpio-cells = <2>;
480		rohm,ddr-backup-power = <0xf>;
481		rohm,rstbmode-level;
482
483		regulators {
484			dvfs: dvfs {
485				regulator-name = "dvfs";
486				regulator-min-microvolt = <750000>;
487				regulator-max-microvolt = <1030000>;
488				regulator-boot-on;
489				regulator-always-on;
490			};
491		};
492	};
493
494	eeprom@50 {
495		compatible = "rohm,br24t01", "atmel,24c01";
496		reg = <0x50>;
497		pagesize = <8>;
498	};
499};
500
501&ohci0 {
502	dr_mode = "otg";
503	status = "okay";
504};
505
506&ohci1 {
507	status = "okay";
508};
509
510&pcie_bus_clk {
511	clock-frequency = <100000000>;
512};
513
514&pciec0 {
515	status = "okay";
516};
517
518&pciec1 {
519	status = "okay";
520};
521
522&pfc {
523	pinctrl-0 = <&scif_clk_pins>;
524	pinctrl-names = "default";
525
526	avb_pins: avb {
527		mux {
528			groups = "avb_link", "avb_mdio", "avb_mii";
529			function = "avb";
530		};
531
532		pins_mdio {
533			groups = "avb_mdio";
534			drive-strength = <24>;
535		};
536
537		pins_mii_tx {
538			pins = "PIN_AVB_TX_CTL", "PIN_AVB_TXC", "PIN_AVB_TD0",
539			       "PIN_AVB_TD1", "PIN_AVB_TD2", "PIN_AVB_TD3";
540			drive-strength = <12>;
541		};
542	};
543
544	du_pins: du {
545		groups = "du_rgb888", "du_sync", "du_oddf", "du_clk_out_0";
546		function = "du";
547	};
548
549	i2c2_pins: i2c2 {
550		groups = "i2c2_a";
551		function = "i2c2";
552	};
553
554	irq0_pins: irq0 {
555		groups = "intc_ex_irq0";
556		function = "intc_ex";
557	};
558
559	pwm1_pins: pwm1 {
560		groups = "pwm1_a";
561		function = "pwm1";
562	};
563
564	scif1_pins: scif1 {
565		groups = "scif1_data_a", "scif1_ctrl";
566		function = "scif1";
567	};
568
569	scif2_pins: scif2 {
570		groups = "scif2_data_a";
571		function = "scif2";
572	};
573
574	scif_clk_pins: scif_clk {
575		groups = "scif_clk_a";
576		function = "scif_clk";
577	};
578
579	sdhi0_pins: sd0 {
580		groups = "sdhi0_data4", "sdhi0_ctrl";
581		function = "sdhi0";
582		power-source = <3300>;
583	};
584
585	sdhi0_pins_uhs: sd0_uhs {
586		groups = "sdhi0_data4", "sdhi0_ctrl";
587		function = "sdhi0";
588		power-source = <1800>;
589	};
590
591	sdhi2_pins: sd2 {
592		groups = "sdhi2_data8", "sdhi2_ctrl";
593		function = "sdhi2";
594		power-source = <3300>;
595	};
596
597	sdhi2_pins_uhs: sd2_uhs {
598		groups = "sdhi2_data8", "sdhi2_ctrl";
599		function = "sdhi2";
600		power-source = <1800>;
601	};
602
603	sdhi3_pins: sd3 {
604		groups = "sdhi3_data4", "sdhi3_ctrl";
605		function = "sdhi3";
606		power-source = <3300>;
607	};
608
609	sdhi3_pins_uhs: sd3_uhs {
610		groups = "sdhi3_data4", "sdhi3_ctrl";
611		function = "sdhi3";
612		power-source = <1800>;
613	};
614
615	sound_pins: sound {
616		groups = "ssi01239_ctrl", "ssi0_data", "ssi1_data_a";
617		function = "ssi";
618	};
619
620	sound_clk_pins: sound_clk {
621		groups = "audio_clk_a_a", "audio_clk_b_a", "audio_clk_c_a",
622			 "audio_clkout_a", "audio_clkout3_a";
623		function = "audio_clk";
624	};
625
626	usb0_pins: usb0 {
627		groups = "usb0";
628		function = "usb0";
629	};
630
631	usb1_pins: usb1 {
632		mux {
633			groups = "usb1";
634			function = "usb1";
635		};
636
637		ovc {
638			pins = "GP_6_27";
639			bias-pull-up;
640		};
641
642		pwen {
643			pins = "GP_6_26";
644			bias-pull-down;
645		};
646	};
647
648	usb30_pins: usb30 {
649		groups = "usb30";
650		function = "usb30";
651	};
652};
653
654&pwm1 {
655	pinctrl-0 = <&pwm1_pins>;
656	pinctrl-names = "default";
657
658	status = "okay";
659};
660
661&rcar_sound {
662	pinctrl-0 = <&sound_pins &sound_clk_pins>;
663	pinctrl-names = "default";
664
665	/* Single DAI */
666	#sound-dai-cells = <0>;
667
668	/* audio_clkout0/1/2/3 */
669	#clock-cells = <1>;
670	clock-frequency = <12288000 11289600>;
671
672	status = "okay";
673
674	/* update <audio_clk_b> to <cs2000> */
675	clocks = <&cpg CPG_MOD 1005>,
676		 <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>,
677		 <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>,
678		 <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>,
679		 <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>,
680		 <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>,
681		 <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>,
682		 <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>,
683		 <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>,
684		 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>,
685		 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>,
686		 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
687		 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>,
688		 <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>,
689		 <&audio_clk_a>, <&cs2000>,
690		 <&audio_clk_c>,
691		 <&cpg CPG_CORE CPG_AUDIO_CLK_I>;
692
693	ports {
694		rsnd_port0: port@0 {
695			rsnd_endpoint0: endpoint {
696				remote-endpoint = <&ak4613_endpoint>;
697
698				dai-format = "left_j";
699				bitclock-master = <&rsnd_endpoint0>;
700				frame-master = <&rsnd_endpoint0>;
701
702				playback = <&ssi0 &src0 &dvc0>;
703				capture  = <&ssi1 &src1 &dvc1>;
704			};
705		};
706	};
707};
708
709&scif1 {
710	pinctrl-0 = <&scif1_pins>;
711	pinctrl-names = "default";
712
713	uart-has-rtscts;
714	status = "okay";
715};
716
717&scif2 {
718	pinctrl-0 = <&scif2_pins>;
719	pinctrl-names = "default";
720
721	status = "okay";
722};
723
724&scif_clk {
725	clock-frequency = <14745600>;
726};
727
728&sdhi0 {
729	pinctrl-0 = <&sdhi0_pins>;
730	pinctrl-1 = <&sdhi0_pins_uhs>;
731	pinctrl-names = "default", "state_uhs";
732
733	vmmc-supply = <&vcc_sdhi0>;
734	vqmmc-supply = <&vccq_sdhi0>;
735	cd-gpios = <&gpio3 12 GPIO_ACTIVE_LOW>;
736	wp-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>;
737	bus-width = <4>;
738	sd-uhs-sdr50;
739	status = "okay";
740};
741
742&sdhi2 {
743	/* used for on-board 8bit eMMC */
744	pinctrl-0 = <&sdhi2_pins>;
745	pinctrl-1 = <&sdhi2_pins_uhs>;
746	pinctrl-names = "default", "state_uhs";
747
748	vmmc-supply = <&reg_3p3v>;
749	vqmmc-supply = <&reg_1p8v>;
750	bus-width = <8>;
751	mmc-hs200-1_8v;
752	non-removable;
753	fixed-emmc-driver-type = <1>;
754	status = "okay";
755};
756
757&sdhi3 {
758	pinctrl-0 = <&sdhi3_pins>;
759	pinctrl-1 = <&sdhi3_pins_uhs>;
760	pinctrl-names = "default", "state_uhs";
761
762	vmmc-supply = <&vcc_sdhi3>;
763	vqmmc-supply = <&vccq_sdhi3>;
764	cd-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
765	wp-gpios = <&gpio4 16 GPIO_ACTIVE_HIGH>;
766	bus-width = <4>;
767	sd-uhs-sdr50;
768	status = "okay";
769};
770
771&ssi1 {
772	shared-pin;
773};
774
775&usb_extal_clk {
776	clock-frequency = <50000000>;
777};
778
779&usb2_phy0 {
780	pinctrl-0 = <&usb0_pins>;
781	pinctrl-names = "default";
782
783	vbus-supply = <&vbus0_usb2>;
784	status = "okay";
785};
786
787&usb2_phy1 {
788	pinctrl-0 = <&usb1_pins>;
789	pinctrl-names = "default";
790
791	status = "okay";
792};
793
794&usb3_peri0 {
795	phys = <&usb3_phy0>;
796	phy-names = "usb";
797
798	status = "okay";
799};
800
801&usb3_phy0 {
802	status = "okay";
803};
804
805&usb3s0_clk {
806	clock-frequency = <100000000>;
807};
808
809&vin0 {
810	status = "okay";
811};
812
813&vin1 {
814	status = "okay";
815};
816
817&vin2 {
818	status = "okay";
819};
820
821&vin3 {
822	status = "okay";
823};
824
825&vin4 {
826	status = "okay";
827};
828
829&vin5 {
830	status = "okay";
831};
832
833&vin6 {
834	status = "okay";
835};
836
837&vin7 {
838	status = "okay";
839};
840
841&wdt0 {
842	timeout-sec = <60>;
843	status = "okay";
844};
845
846&xhci0 {
847	pinctrl-0 = <&usb30_pins>;
848	pinctrl-names = "default";
849
850	status = "okay";
851};
852