1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2/*
3 * Device Tree Source for the R-Car V4M Gray Hawk Single board
4 *
5 * Copyright (C) 2023 Renesas Electronics Corp.
6 * Copyright (C) 2024 Glider bv
7 */
8/*
9 * [How to use Sound]
10 *
11 * Because R-Car V4M has only 1 SSI, it cannot handle both Playback/Capture
12 * at the same time. You need to switch the direction which is controlled
13 * by the GP0_01 pin via amixer.
14 *
15 * Playback (CN9500)
16 *	> amixer set "MUX" "Playback"	// for GP0_01
17 *	> amixer set "DAC 1" 85%
18 *	> aplay xxx.wav
19 *
20 * Capture (CN9501)
21 *	> amixer set "MUX" "Capture"	// for GP0_01
22 *	> amixer set "Mic 1" 80%
23 *	> amixer set "ADC 1" on
24 *	> amixer set 'ADC 1' 80%
25 *	> arecord xxx hoge.wav
26 */
27
28/dts-v1/;
29
30#include <dt-bindings/gpio/gpio.h>
31#include <dt-bindings/input/input.h>
32#include <dt-bindings/leds/common.h>
33
34#include "r8a779h0.dtsi"
35
36/ {
37	model = "Renesas Gray Hawk Single board based on r8a779h0";
38	compatible = "renesas,gray-hawk-single", "renesas,r8a779h0";
39
40	aliases {
41		i2c0 = &i2c0;
42		i2c1 = &i2c1;
43		i2c2 = &i2c2;
44		i2c3 = &i2c3;
45		serial0 = &hscif0;
46		serial1 = &hscif2;
47		ethernet0 = &avb0;
48	};
49
50	can_transceiver0: can-phy0 {
51		compatible = "nxp,tjr1443";
52		#phy-cells = <0>;
53		enable-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
54		max-bitrate = <5000000>;
55	};
56
57	chosen {
58		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
59		stdout-path = "serial0:921600n8";
60	};
61
62	keys {
63		compatible = "gpio-keys";
64
65		pinctrl-0 = <&keys_pins>;
66		pinctrl-names = "default";
67
68		key-1 {
69			gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
70			linux,code = <KEY_1>;
71			label = "SW47";
72			wakeup-source;
73			debounce-interval = <20>;
74		};
75
76		key-2 {
77			gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
78			linux,code = <KEY_2>;
79			label = "SW48";
80			wakeup-source;
81			debounce-interval = <20>;
82		};
83
84		key-3 {
85			gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;
86			linux,code = <KEY_3>;
87			label = "SW49";
88			wakeup-source;
89			debounce-interval = <20>;
90		};
91	};
92
93	leds {
94		compatible = "gpio-leds";
95
96		led-1 {
97			gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
98			color = <LED_COLOR_ID_GREEN>;
99			function = LED_FUNCTION_INDICATOR;
100			function-enumerator = <1>;
101		};
102
103		led-2 {
104			gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
105			color = <LED_COLOR_ID_GREEN>;
106			function = LED_FUNCTION_INDICATOR;
107			function-enumerator = <2>;
108		};
109
110		led-3 {
111			gpios = <&gpio7 2 GPIO_ACTIVE_HIGH>;
112			color = <LED_COLOR_ID_GREEN>;
113			function = LED_FUNCTION_INDICATOR;
114			function-enumerator = <3>;
115		};
116	};
117
118	memory@48000000 {
119		device_type = "memory";
120		/* first 128MB is reserved for secure area. */
121		reg = <0x0 0x48000000 0x0 0x78000000>;
122	};
123
124	memory@480000000 {
125		device_type = "memory";
126		reg = <0x4 0x80000000 0x1 0x80000000>;
127	};
128
129	reg_1p8v: regulator-1p8v {
130			compatible = "regulator-fixed";
131			regulator-name = "fixed-1.8V";
132			regulator-min-microvolt = <1800000>;
133			regulator-max-microvolt = <1800000>;
134			regulator-boot-on;
135			regulator-always-on;
136	};
137
138	reg_3p3v: regulator-3p3v {
139			compatible = "regulator-fixed";
140			regulator-name = "fixed-3.3V";
141			regulator-min-microvolt = <3300000>;
142			regulator-max-microvolt = <3300000>;
143			regulator-boot-on;
144			regulator-always-on;
145	};
146
147	sound_mux: sound-mux {
148		compatible = "simple-audio-mux";
149		mux-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
150		state-labels = "Playback", "Capture";
151	};
152
153	sound_card: sound {
154		compatible = "audio-graph-card2";
155		label = "rcar-sound";
156		aux-devs = <&sound_mux>; // for GP0_01
157
158		links = <&rsnd_port>; // AK4619 Audio Codec
159	};
160};
161
162&audio_clkin {
163	clock-frequency = <24576000>;
164};
165
166&avb0 {
167	pinctrl-0 = <&avb0_pins>;
168	pinctrl-names = "default";
169	phy-handle = <&phy0>;
170	tx-internal-delay-ps = <2000>;
171	status = "okay";
172
173	phy0: ethernet-phy@0 {
174		compatible = "ethernet-phy-id0022.1622",
175			     "ethernet-phy-ieee802.3-c22";
176		rxc-skew-ps = <1500>;
177		reg = <0>;
178		interrupt-parent = <&gpio7>;
179		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
180		reset-gpios = <&gpio7 10 GPIO_ACTIVE_LOW>;
181	};
182};
183
184&can_clk {
185	clock-frequency = <40000000>;
186};
187
188&canfd {
189	pinctrl-0 = <&canfd0_pins>, <&canfd1_pins>, <&can_clk_pins>;
190	pinctrl-names = "default";
191	status = "okay";
192
193	channel0 {
194		status = "okay";
195		phys = <&can_transceiver0>;
196	};
197
198	channel1 {
199		status = "okay";
200	};
201};
202
203&extal_clk {
204	clock-frequency = <16666666>;
205};
206
207&extalr_clk {
208	clock-frequency = <32768>;
209};
210
211&gpio1 {
212	audio-power-hog {
213		gpio-hog;
214		gpios = <8 GPIO_ACTIVE_HIGH>;
215		output-high;
216		line-name = "Audio-Power";
217	};
218};
219
220&hscif0 {
221	pinctrl-0 = <&hscif0_pins>;
222	pinctrl-names = "default";
223
224	uart-has-rtscts;
225	status = "okay";
226};
227
228&hscif2 {
229	pinctrl-0 = <&hscif2_pins>;
230	pinctrl-names = "default";
231
232	uart-has-rtscts;
233	status = "okay";
234};
235
236&i2c0 {
237	pinctrl-0 = <&i2c0_pins>;
238	pinctrl-names = "default";
239
240	status = "okay";
241	clock-frequency = <400000>;
242
243	eeprom@50 {
244		compatible = "rohm,br24g01", "atmel,24c01";
245		label = "cpu-board";
246		reg = <0x50>;
247		pagesize = <8>;
248	};
249
250	eeprom@51 {
251		compatible = "rohm,br24g01", "atmel,24c01";
252		label = "breakout-board";
253		reg = <0x51>;
254		pagesize = <8>;
255	};
256
257	eeprom@52 {
258		compatible = "rohm,br24g01", "atmel,24c01";
259		label = "csi-dsi-sub-board-id";
260		reg = <0x52>;
261		pagesize = <8>;
262	};
263
264	eeprom@53 {
265		compatible = "rohm,br24g01", "atmel,24c01";
266		label = "ethernet-sub-board-id";
267		reg = <0x53>;
268		pagesize = <8>;
269	};
270};
271
272&i2c3 {
273	pinctrl-0 = <&i2c3_pins>;
274	pinctrl-names = "default";
275
276	status = "okay";
277	clock-frequency = <400000>;
278
279	codec@10 {
280		compatible = "asahi-kasei,ak4619";
281		reg = <0x10>;
282
283		clocks = <&rcar_sound>;
284		clock-names = "mclk";
285
286		#sound-dai-cells = <0>;
287		port {
288			ak4619_endpoint: endpoint {
289				remote-endpoint = <&rsnd_endpoint>;
290			};
291		};
292	};
293};
294
295&mmc0 {
296	pinctrl-0 = <&mmc_pins>;
297	pinctrl-1 = <&mmc_pins>;
298	pinctrl-names = "default", "state_uhs";
299
300	vmmc-supply = <&reg_3p3v>;
301	vqmmc-supply = <&reg_1p8v>;
302	mmc-hs200-1_8v;
303	mmc-hs400-1_8v;
304	bus-width = <8>;
305	no-sd;
306	no-sdio;
307	non-removable;
308	full-pwr-cycle-in-suspend;
309	status = "okay";
310};
311
312&pfc {
313	pinctrl-0 = <&scif_clk_pins>, <&scif_clk2_pins>;
314	pinctrl-names = "default";
315
316	avb0_pins: avb0 {
317		mux {
318			groups = "avb0_link", "avb0_mdio", "avb0_rgmii",
319				 "avb0_txcrefclk";
320			function = "avb0";
321		};
322
323		pins_mdio {
324			groups = "avb0_mdio";
325			drive-strength = <21>;
326		};
327
328		pins_mii {
329			groups = "avb0_rgmii";
330			drive-strength = <21>;
331		};
332	};
333
334	can_clk_pins: can-clk {
335		groups = "can_clk";
336		function = "can_clk";
337	};
338
339	canfd0_pins: canfd0 {
340		groups = "canfd0_data";
341		function = "canfd0";
342	};
343
344	canfd1_pins: canfd1 {
345		groups = "canfd1_data";
346		function = "canfd1";
347	};
348
349	hscif0_pins: hscif0 {
350		groups = "hscif0_data", "hscif0_ctrl";
351		function = "hscif0";
352	};
353
354	hscif2_pins: hscif2 {
355		groups = "hscif2_data", "hscif2_ctrl";
356		function = "hscif2";
357	};
358
359	i2c0_pins: i2c0 {
360		groups = "i2c0";
361		function = "i2c0";
362	};
363
364	i2c3_pins: i2c3 {
365		groups = "i2c3";
366		function = "i2c3";
367	};
368
369	keys_pins: keys {
370		pins = "GP_5_0", "GP_5_1", "GP_5_2";
371		bias-pull-up;
372	};
373
374	mmc_pins: mmc {
375		groups = "mmc_data8", "mmc_ctrl", "mmc_ds";
376		function = "mmc";
377		power-source = <1800>;
378	};
379
380	qspi0_pins: qspi0 {
381		groups = "qspi0_ctrl", "qspi0_data4";
382		function = "qspi0";
383	};
384
385	scif_clk_pins: scif-clk {
386		groups = "scif_clk";
387		function = "scif_clk";
388	};
389
390	scif_clk2_pins: scif-clk2 {
391		groups = "scif_clk2";
392		function = "scif_clk2";
393	};
394
395	sound_clk_pins: sound_clk {
396		groups = "audio_clkin", "audio_clkout";
397		function = "audio_clk";
398	};
399
400	sound_pins: sound {
401		groups = "ssi_ctrl", "ssi_data";
402		function = "ssi";
403	};
404};
405
406&rcar_sound {
407	pinctrl-0 = <&sound_clk_pins>, <&sound_pins>;
408	pinctrl-names = "default";
409
410	status = "okay";
411
412	/* audio_clkout */
413	clock-frequency = <12288000>;
414
415	ports {
416		rsnd_port: port {
417			rsnd_endpoint: endpoint {
418				remote-endpoint = <&ak4619_endpoint>;
419				bitclock-master;
420				frame-master;
421
422				/* see above [How to use Sound] */
423				playback = <&ssi0>;
424				capture  = <&ssi0>;
425			};
426		};
427	};
428};
429
430&rpc {
431	pinctrl-0 = <&qspi0_pins>;
432	pinctrl-names = "default";
433
434	status = "okay";
435
436	flash@0 {
437		compatible = "spansion,s25fs512s", "jedec,spi-nor";
438		reg = <0>;
439		spi-max-frequency = <40000000>;
440		spi-rx-bus-width = <4>;
441
442		partitions {
443			compatible = "fixed-partitions";
444			#address-cells = <1>;
445			#size-cells = <1>;
446
447			boot@0 {
448				reg = <0x0 0x1200000>;
449				read-only;
450			};
451			user@1200000 {
452				reg = <0x1200000 0x2e00000>;
453			};
454		};
455	};
456};
457
458&rwdt {
459	timeout-sec = <60>;
460	status = "okay";
461};
462
463&scif_clk {
464	clock-frequency = <24000000>;
465};
466
467&scif_clk2 {
468	clock-frequency = <24000000>;
469};
470