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&adc {
126	vddana-supply = <&vddout25>;
127	vref-supply = <&vddout25>;
128	pinctrl-names = "default";
129	pinctrl-0 = <&pinctrl_mikrobus1_an_default &pinctrl_mikrobus2_an_default>;
130	status = "okay";
131};
132
133&cpu0 {
134	cpu-supply = <&vddcpu>;
135};
136
137&dma0 {
138	status = "okay";
139};
140
141&dma1 {
142	status = "okay";
143};
144
145&dma2 {
146	status = "okay";
147};
148
149&flx0 {
150	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
151	status = "disabled";
152
153	uart0: serial@200 {
154		pinctrl-names = "default";
155		pinctrl-0 = <&pinctrl_flx0_default>;
156		status = "disabled";
157	};
158};
159
160&flx1 {
161	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
162	status = "okay";
163
164	i2c1: i2c@600 {
165		pinctrl-names = "default";
166		pinctrl-0 = <&pinctrl_i2c1_default>;
167		i2c-analog-filter;
168		i2c-digital-filter;
169		i2c-digital-filter-width-ns = <35>;
170		status = "okay";
171
172		mcp16502@5b {
173			compatible = "microchip,mcp16502";
174			reg = <0x5b>;
175			status = "okay";
176
177			regulators {
178				vdd_3v3: VDD_IO {
179					regulator-name = "VDD_IO";
180					regulator-min-microvolt = <1200000>;
181					regulator-max-microvolt = <3700000>;
182					regulator-initial-mode = <2>;
183					regulator-allowed-modes = <2>, <4>;
184					regulator-always-on;
185
186					regulator-state-standby {
187						regulator-on-in-suspend;
188						regulator-mode = <4>;
189					};
190
191					regulator-state-mem {
192						regulator-off-in-suspend;
193						regulator-mode = <4>;
194					};
195				};
196
197				vddioddr: VDD_DDR {
198					regulator-name = "VDD_DDR";
199					regulator-min-microvolt = <1300000>;
200					regulator-max-microvolt = <1450000>;
201					regulator-initial-mode = <2>;
202					regulator-allowed-modes = <2>, <4>;
203					regulator-always-on;
204
205					regulator-state-standby {
206						regulator-on-in-suspend;
207						regulator-suspend-microvolt = <1350000>;
208						regulator-mode = <4>;
209					};
210
211					regulator-state-mem {
212						regulator-on-in-suspend;
213						regulator-suspend-microvolt = <1350000>;
214						regulator-mode = <4>;
215					};
216				};
217
218				vddcore: VDD_CORE {
219					regulator-name = "VDD_CORE";
220					regulator-min-microvolt = <1100000>;
221					regulator-max-microvolt = <1850000>;
222					regulator-initial-mode = <2>;
223					regulator-allowed-modes = <2>, <4>;
224					regulator-always-on;
225
226					regulator-state-standby {
227						regulator-on-in-suspend;
228						regulator-mode = <4>;
229					};
230
231					regulator-state-mem {
232						regulator-off-in-suspend;
233						regulator-mode = <4>;
234					};
235				};
236
237				vddcpu: VDD_OTHER {
238					regulator-name = "VDD_OTHER";
239					regulator-min-microvolt = <1125000>;
240					regulator-max-microvolt = <1850000>;
241					regulator-initial-mode = <2>;
242					regulator-allowed-modes = <2>, <4>;
243					regulator-ramp-delay = <3125>;
244					regulator-always-on;
245
246					regulator-state-standby {
247						regulator-on-in-suspend;
248						regulator-mode = <4>;
249					};
250
251					regulator-state-mem {
252						regulator-off-in-suspend;
253						regulator-mode = <4>;
254					};
255				};
256
257				vldo1: LDO1 {
258					regulator-name = "LDO1";
259					regulator-min-microvolt = <1200000>;
260					regulator-max-microvolt = <3700000>;
261					regulator-always-on;
262
263					regulator-state-standby {
264						regulator-on-in-suspend;
265					};
266
267					regulator-state-mem {
268						regulator-off-in-suspend;
269					};
270				};
271
272				vldo2: LDO2 {
273					regulator-name = "LDO2";
274					regulator-min-microvolt = <1200000>;
275					regulator-max-microvolt = <3700000>;
276
277					regulator-state-standby {
278						regulator-on-in-suspend;
279					};
280
281					regulator-state-mem {
282						regulator-off-in-suspend;
283					};
284				};
285			};
286		};
287	};
288};
289
290&flx3 {
291	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
292	status = "okay";
293
294	uart3: serial@200 {
295		pinctrl-names = "default";
296		pinctrl-0 = <&pinctrl_flx3_default>;
297		status = "okay";
298	};
299};
300
301&flx4 {
302	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
303	status = "okay";
304
305	uart4: serial@200 {
306		pinctrl-names = "default";
307		pinctrl-0 = <&pinctrl_flx4_default>;
308		status = "okay";
309	};
310};
311
312&flx7 {
313	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
314	status = "okay";
315
316	uart7: serial@200 {
317		pinctrl-names = "default";
318		pinctrl-0 = <&pinctrl_flx7_default>;
319		status = "okay";
320	};
321};
322
323&flx8 {
324	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
325	status = "okay";
326
327	i2c8: i2c@600 {
328		pinctrl-names = "default";
329		pinctrl-0 = <&pinctrl_i2c8_default>;
330		i2c-analog-filter;
331		i2c-digital-filter;
332		i2c-digital-filter-width-ns = <35>;
333		status = "okay";
334	};
335};
336
337&flx9 {
338	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
339	status = "okay";
340
341	i2c9: i2c@600 {
342		pinctrl-names = "default";
343		pinctrl-0 = <&pinctrl_i2c9_default>;
344		i2c-analog-filter;
345		i2c-digital-filter;
346		i2c-digital-filter-width-ns = <35>;
347		status = "okay";
348	};
349};
350
351&flx11 {
352	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
353	status = "okay";
354
355	spi11: spi@400 {
356		pinctrl-names = "default";
357		pinctrl-0 = <&pinctrl_mikrobus1_spi &pinctrl_mikrobus1_spi_cs>;
358		status = "okay";
359	};
360};
361
362&gmac0 {
363	#address-cells = <1>;
364	#size-cells = <0>;
365	pinctrl-names = "default";
366	pinctrl-0 = <&pinctrl_gmac0_default
367		     &pinctrl_gmac0_mdio_default
368		     &pinctrl_gmac0_txck_default
369		     &pinctrl_gmac0_phy_irq>;
370	phy-mode = "rgmii-id";
371	status = "okay";
372
373	ethernet-phy@7 {
374		reg = <0x7>;
375		interrupt-parent = <&pioA>;
376		interrupts = <PIN_PA31 IRQ_TYPE_LEVEL_LOW>;
377	};
378};
379
380&gmac1 {
381	#address-cells = <1>;
382	#size-cells = <0>;
383	pinctrl-names = "default";
384	pinctrl-0 = <&pinctrl_gmac1_default
385		     &pinctrl_gmac1_mdio_default
386		     &pinctrl_gmac1_phy_irq>;
387	phy-mode = "rmii";
388	status = "okay";
389
390	ethernet-phy@0 {
391		reg = <0x0>;
392		interrupt-parent = <&pioA>;
393		interrupts = <PIN_PA21 IRQ_TYPE_LEVEL_LOW>;
394	};
395};
396
397&i2s0 {
398	pinctrl-names = "default";
399	pinctrl-0 = <&pinctrl_i2s0_default>;
400};
401
402&pioA {
403	pinctrl_flx0_default: flx0_default {
404		pinmux = <PIN_PE3__FLEXCOM0_IO0>,
405			 <PIN_PE4__FLEXCOM0_IO1>,
406			 <PIN_PE6__FLEXCOM0_IO3>,
407			 <PIN_PE7__FLEXCOM0_IO4>;
408		bias-disable;
409	};
410
411	pinctrl_flx3_default: flx3_default {
412		pinmux = <PIN_PD16__FLEXCOM3_IO0>,
413			 <PIN_PD17__FLEXCOM3_IO1>;
414		bias-disable;
415	};
416
417	pinctrl_flx4_default: flx4_default {
418		pinmux = <PIN_PD18__FLEXCOM4_IO0>,
419			 <PIN_PD19__FLEXCOM4_IO1>;
420		bias-disable;
421	};
422
423	pinctrl_flx7_default: flx7_default {
424		pinmux = <PIN_PC23__FLEXCOM7_IO0>,
425			 <PIN_PC24__FLEXCOM7_IO1>;
426		bias-disable;
427	};
428
429	pinctrl_gmac0_default: gmac0_default {
430		pinmux = <PIN_PA16__G0_TX0>,
431			 <PIN_PA17__G0_TX1>,
432			 <PIN_PA26__G0_TX2>,
433			 <PIN_PA27__G0_TX3>,
434			 <PIN_PA19__G0_RX0>,
435			 <PIN_PA20__G0_RX1>,
436			 <PIN_PA28__G0_RX2>,
437			 <PIN_PA29__G0_RX3>,
438			 <PIN_PA15__G0_TXEN>,
439			 <PIN_PA30__G0_RXCK>,
440			 <PIN_PA18__G0_RXDV>,
441			 <PIN_PA25__G0_125CK>;
442		slew-rate = <0>;
443		bias-disable;
444	};
445
446	pinctrl_gmac0_mdio_default: gmac0_mdio_default {
447		pinmux = <PIN_PA22__G0_MDC>,
448			 <PIN_PA23__G0_MDIO>;
449		bias-disable;
450	};
451
452	pinctrl_gmac0_txck_default: gmac0_txck_default {
453		pinmux = <PIN_PA24__G0_TXCK>;
454		slew-rate = <0>;
455		bias-pull-up;
456	};
457
458	pinctrl_gmac0_phy_irq: gmac0_phy_irq {
459		pinmux = <PIN_PA31__GPIO>;
460		bias-disable;
461	};
462
463	pinctrl_gmac1_default: gmac1_default {
464		pinmux = <PIN_PD30__G1_TXCK>,
465			 <PIN_PD22__G1_TX0>,
466			 <PIN_PD23__G1_TX1>,
467			 <PIN_PD21__G1_TXEN>,
468			 <PIN_PD25__G1_RX0>,
469			 <PIN_PD26__G1_RX1>,
470			 <PIN_PD27__G1_RXER>,
471			 <PIN_PD24__G1_RXDV>;
472		slew-rate = <0>;
473		bias-disable;
474	};
475
476	pinctrl_gmac1_mdio_default: gmac1_mdio_default {
477		pinmux = <PIN_PD28__G1_MDC>,
478			 <PIN_PD29__G1_MDIO>;
479		bias-disable;
480	};
481
482	pinctrl_gmac1_phy_irq: gmac1_phy_irq {
483		pinmux = <PIN_PA21__GPIO>;
484		bias-disable;
485	};
486
487	pinctrl_i2c1_default: i2c1_default {
488		pinmux = <PIN_PC9__FLEXCOM1_IO0>,
489			 <PIN_PC10__FLEXCOM1_IO1>;
490		bias-disable;
491	};
492
493	pinctrl_i2c8_default: i2c8_default {
494		pinmux = <PIN_PC14__FLEXCOM8_IO0>,
495			 <PIN_PC13__FLEXCOM8_IO1>;
496		bias-disable;
497	};
498
499	pinctrl_i2c9_default: i2c9_default {
500		pinmux = <PIN_PC18__FLEXCOM9_IO0>,
501			 <PIN_PC19__FLEXCOM9_IO1>;
502		bias-disable;
503	};
504
505	pinctrl_i2s0_default: i2s0_default {
506		pinmux = <PIN_PB23__I2SMCC0_CK>,
507			 <PIN_PB24__I2SMCC0_WS>,
508			 <PIN_PB25__I2SMCC0_DOUT1>,
509			 <PIN_PB26__I2SMCC0_DOUT0>,
510			 <PIN_PB27__I2SMCC0_MCK>;
511		bias-disable;
512	};
513
514	pinctrl_key_gpio_default: key_gpio_default {
515		pinmux = <PIN_PA12__GPIO>;
516		bias-pull-up;
517	};
518
519	pinctrl_led_gpio_default: led_gpio_default {
520		pinmux = <PIN_PA13__GPIO>,
521			 <PIN_PB8__GPIO>,
522			 <PIN_PD20__GPIO>;
523		bias-pull-up;
524	};
525
526	pinctrl_mikrobus1_an_default: mikrobus1_an_default {
527		pinmux = <PIN_PD0__GPIO>;
528		bias-disable;
529	};
530
531	pinctrl_mikrobus2_an_default: mikrobus2_an_default {
532		pinmux = <PIN_PD1__GPIO>;
533		bias-disable;
534	};
535
536	pinctrl_mikrobus1_pwm2_default: mikrobus1_pwm2_default {
537		pinmux = <PIN_PA13__PWMH2>;
538		bias-disable;
539	};
540
541	pinctrl_mikrobus2_pwm3_default: mikrobus2_pwm3_default {
542		pinmux = <PIN_PD20__PWMH3>;
543		bias-disable;
544	};
545
546	pinctrl_mikrobus1_spi_cs: mikrobus1_spi_cs {
547		pinmux = <PIN_PB6__FLEXCOM11_IO3>;
548		bias-disable;
549	};
550
551	pinctrl_mikrobus1_spi: mikrobus1_spi {
552		pinmux = <PIN_PB3__FLEXCOM11_IO0>,
553			 <PIN_PB4__FLEXCOM11_IO1>,
554			 <PIN_PB5__FLEXCOM11_IO2>;
555		bias-disable;
556	};
557
558	pinctrl_sdmmc0_default: sdmmc0_default {
559		cmd_data {
560			pinmux = <PIN_PA1__SDMMC0_CMD>,
561				 <PIN_PA3__SDMMC0_DAT0>,
562				 <PIN_PA4__SDMMC0_DAT1>,
563				 <PIN_PA5__SDMMC0_DAT2>,
564				 <PIN_PA6__SDMMC0_DAT3>,
565				 <PIN_PA7__SDMMC0_DAT4>,
566				 <PIN_PA8__SDMMC0_DAT5>,
567				 <PIN_PA9__SDMMC0_DAT6>,
568				 <PIN_PA10__SDMMC0_DAT7>;
569			slew-rate = <0>;
570			bias-pull-up;
571		};
572
573		ck_cd_rstn_vddsel {
574			pinmux = <PIN_PA0__SDMMC0_CK>,
575				 <PIN_PA2__SDMMC0_RSTN>,
576				 <PIN_PA11__SDMMC0_DS>;
577			slew-rate = <0>;
578			bias-pull-up;
579		};
580	};
581
582	pinctrl_sdmmc1_default: sdmmc1_default {
583		cmd_data {
584			pinmux = <PIN_PB29__SDMMC1_CMD>,
585				 <PIN_PB31__SDMMC1_DAT0>,
586				 <PIN_PC0__SDMMC1_DAT1>,
587				 <PIN_PC1__SDMMC1_DAT2>,
588				 <PIN_PC2__SDMMC1_DAT3>;
589			slew-rate = <0>;
590			bias-pull-up;
591		};
592
593		ck_cd_rstn_vddsel {
594			pinmux = <PIN_PB30__SDMMC1_CK>,
595				 <PIN_PB28__SDMMC1_RSTN>,
596				 <PIN_PC5__SDMMC1_1V8SEL>,
597				 <PIN_PC4__SDMMC1_CD>;
598			slew-rate = <0>;
599			bias-pull-up;
600		};
601	};
602
603	pinctrl_sdmmc2_default: sdmmc2_default {
604		cmd_data {
605			pinmux = <PIN_PD3__SDMMC2_CMD>,
606				 <PIN_PD5__SDMMC2_DAT0>,
607				 <PIN_PD6__SDMMC2_DAT1>,
608				 <PIN_PD7__SDMMC2_DAT2>,
609				 <PIN_PD8__SDMMC2_DAT3>;
610			slew-rate = <0>;
611			bias-pull-up;
612		};
613
614		ck {
615			pinmux = <PIN_PD4__SDMMC2_CK>;
616			slew-rate = <0>;
617			bias-pull-up;
618		};
619	};
620
621	pinctrl_spdifrx_default: spdifrx_default {
622		pinmux = <PIN_PB0__SPDIF_RX>;
623		bias-disable;
624	};
625
626	pinctrl_spdiftx_default: spdiftx_default {
627		pinmux = <PIN_PB1__SPDIF_TX>;
628		bias-disable;
629	};
630};
631
632&pwm {
633	pinctrl-names = "default";
634	pinctrl-0 = <&pinctrl_mikrobus1_pwm2_default &pinctrl_mikrobus2_pwm3_default>;
635	status = "disabled"; /* Conflict with leds. */
636};
637
638&rtt {
639	atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
640};
641
642&sdmmc0 {
643	bus-width = <8>;
644	non-removable;
645	no-1-8-v;
646	sdhci-caps-mask = <0x0 0x00200000>;
647	pinctrl-names = "default";
648	pinctrl-0 = <&pinctrl_sdmmc0_default>;
649	status = "okay";
650};
651
652&sdmmc1 {
653	bus-width = <4>;
654	no-1-8-v;
655	sdhci-caps-mask = <0x0 0x00200000>;
656	pinctrl-names = "default";
657	pinctrl-0 = <&pinctrl_sdmmc1_default>;
658	status = "okay";
659};
660
661&sdmmc2 {
662	bus-width = <4>;
663	no-1-8-v;
664	sdhci-caps-mask = <0x0 0x00200000>;
665	pinctrl-names = "default";
666	pinctrl-0 = <&pinctrl_sdmmc2_default>;
667};
668
669&shdwc {
670	atmel,shdwc-debouncer = <976>;
671	status = "okay";
672
673	input@0 {
674		reg = <0>;
675	};
676};
677
678&spdifrx {
679	pinctrl-names = "default";
680	pinctrl-0 = <&pinctrl_spdifrx_default>;
681	status = "okay";
682};
683
684&spdiftx {
685	pinctrl-names = "default";
686	pinctrl-0 = <&pinctrl_spdiftx_default>;
687	status = "okay";
688};
689
690&tcb0 {
691	timer0: timer@0 {
692		compatible = "atmel,tcb-timer";
693		reg = <0>;
694	};
695
696	timer1: timer@1 {
697		compatible = "atmel,tcb-timer";
698		reg = <1>;
699	};
700};
701
702&trng {
703	status = "okay";
704};
705
706&vddout25 {
707	vin-supply = <&vdd_3v3>;
708	status = "okay";
709};
710