1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 *  at91-sama7g5ek.dts - Device Tree file for SAMA7G5-EK board
4 *
5 *  Copyright (c) 2020 Microchip Technology Inc. and its subsidiaries
6 *
7 *  Author: Eugen Hristev <eugen.hristev@microchip.com>
8 *  Author: Claudiu Beznea <claudiu.beznea@microchip.com>
9 *
10 */
11/dts-v1/;
12#include "sama7g5-pinfunc.h"
13#include "sama7g5.dtsi"
14#include <dt-bindings/mfd/atmel-flexcom.h>
15#include <dt-bindings/input/input.h>
16
17/ {
18	model = "Microchip SAMA7G5-EK";
19	compatible = "microchip,sama7g5ek", "microchip,sama7g5", "microchip,sama7";
20
21	chosen {
22		bootargs = "rw root=/dev/mmcblk1p2 rootfstype=ext4 rootwait";
23		stdout-path = "serial0:115200n8";
24	};
25
26	aliases {
27		serial0 = &uart3;
28		serial1 = &uart4;
29		serial2 = &uart7;
30		serial3 = &uart0;
31		i2c0 = &i2c1;
32		i2c1 = &i2c8;
33		i2c2 = &i2c9;
34	};
35
36	clocks {
37		slow_xtal {
38			clock-frequency = <32768>;
39		};
40
41		main_xtal {
42			clock-frequency = <24000000>;
43		};
44	};
45
46	gpio_keys {
47		compatible = "gpio-keys";
48
49		pinctrl-names = "default";
50		pinctrl-0 = <&pinctrl_key_gpio_default>;
51
52		bp1 {
53			label = "PB_USER";
54			gpios = <&pioA PIN_PA12 GPIO_ACTIVE_LOW>;
55			linux,code = <KEY_PROG1>;
56			wakeup-source;
57		};
58	};
59
60	leds {
61		compatible = "gpio-leds";
62		pinctrl-names = "default";
63		pinctrl-0 = <&pinctrl_led_gpio_default>;
64		status = "okay"; /* Conflict with pwm. */
65
66		red_led {
67			label = "red";
68			gpios = <&pioA PIN_PB8 GPIO_ACTIVE_HIGH>;
69		};
70
71		green_led {
72			label = "green";
73			gpios = <&pioA PIN_PA13 GPIO_ACTIVE_HIGH>;
74		};
75
76		blue_led {
77			label = "blue";
78			gpios = <&pioA PIN_PD20 GPIO_ACTIVE_HIGH>;
79			linux,default-trigger = "heartbeat";
80		};
81	};
82
83	/* 512 M */
84	memory@60000000 {
85		device_type = "memory";
86		reg = <0x60000000 0x20000000>;
87	};
88
89	sound: sound {
90		compatible = "simple-audio-card";
91		simple-audio-card,name = "sama7g5ek audio";
92		#address-cells = <1>;
93		#size-cells = <0>;
94		simple-audio-card,dai-link@0 {
95			reg = <0>;
96			cpu {
97				sound-dai = <&spdiftx>;
98			};
99			codec {
100				sound-dai = <&spdif_out>;
101			};
102		};
103		simple-audio-card,dai-link@1 {
104			reg = <1>;
105			cpu {
106				sound-dai = <&spdifrx>;
107			};
108			codec {
109				sound-dai = <&spdif_in>;
110			};
111		};
112	};
113
114	spdif_in: spdif-in {
115		#sound-dai-cells = <0>;
116		compatible = "linux,spdif-dir";
117	};
118
119	spdif_out: spdif-out {
120		#sound-dai-cells = <0>;
121		compatible = "linux,spdif-dit";
122	};
123};
124
125&cpu0 {
126	cpu-supply = <&vddcpu>;
127};
128
129&dma0 {
130	status = "okay";
131};
132
133&dma1 {
134	status = "okay";
135};
136
137&dma2 {
138	status = "okay";
139};
140
141&flx0 {
142	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
143	status = "disabled";
144
145	uart0: serial@200 {
146		pinctrl-names = "default";
147		pinctrl-0 = <&pinctrl_flx0_default>;
148		status = "disabled";
149	};
150};
151
152&flx1 {
153	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
154	status = "okay";
155
156	i2c1: i2c@600 {
157		pinctrl-names = "default";
158		pinctrl-0 = <&pinctrl_i2c1_default>;
159		i2c-analog-filter;
160		i2c-digital-filter;
161		i2c-digital-filter-width-ns = <35>;
162		status = "okay";
163
164		mcp16502@5b {
165			compatible = "microchip,mcp16502";
166			reg = <0x5b>;
167			status = "okay";
168
169			regulators {
170				vdd_3v3: VDD_IO {
171					regulator-name = "VDD_IO";
172					regulator-min-microvolt = <1200000>;
173					regulator-max-microvolt = <3700000>;
174					regulator-initial-mode = <2>;
175					regulator-allowed-modes = <2>, <4>;
176					regulator-always-on;
177
178					regulator-state-standby {
179						regulator-on-in-suspend;
180						regulator-mode = <4>;
181					};
182
183					regulator-state-mem {
184						regulator-off-in-suspend;
185						regulator-mode = <4>;
186					};
187				};
188
189				vddioddr: VDD_DDR {
190					regulator-name = "VDD_DDR";
191					regulator-min-microvolt = <1300000>;
192					regulator-max-microvolt = <1450000>;
193					regulator-initial-mode = <2>;
194					regulator-allowed-modes = <2>, <4>;
195					regulator-always-on;
196
197					regulator-state-standby {
198						regulator-on-in-suspend;
199						regulator-suspend-microvolt = <1350000>;
200						regulator-mode = <4>;
201					};
202
203					regulator-state-mem {
204						regulator-on-in-suspend;
205						regulator-suspend-microvolt = <1350000>;
206						regulator-mode = <4>;
207					};
208				};
209
210				vddcore: VDD_CORE {
211					regulator-name = "VDD_CORE";
212					regulator-min-microvolt = <1100000>;
213					regulator-max-microvolt = <1850000>;
214					regulator-initial-mode = <2>;
215					regulator-allowed-modes = <2>, <4>;
216					regulator-always-on;
217
218					regulator-state-standby {
219						regulator-on-in-suspend;
220						regulator-mode = <4>;
221					};
222
223					regulator-state-mem {
224						regulator-off-in-suspend;
225						regulator-mode = <4>;
226					};
227				};
228
229				vddcpu: VDD_OTHER {
230					regulator-name = "VDD_OTHER";
231					regulator-min-microvolt = <1125000>;
232					regulator-max-microvolt = <1850000>;
233					regulator-initial-mode = <2>;
234					regulator-allowed-modes = <2>, <4>;
235					regulator-ramp-delay = <3125>;
236					regulator-always-on;
237
238					regulator-state-standby {
239						regulator-on-in-suspend;
240						regulator-mode = <4>;
241					};
242
243					regulator-state-mem {
244						regulator-off-in-suspend;
245						regulator-mode = <4>;
246					};
247				};
248
249				vldo1: LDO1 {
250					regulator-name = "LDO1";
251					regulator-min-microvolt = <1200000>;
252					regulator-max-microvolt = <3700000>;
253					regulator-always-on;
254
255					regulator-state-standby {
256						regulator-on-in-suspend;
257					};
258
259					regulator-state-mem {
260						regulator-off-in-suspend;
261					};
262				};
263
264				vldo2: LDO2 {
265					regulator-name = "LDO2";
266					regulator-min-microvolt = <1200000>;
267					regulator-max-microvolt = <3700000>;
268
269					regulator-state-standby {
270						regulator-on-in-suspend;
271					};
272
273					regulator-state-mem {
274						regulator-off-in-suspend;
275					};
276				};
277			};
278		};
279	};
280};
281
282&flx3 {
283	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
284	status = "okay";
285
286	uart3: serial@200 {
287		pinctrl-names = "default";
288		pinctrl-0 = <&pinctrl_flx3_default>;
289		status = "okay";
290	};
291};
292
293&flx4 {
294	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
295	status = "okay";
296
297	uart4: serial@200 {
298		pinctrl-names = "default";
299		pinctrl-0 = <&pinctrl_flx4_default>;
300		status = "okay";
301	};
302};
303
304&flx7 {
305	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
306	status = "okay";
307
308	uart7: serial@200 {
309		pinctrl-names = "default";
310		pinctrl-0 = <&pinctrl_flx7_default>;
311		status = "okay";
312	};
313};
314
315&flx8 {
316	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
317	status = "okay";
318
319	i2c8: i2c@600 {
320		pinctrl-names = "default";
321		pinctrl-0 = <&pinctrl_i2c8_default>;
322		i2c-analog-filter;
323		i2c-digital-filter;
324		i2c-digital-filter-width-ns = <35>;
325		status = "okay";
326	};
327};
328
329&flx9 {
330	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
331	status = "okay";
332
333	i2c9: i2c@600 {
334		pinctrl-names = "default";
335		pinctrl-0 = <&pinctrl_i2c9_default>;
336		i2c-analog-filter;
337		i2c-digital-filter;
338		i2c-digital-filter-width-ns = <35>;
339		status = "okay";
340	};
341};
342
343&flx11 {
344	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
345	status = "okay";
346
347	spi11: spi@400 {
348		pinctrl-names = "default";
349		pinctrl-0 = <&pinctrl_mikrobus1_spi &pinctrl_mikrobus1_spi_cs>;
350		status = "okay";
351	};
352};
353
354&gmac0 {
355	#address-cells = <1>;
356	#size-cells = <0>;
357	pinctrl-names = "default";
358	pinctrl-0 = <&pinctrl_gmac0_default
359		     &pinctrl_gmac0_mdio_default
360		     &pinctrl_gmac0_txck_default
361		     &pinctrl_gmac0_phy_irq>;
362	phy-mode = "rgmii-id";
363	status = "okay";
364
365	ethernet-phy@7 {
366		reg = <0x7>;
367		interrupt-parent = <&pioA>;
368		interrupts = <PIN_PA31 IRQ_TYPE_LEVEL_LOW>;
369	};
370};
371
372&gmac1 {
373	#address-cells = <1>;
374	#size-cells = <0>;
375	pinctrl-names = "default";
376	pinctrl-0 = <&pinctrl_gmac1_default
377		     &pinctrl_gmac1_mdio_default
378		     &pinctrl_gmac1_phy_irq>;
379	phy-mode = "rmii";
380	status = "okay";
381
382	ethernet-phy@0 {
383		reg = <0x0>;
384		interrupt-parent = <&pioA>;
385		interrupts = <PIN_PA21 IRQ_TYPE_LEVEL_LOW>;
386	};
387};
388
389&i2s0 {
390	pinctrl-names = "default";
391	pinctrl-0 = <&pinctrl_i2s0_default>;
392};
393
394&pioA {
395	pinctrl_flx0_default: flx0_default {
396		pinmux = <PIN_PE3__FLEXCOM0_IO0>,
397			 <PIN_PE4__FLEXCOM0_IO1>,
398			 <PIN_PE6__FLEXCOM0_IO3>,
399			 <PIN_PE7__FLEXCOM0_IO4>;
400		bias-disable;
401	};
402
403	pinctrl_flx3_default: flx3_default {
404		pinmux = <PIN_PD16__FLEXCOM3_IO0>,
405			 <PIN_PD17__FLEXCOM3_IO1>;
406		bias-disable;
407	};
408
409	pinctrl_flx4_default: flx4_default {
410		pinmux = <PIN_PD18__FLEXCOM4_IO0>,
411			 <PIN_PD19__FLEXCOM4_IO1>;
412		bias-disable;
413	};
414
415	pinctrl_flx7_default: flx7_default {
416		pinmux = <PIN_PC23__FLEXCOM7_IO0>,
417			 <PIN_PC24__FLEXCOM7_IO1>;
418		bias-disable;
419	};
420
421	pinctrl_gmac0_default: gmac0_default {
422		pinmux = <PIN_PA16__G0_TX0>,
423			 <PIN_PA17__G0_TX1>,
424			 <PIN_PA26__G0_TX2>,
425			 <PIN_PA27__G0_TX3>,
426			 <PIN_PA19__G0_RX0>,
427			 <PIN_PA20__G0_RX1>,
428			 <PIN_PA28__G0_RX2>,
429			 <PIN_PA29__G0_RX3>,
430			 <PIN_PA15__G0_TXEN>,
431			 <PIN_PA30__G0_RXCK>,
432			 <PIN_PA18__G0_RXDV>,
433			 <PIN_PA25__G0_125CK>;
434		slew-rate = <0>;
435		bias-disable;
436	};
437
438	pinctrl_gmac0_mdio_default: gmac0_mdio_default {
439		pinmux = <PIN_PA22__G0_MDC>,
440			 <PIN_PA23__G0_MDIO>;
441		bias-disable;
442	};
443
444	pinctrl_gmac0_txck_default: gmac0_txck_default {
445		pinmux = <PIN_PA24__G0_TXCK>;
446		slew-rate = <0>;
447		bias-pull-up;
448	};
449
450	pinctrl_gmac0_phy_irq: gmac0_phy_irq {
451		pinmux = <PIN_PA31__GPIO>;
452		bias-disable;
453	};
454
455	pinctrl_gmac1_default: gmac1_default {
456		pinmux = <PIN_PD30__G1_TXCK>,
457			 <PIN_PD22__G1_TX0>,
458			 <PIN_PD23__G1_TX1>,
459			 <PIN_PD21__G1_TXEN>,
460			 <PIN_PD25__G1_RX0>,
461			 <PIN_PD26__G1_RX1>,
462			 <PIN_PD27__G1_RXER>,
463			 <PIN_PD24__G1_RXDV>;
464		slew-rate = <0>;
465		bias-disable;
466	};
467
468	pinctrl_gmac1_mdio_default: gmac1_mdio_default {
469		pinmux = <PIN_PD28__G1_MDC>,
470			 <PIN_PD29__G1_MDIO>;
471		bias-disable;
472	};
473
474	pinctrl_gmac1_phy_irq: gmac1_phy_irq {
475		pinmux = <PIN_PA21__GPIO>;
476		bias-disable;
477	};
478
479	pinctrl_i2c1_default: i2c1_default {
480		pinmux = <PIN_PC9__FLEXCOM1_IO0>,
481			 <PIN_PC10__FLEXCOM1_IO1>;
482		bias-disable;
483	};
484
485	pinctrl_i2c8_default: i2c8_default {
486		pinmux = <PIN_PC14__FLEXCOM8_IO0>,
487			 <PIN_PC13__FLEXCOM8_IO1>;
488		bias-disable;
489	};
490
491	pinctrl_i2c9_default: i2c9_default {
492		pinmux = <PIN_PC18__FLEXCOM9_IO0>,
493			 <PIN_PC19__FLEXCOM9_IO1>;
494		bias-disable;
495	};
496
497	pinctrl_i2s0_default: i2s0_default {
498		pinmux = <PIN_PB23__I2SMCC0_CK>,
499			 <PIN_PB24__I2SMCC0_WS>,
500			 <PIN_PB25__I2SMCC0_DOUT1>,
501			 <PIN_PB26__I2SMCC0_DOUT0>,
502			 <PIN_PB27__I2SMCC0_MCK>;
503		bias-disable;
504	};
505
506	pinctrl_key_gpio_default: key_gpio_default {
507		pinmux = <PIN_PA12__GPIO>;
508		bias-pull-up;
509	};
510
511	pinctrl_led_gpio_default: led_gpio_default {
512		pinmux = <PIN_PA13__GPIO>,
513			 <PIN_PB8__GPIO>,
514			 <PIN_PD20__GPIO>;
515		bias-pull-up;
516	};
517
518	pinctrl_mikrobus1_an_default: mikrobus1_an_default {
519		pinmux = <PIN_PD0__GPIO>;
520		bias-disable;
521	};
522
523	pinctrl_mikrobus2_an_default: mikrobus2_an_default {
524		pinmux = <PIN_PD1__GPIO>;
525		bias-disable;
526	};
527
528	pinctrl_mikrobus1_pwm2_default: mikrobus1_pwm2_default {
529		pinmux = <PIN_PA13__PWMH2>;
530		bias-disable;
531	};
532
533	pinctrl_mikrobus2_pwm3_default: mikrobus2_pwm3_default {
534		pinmux = <PIN_PD20__PWMH3>;
535		bias-disable;
536	};
537
538	pinctrl_mikrobus1_spi_cs: mikrobus1_spi_cs {
539		pinmux = <PIN_PB6__FLEXCOM11_IO3>;
540		bias-disable;
541	};
542
543	pinctrl_mikrobus1_spi: mikrobus1_spi {
544		pinmux = <PIN_PB3__FLEXCOM11_IO0>,
545			 <PIN_PB4__FLEXCOM11_IO1>,
546			 <PIN_PB5__FLEXCOM11_IO2>;
547		bias-disable;
548	};
549
550	pinctrl_sdmmc0_default: sdmmc0_default {
551		cmd_data {
552			pinmux = <PIN_PA1__SDMMC0_CMD>,
553				 <PIN_PA3__SDMMC0_DAT0>,
554				 <PIN_PA4__SDMMC0_DAT1>,
555				 <PIN_PA5__SDMMC0_DAT2>,
556				 <PIN_PA6__SDMMC0_DAT3>,
557				 <PIN_PA7__SDMMC0_DAT4>,
558				 <PIN_PA8__SDMMC0_DAT5>,
559				 <PIN_PA9__SDMMC0_DAT6>,
560				 <PIN_PA10__SDMMC0_DAT7>;
561			slew-rate = <0>;
562			bias-pull-up;
563		};
564
565		ck_cd_rstn_vddsel {
566			pinmux = <PIN_PA0__SDMMC0_CK>,
567				 <PIN_PA2__SDMMC0_RSTN>,
568				 <PIN_PA11__SDMMC0_DS>;
569			slew-rate = <0>;
570			bias-pull-up;
571		};
572	};
573
574	pinctrl_sdmmc1_default: sdmmc1_default {
575		cmd_data {
576			pinmux = <PIN_PB29__SDMMC1_CMD>,
577				 <PIN_PB31__SDMMC1_DAT0>,
578				 <PIN_PC0__SDMMC1_DAT1>,
579				 <PIN_PC1__SDMMC1_DAT2>,
580				 <PIN_PC2__SDMMC1_DAT3>;
581			slew-rate = <0>;
582			bias-pull-up;
583		};
584
585		ck_cd_rstn_vddsel {
586			pinmux = <PIN_PB30__SDMMC1_CK>,
587				 <PIN_PB28__SDMMC1_RSTN>,
588				 <PIN_PC5__SDMMC1_1V8SEL>,
589				 <PIN_PC4__SDMMC1_CD>;
590			slew-rate = <0>;
591			bias-pull-up;
592		};
593	};
594
595	pinctrl_sdmmc2_default: sdmmc2_default {
596		cmd_data {
597			pinmux = <PIN_PD3__SDMMC2_CMD>,
598				 <PIN_PD5__SDMMC2_DAT0>,
599				 <PIN_PD6__SDMMC2_DAT1>,
600				 <PIN_PD7__SDMMC2_DAT2>,
601				 <PIN_PD8__SDMMC2_DAT3>;
602			slew-rate = <0>;
603			bias-pull-up;
604		};
605
606		ck {
607			pinmux = <PIN_PD4__SDMMC2_CK>;
608			slew-rate = <0>;
609			bias-pull-up;
610		};
611	};
612
613	pinctrl_spdifrx_default: spdifrx_default {
614		pinmux = <PIN_PB0__SPDIF_RX>;
615		bias-disable;
616	};
617
618	pinctrl_spdiftx_default: spdiftx_default {
619		pinmux = <PIN_PB1__SPDIF_TX>;
620		bias-disable;
621	};
622};
623
624&pwm {
625	pinctrl-names = "default";
626	pinctrl-0 = <&pinctrl_mikrobus1_pwm2_default &pinctrl_mikrobus2_pwm3_default>;
627	status = "disabled"; /* Conflict with leds. */
628};
629
630&rtt {
631	atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
632};
633
634&sdmmc0 {
635	bus-width = <8>;
636	non-removable;
637	no-1-8-v;
638	sdhci-caps-mask = <0x0 0x00200000>;
639	pinctrl-names = "default";
640	pinctrl-0 = <&pinctrl_sdmmc0_default>;
641	status = "okay";
642};
643
644&sdmmc1 {
645	bus-width = <4>;
646	no-1-8-v;
647	sdhci-caps-mask = <0x0 0x00200000>;
648	pinctrl-names = "default";
649	pinctrl-0 = <&pinctrl_sdmmc1_default>;
650	status = "okay";
651};
652
653&sdmmc2 {
654	bus-width = <4>;
655	no-1-8-v;
656	sdhci-caps-mask = <0x0 0x00200000>;
657	pinctrl-names = "default";
658	pinctrl-0 = <&pinctrl_sdmmc2_default>;
659};
660
661&shdwc {
662	atmel,shdwc-debouncer = <976>;
663	status = "okay";
664
665	input@0 {
666		reg = <0>;
667	};
668};
669
670&spdifrx {
671	pinctrl-names = "default";
672	pinctrl-0 = <&pinctrl_spdifrx_default>;
673	status = "okay";
674};
675
676&spdiftx {
677	pinctrl-names = "default";
678	pinctrl-0 = <&pinctrl_spdiftx_default>;
679	status = "okay";
680};
681
682&trng {
683	status = "okay";
684};
685
686&vddout25 {
687	vin-supply = <&vdd_3v3>;
688	status = "okay";
689};
690