1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device Tree Source for the Porter board
4 *
5 * Copyright (C) 2015 Cogent Embedded, Inc.
6 */
7
8/*
9 * SSI-AK4642
10 *
11 * JP3: 2-1: AK4642
12 *      2-3: ADV7511
13 *
14 * This command is required before playback/capture:
15 *
16 *	amixer set "LINEOUT Mixer DACL" on
17 */
18
19/dts-v1/;
20#include "r8a7791.dtsi"
21#include <dt-bindings/gpio/gpio.h>
22
23/ {
24	model = "Porter";
25	compatible = "renesas,porter", "renesas,r8a7791";
26
27	aliases {
28		serial0 = &scif0;
29		i2c9 = &gpioi2c2;
30		i2c10 = &i2chdmi;
31	};
32
33	chosen {
34		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
35		stdout-path = "serial0:115200n8";
36	};
37
38	memory@40000000 {
39		device_type = "memory";
40		reg = <0 0x40000000 0 0x40000000>;
41	};
42
43	memory@200000000 {
44		device_type = "memory";
45		reg = <2 0x00000000 0 0x40000000>;
46	};
47
48	vcc_sdhi0: regulator-vcc-sdhi0 {
49		compatible = "regulator-fixed";
50
51		regulator-name = "SDHI0 Vcc";
52		regulator-min-microvolt = <3300000>;
53		regulator-max-microvolt = <3300000>;
54		regulator-always-on;
55	};
56
57	vccq_sdhi0: regulator-vccq-sdhi0 {
58		compatible = "regulator-gpio";
59
60		regulator-name = "SDHI0 VccQ";
61		regulator-min-microvolt = <1800000>;
62		regulator-max-microvolt = <3300000>;
63
64		gpios = <&gpio2 12 GPIO_ACTIVE_HIGH>;
65		gpios-states = <1>;
66		states = <3300000 1>, <1800000 0>;
67	};
68
69	vcc_sdhi2: regulator-vcc-sdhi2 {
70		compatible = "regulator-fixed";
71
72		regulator-name = "SDHI2 Vcc";
73		regulator-min-microvolt = <3300000>;
74		regulator-max-microvolt = <3300000>;
75		regulator-always-on;
76	};
77
78	vccq_sdhi2: regulator-vccq-sdhi2 {
79		compatible = "regulator-gpio";
80
81		regulator-name = "SDHI2 VccQ";
82		regulator-min-microvolt = <1800000>;
83		regulator-max-microvolt = <3300000>;
84
85		gpios = <&gpio2 26 GPIO_ACTIVE_HIGH>;
86		gpios-states = <1>;
87		states = <3300000 1>, <1800000 0>;
88	};
89
90	hdmi-out {
91		compatible = "hdmi-connector";
92		type = "a";
93
94		port {
95			hdmi_con: endpoint {
96				remote-endpoint = <&adv7511_out>;
97			};
98		};
99	};
100
101	x3_clk: x3-clock {
102		compatible = "fixed-clock";
103		#clock-cells = <0>;
104		clock-frequency = <148500000>;
105	};
106
107	x16_clk: x16-clock {
108		compatible = "fixed-clock";
109		#clock-cells = <0>;
110		clock-frequency = <74250000>;
111	};
112
113	x14_clk: audio_clock {
114		compatible = "fixed-clock";
115		#clock-cells = <0>;
116		clock-frequency = <11289600>;
117	};
118
119	sound {
120		compatible = "simple-audio-card";
121
122		simple-audio-card,format = "left_j";
123		simple-audio-card,bitclock-master = <&soundcodec>;
124		simple-audio-card,frame-master = <&soundcodec>;
125
126		simple-audio-card,cpu {
127			sound-dai = <&rcar_sound>;
128		};
129
130		soundcodec: simple-audio-card,codec {
131			sound-dai = <&ak4642>;
132			clocks = <&x14_clk>;
133		};
134	};
135
136	gpioi2c2: i2c-9 {
137		#address-cells = <1>;
138		#size-cells = <0>;
139		compatible = "i2c-gpio";
140		status = "disabled";
141		scl-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
142		sda-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
143		i2c-gpio,delay-us = <5>;
144	};
145
146	/*
147	 * A fallback to GPIO is provided for I2C2.
148	 */
149	i2chdmi: i2c-10 {
150		compatible = "i2c-demux-pinctrl";
151		i2c-parent = <&i2c2>, <&gpioi2c2>;
152		i2c-bus-name = "i2c-hdmi";
153		#address-cells = <1>;
154		#size-cells = <0>;
155
156		ak4642: codec@12 {
157			compatible = "asahi-kasei,ak4642";
158			#sound-dai-cells = <0>;
159			reg = <0x12>;
160		};
161
162		composite-in@20 {
163			compatible = "adi,adv7180";
164			reg = <0x20>;
165			remote = <&vin0>;
166
167			port {
168				adv7180: endpoint {
169					bus-width = <8>;
170					remote-endpoint = <&vin0ep>;
171				};
172			};
173		};
174
175		hdmi@39 {
176			compatible = "adi,adv7511w";
177			reg = <0x39>;
178			interrupt-parent = <&gpio3>;
179			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
180
181			adi,input-depth = <8>;
182			adi,input-colorspace = "rgb";
183			adi,input-clock = "1x";
184			adi,input-style = <1>;
185			adi,input-justification = "evenly";
186
187			ports {
188				#address-cells = <1>;
189				#size-cells = <0>;
190
191				port@0 {
192					reg = <0>;
193					adv7511_in: endpoint {
194						remote-endpoint = <&du_out_rgb>;
195					};
196				};
197
198				port@1 {
199					reg = <1>;
200					adv7511_out: endpoint {
201						remote-endpoint = <&hdmi_con>;
202					};
203				};
204			};
205		};
206	};
207};
208
209&extal_clk {
210	clock-frequency = <20000000>;
211};
212
213&pfc {
214	scif0_pins: scif0 {
215		groups = "scif0_data_d";
216		function = "scif0";
217	};
218
219	ether_pins: ether {
220		groups = "eth_link", "eth_mdio", "eth_rmii";
221		function = "eth";
222	};
223
224	phy1_pins: phy1 {
225		groups = "intc_irq0";
226		function = "intc";
227	};
228
229	pmic_irq_pins: pmicirq {
230		groups = "intc_irq2";
231		function = "intc";
232	};
233
234	sdhi0_pins: sd0 {
235		groups = "sdhi0_data4", "sdhi0_ctrl";
236		function = "sdhi0";
237	};
238
239	sdhi2_pins: sd2 {
240		groups = "sdhi2_data4", "sdhi2_ctrl";
241		function = "sdhi2";
242	};
243
244	qspi_pins: qspi {
245		groups = "qspi_ctrl", "qspi_data4";
246		function = "qspi";
247	};
248
249	i2c2_pins: i2c2 {
250		groups = "i2c2";
251		function = "i2c2";
252	};
253
254	usb0_pins: usb0 {
255		groups = "usb0";
256		function = "usb0";
257	};
258
259	usb1_pins: usb1 {
260		groups = "usb1";
261		function = "usb1";
262	};
263
264	vin0_pins: vin0 {
265		groups = "vin0_data8", "vin0_clk";
266		function = "vin0";
267	};
268
269	can0_pins: can0 {
270		groups = "can0_data";
271		function = "can0";
272	};
273
274	du_pins: du {
275		groups = "du_rgb888", "du_sync", "du_disp", "du_clk_out_0";
276		function = "du";
277	};
278
279	ssi_pins: sound {
280		groups = "ssi0129_ctrl", "ssi0_data", "ssi1_data";
281		function = "ssi";
282	};
283
284	audio_clk_pins: audio_clk {
285		groups = "audio_clk_a";
286		function = "audio_clk";
287	};
288};
289
290&scif0 {
291	pinctrl-0 = <&scif0_pins>;
292	pinctrl-names = "default";
293
294	status = "okay";
295};
296
297&ether {
298	pinctrl-0 = <&ether_pins &phy1_pins>;
299	pinctrl-names = "default";
300
301	phy-handle = <&phy1>;
302	renesas,ether-link-active-low;
303	status = "okay";
304
305	phy1: ethernet-phy@1 {
306		reg = <1>;
307		interrupt-parent = <&irqc0>;
308		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
309		micrel,led-mode = <1>;
310	};
311};
312
313&sdhi0 {
314	pinctrl-0 = <&sdhi0_pins>;
315	pinctrl-names = "default";
316
317	vmmc-supply = <&vcc_sdhi0>;
318	vqmmc-supply = <&vccq_sdhi0>;
319	cd-gpios = <&gpio6 6 GPIO_ACTIVE_LOW>;
320	wp-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
321	status = "okay";
322};
323
324&sdhi2 {
325	pinctrl-0 = <&sdhi2_pins>;
326	pinctrl-names = "default";
327
328	vmmc-supply = <&vcc_sdhi2>;
329	vqmmc-supply = <&vccq_sdhi2>;
330	cd-gpios = <&gpio6 22 GPIO_ACTIVE_LOW>;
331	status = "okay";
332};
333
334&qspi {
335	pinctrl-0 = <&qspi_pins>;
336	pinctrl-names = "default";
337
338	status = "okay";
339
340	flash@0 {
341		compatible = "spansion,s25fl512s", "jedec,spi-nor";
342		reg = <0>;
343		spi-max-frequency = <30000000>;
344		spi-tx-bus-width = <4>;
345		spi-rx-bus-width = <4>;
346		m25p,fast-read;
347
348		partitions {
349			compatible = "fixed-partitions";
350			#address-cells = <1>;
351			#size-cells = <1>;
352
353			partition@0 {
354				label = "loader_prg";
355				reg = <0x00000000 0x00040000>;
356				read-only;
357			};
358			partition@40000 {
359				label = "user_prg";
360				reg = <0x00040000 0x00400000>;
361				read-only;
362			};
363			partition@440000 {
364				label = "flash_fs";
365				reg = <0x00440000 0x03bc0000>;
366			};
367		};
368	};
369};
370
371&i2c2 {
372	pinctrl-0 = <&i2c2_pins>;
373	pinctrl-names = "i2c-hdmi";
374
375	clock-frequency = <400000>;
376};
377
378&i2c6 {
379	pinctrl-names = "default";
380	pinctrl-0 = <&pmic_irq_pins>;
381	status = "okay";
382	clock-frequency = <100000>;
383
384	pmic@5a {
385		compatible = "dlg,da9063l";
386		reg = <0x5a>;
387		interrupt-parent = <&irqc0>;
388		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
389		interrupt-controller;
390
391		wdt {
392			compatible = "dlg,da9063-watchdog";
393		};
394	};
395
396	vdd_dvfs: regulator@68 {
397		compatible = "dlg,da9210";
398		reg = <0x68>;
399		interrupt-parent = <&irqc0>;
400		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
401
402		regulator-min-microvolt = <1000000>;
403		regulator-max-microvolt = <1000000>;
404		regulator-boot-on;
405		regulator-always-on;
406	};
407};
408
409&sata0 {
410	status = "okay";
411};
412
413&cpu0 {
414	cpu0-supply = <&vdd_dvfs>;
415};
416
417/* composite video input */
418&vin0 {
419	status = "okay";
420	pinctrl-0 = <&vin0_pins>;
421	pinctrl-names = "default";
422
423	port {
424		vin0ep: endpoint {
425			remote-endpoint = <&adv7180>;
426			bus-width = <8>;
427		};
428	};
429};
430
431&pci0 {
432	pinctrl-0 = <&usb0_pins>;
433	pinctrl-names = "default";
434
435	status = "okay";
436};
437
438&pci1 {
439	pinctrl-0 = <&usb1_pins>;
440	pinctrl-names = "default";
441
442	status = "okay";
443};
444
445&hsusb {
446	pinctrl-0 = <&usb0_pins>;
447	pinctrl-names = "default";
448
449	status = "okay";
450};
451
452&usbphy {
453	status = "okay";
454};
455
456&pcie_bus_clk {
457	clock-frequency = <100000000>;
458};
459
460&pciec {
461	status = "okay";
462};
463
464&can0 {
465	pinctrl-0 = <&can0_pins>;
466	pinctrl-names = "default";
467
468	status = "okay";
469};
470
471&du {
472	pinctrl-0 = <&du_pins>;
473	pinctrl-names = "default";
474	status = "okay";
475
476	clocks = <&cpg CPG_MOD 724>, <&cpg CPG_MOD 723>,
477		 <&x3_clk>, <&x16_clk>;
478	clock-names = "du.0", "du.1", "dclkin.0", "dclkin.1";
479
480	ports {
481		port@0 {
482			endpoint {
483				remote-endpoint = <&adv7511_in>;
484			};
485		};
486	};
487};
488
489&lvds0 {
490	ports {
491		port@1 {
492			lvds_connector: endpoint {
493			};
494		};
495	};
496};
497
498&rcar_sound {
499	pinctrl-0 = <&ssi_pins &audio_clk_pins>;
500	pinctrl-names = "default";
501	status = "okay";
502
503	/* Single DAI */
504	#sound-dai-cells = <0>;
505
506	rcar_sound,dai {
507		dai0 {
508			playback = <&ssi0>;
509			capture  = <&ssi1>;
510		};
511	};
512};
513
514&rwdt {
515	timeout-sec = <60>;
516	status = "okay";
517};
518
519&ssi1 {
520	shared-pin;
521};
522