1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * at91-sama5d29_curiosity.dts - Device Tree file for SAMA5D29 Curiosity board
4 *
5 * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries
6 *
7 * Author: Mihai Sain <mihai.sain@microchip.com>
8 *
9 */
10/dts-v1/;
11#include "sama5d29.dtsi"
12#include "sama5d2-pinfunc.h"
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h>
15#include <dt-bindings/mfd/atmel-flexcom.h>
16
17/ {
18	model = "Microchip SAMA5D29 Curiosity";
19	compatible = "microchip,sama5d29-curiosity", "atmel,sama5d29", "atmel,sama5d2", "atmel,sama5";
20
21	aliases {
22		serial0 = &uart0;	// debug
23		serial1 = &uart1;	// RPi
24		serial2 = &uart3;	// mikro BUS 2
25		serial3 = &uart4;	// mikro BUS 1
26		serial4 = &uart6;	// flx1 Bluetooth
27		i2c0 = &i2c0;
28		i2c1 = &i2c1;
29	};
30
31	chosen {
32		bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait";
33		stdout-path = "serial0:115200n8";
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		button-1 {
53			label = "USER BUTTON";
54			gpios = <&pioA PIN_PA17 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";
65
66		led-red {
67			label = "red";
68			gpios = <&pioA PIN_PA7 GPIO_ACTIVE_HIGH>;
69		};
70
71		led-green {
72			label = "green";
73			gpios = <&pioA PIN_PA8 GPIO_ACTIVE_HIGH>;
74		};
75
76		led-blue {
77			label = "blue";
78			gpios = <&pioA PIN_PA9 GPIO_ACTIVE_HIGH>;
79			linux,default-trigger = "heartbeat";
80		};
81	};
82
83	memory@20000000 {
84		device_type = "memory";
85		reg = <0x20000000 0x20000000>;
86	};
87};
88
89&adc {
90	vddana-supply = <&vdd_3v3>;
91	vref-supply = <&vdd_3v3>;
92	pinctrl-names = "default";
93	pinctrl-0 = <&pinctrl_adc_default &pinctrl_adtrg_default>;
94	status = "okay";
95};
96
97&can0 {
98	pinctrl-names = "default";
99	pinctrl-0 = <&pinctrl_can0_default>;
100	status = "okay";
101};
102
103&can1 {
104	pinctrl-names = "default";
105	pinctrl-0 = <&pinctrl_can1_default>;
106	status = "okay";
107};
108
109&flx1 {
110	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
111	status = "okay";
112
113	uart6: serial@200 {
114		pinctrl-0 = <&pinctrl_flx1_default>;
115		pinctrl-names = "default";
116		atmel,use-dma-rx;
117		atmel,use-dma-tx;
118		status = "okay";
119	};
120};
121
122&flx4 {
123	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
124	status = "okay";
125
126	spi6: spi@400 {
127		dmas = <0>, <0>;
128		pinctrl-names = "default";
129		pinctrl-0 = <&pinctrl_rpi_spi>;
130		status = "okay";
131	};
132};
133
134&i2c0 {
135	dmas = <0>, <0>;
136	pinctrl-names = "default", "gpio";
137	pinctrl-0 = <&pinctrl_i2c0_default>;
138	pinctrl-1 = <&pinctrl_i2c0_gpio>;
139	sda-gpios = <&pioA PIN_PB31 GPIO_ACTIVE_HIGH>;
140	scl-gpios = <&pioA PIN_PC0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
141	i2c-sda-hold-time-ns = <350>;
142	status = "okay";
143
144	mcp16502@5b {
145		compatible = "microchip,mcp16502";
146		reg = <0x5b>;
147		status = "okay";
148		lpm-gpios = <&pioBU 0 GPIO_ACTIVE_LOW>;
149
150		regulators {
151			vdd_3v3: VDD_IO {
152				regulator-name = "VDD_IO";
153				regulator-min-microvolt = <3300000>;
154				regulator-max-microvolt = <3300000>;
155				regulator-initial-mode = <2>;
156				regulator-allowed-modes = <2>, <4>;
157				regulator-always-on;
158
159				regulator-state-standby {
160					regulator-on-in-suspend;
161					regulator-mode = <4>;
162				};
163
164				regulator-state-mem {
165					regulator-off-in-suspend;
166					regulator-mode = <4>;
167				};
168			};
169
170			vddio_ddr: VDD_DDR {
171				regulator-name = "VDD_DDR";
172				regulator-min-microvolt = <1200000>;
173				regulator-max-microvolt = <1200000>;
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-suspend-microvolt = <1200000>;
181					regulator-changeable-in-suspend;
182					regulator-mode = <4>;
183				};
184
185				regulator-state-mem {
186					regulator-on-in-suspend;
187					regulator-suspend-microvolt = <1200000>;
188					regulator-changeable-in-suspend;
189					regulator-mode = <4>;
190				};
191			};
192
193			vdd_core: VDD_CORE {
194				regulator-name = "VDD_CORE";
195				regulator-min-microvolt = <1250000>;
196				regulator-max-microvolt = <1250000>;
197				regulator-initial-mode = <2>;
198				regulator-allowed-modes = <2>, <4>;
199				regulator-always-on;
200
201				regulator-state-standby {
202					regulator-on-in-suspend;
203					regulator-mode = <4>;
204				};
205
206				regulator-state-mem {
207					regulator-off-in-suspend;
208					regulator-mode = <4>;
209				};
210			};
211
212			vdd_ddr: VDD_OTHER {
213				regulator-name = "VDD_OTHER";
214				regulator-min-microvolt = <1800000>;
215				regulator-max-microvolt = <1800000>;
216				regulator-initial-mode = <2>;
217				regulator-allowed-modes = <2>, <4>;
218				regulator-always-on;
219
220				regulator-state-standby {
221					regulator-on-in-suspend;
222					regulator-suspend-microvolt = <1800000>;
223					regulator-changeable-in-suspend;
224					regulator-mode = <4>;
225				};
226
227				regulator-state-mem {
228					regulator-on-in-suspend;
229					regulator-suspend-microvolt = <1800000>;
230					regulator-changeable-in-suspend;
231					regulator-mode = <4>;
232				};
233			};
234
235			LDO1 {
236				regulator-name = "LDO1";
237				regulator-min-microvolt = <2500000>;
238				regulator-max-microvolt = <2500000>;
239				regulator-always-on;
240
241				regulator-state-standby {
242					regulator-on-in-suspend;
243				};
244
245				regulator-state-mem {
246					regulator-off-in-suspend;
247				};
248			};
249
250			LDO2 {
251				regulator-name = "LDO2";
252				regulator-min-microvolt = <3300000>;
253				regulator-max-microvolt = <3300000>;
254				regulator-always-on;
255
256				regulator-state-standby {
257					regulator-on-in-suspend;
258				};
259
260				regulator-state-mem {
261					regulator-off-in-suspend;
262				};
263			};
264		};
265	};
266};
267
268&i2c1 {
269	dmas = <0>, <0>;
270	pinctrl-names = "default", "gpio";
271	pinctrl-0 = <&pinctrl_i2c1_default>;
272	pinctrl-1 = <&pinctrl_i2c1_gpio>;
273	i2c-analog-filter;
274	i2c-digital-filter;
275	i2c-digital-filter-width-ns = <35>;
276	sda-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_HIGH>;
277	scl-gpios = <&pioA PIN_PD5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
278	status = "okay";
279};
280
281&pioA {
282	pinctrl_adc_default: adc-default {
283		pinmux = <PIN_PD25__GPIO>,
284			 <PIN_PD26__GPIO>;
285		bias-disable;
286	};
287
288	pinctrl_adtrg_default: adtrg-default {
289		pinmux = <PIN_PD31__ADTRG>;
290		bias-pull-up;
291	};
292
293	pinctrl_can0_default: can0-default {
294		pinmux = <PIN_PC10__CANTX0>,
295			 <PIN_PC11__CANRX0>;
296		bias-disable;
297	};
298
299	pinctrl_can1_default: can1-default {
300		pinmux = <PIN_PC26__CANTX1>,
301			 <PIN_PC27__CANRX1>;
302		bias-disable;
303	};
304
305	pinctrl_debug_uart: debug-uart {
306		pinmux = <PIN_PB26__URXD0>,
307			 <PIN_PB27__UTXD0>;
308		bias-disable;
309	};
310
311	pinctrl_flx1_default: flx1-default {
312		pinmux = <PIN_PA24__FLEXCOM1_IO0>,
313			 <PIN_PA23__FLEXCOM1_IO1>,
314			 <PIN_PA25__FLEXCOM1_IO3>,
315			 <PIN_PA26__FLEXCOM1_IO4>;
316		bias-disable;
317	};
318
319	pinctrl_i2c0_default: i2c0-default {
320		pinmux = <PIN_PB31__TWD0>,
321			 <PIN_PC0__TWCK0>;
322		bias-disable;
323	};
324
325	pinctrl_i2c0_gpio: i2c0-gpio-default {
326		pinmux = <PIN_PB31__GPIO>,
327			 <PIN_PC0__GPIO>;
328		bias-disable;
329	};
330
331	pinctrl_i2c1_default: i2c1-default {
332		pinmux = <PIN_PD4__TWD1>,
333			 <PIN_PD5__TWCK1>;
334		bias-disable;
335	};
336
337	pinctrl_i2c1_gpio: i2c1-gpio-default {
338		pinmux = <PIN_PD4__GPIO>,
339			 <PIN_PD5__GPIO>;
340		bias-disable;
341	};
342
343	pinctrl_key_gpio_default: key-gpio-default {
344		pinmux = <PIN_PA17__GPIO>;
345		bias-pull-up;
346	};
347
348	pinctrl_led_gpio_default: led-gpio-default {
349		pinmux = <PIN_PA7__GPIO>,
350			 <PIN_PA8__GPIO>,
351			 <PIN_PA9__GPIO>;
352		bias-pull-up;
353	};
354
355	pinctrl_mikrobus1_pwm: mikrobus1-pwm {
356		pinmux = <PIN_PA31__PWML0>;
357		bias-disable;
358	};
359
360	pinctrl_mikrobus2_pwm: mikrobus2-pwm {
361		pinmux = <PIN_PB0__PWMH1>;
362		bias-disable;
363	};
364
365	pinctrl_mikrobus1_uart: mikrobus1-uart {
366		pinmux = <PIN_PB3__URXD4>,
367			 <PIN_PB4__UTXD4>;
368		bias-disable;
369	};
370
371	pinctrl_mikrobus2_uart: mikrobus2-uart {
372		pinmux = <PIN_PB11__URXD3>,
373			 <PIN_PB12__UTXD3>;
374		bias-disable;
375	};
376
377	pinctrl_qspi1_default: qspi1-default {
378		pinmux = <PIN_PB5__QSPI1_SCK>,
379			 <PIN_PB6__QSPI1_CS>,
380			 <PIN_PB7__QSPI1_IO0>,
381			 <PIN_PB8__QSPI1_IO1>,
382			 <PIN_PB9__QSPI1_IO2>,
383			 <PIN_PB10__QSPI1_IO3>;
384		bias-disable;
385	};
386
387	pinctrl_rpi_spi: rpi-spi {
388		pinmux = <PIN_PD12__FLEXCOM4_IO0>,
389			 <PIN_PD13__FLEXCOM4_IO1>,
390			 <PIN_PD14__FLEXCOM4_IO2>,
391			 <PIN_PD15__FLEXCOM4_IO3>,
392			 <PIN_PD16__FLEXCOM4_IO4>;
393		bias-disable;
394	};
395
396	pinctrl_rpi_uart: rpi-uart {
397		pinmux = <PIN_PD2__URXD1>,
398			 <PIN_PD3__UTXD1>;
399		bias-disable;
400	};
401
402	pinctrl_sdmmc0_default: sdmmc0-default {
403		pinmux = <PIN_PA0__SDMMC0_CK>,
404			 <PIN_PA1__SDMMC0_CMD>,
405			 <PIN_PA2__SDMMC0_DAT0>,
406			 <PIN_PA3__SDMMC0_DAT1>,
407			 <PIN_PA4__SDMMC0_DAT2>,
408			 <PIN_PA5__SDMMC0_DAT3>,
409			 <PIN_PA11__SDMMC0_VDDSEL>,
410			 <PIN_PA13__SDMMC0_CD>;
411		bias-disable;
412	};
413
414	pinctrl_sdmmc1_default: sdmmc1-default {
415		pinmux = <PIN_PA18__SDMMC1_DAT0>,
416			 <PIN_PA19__SDMMC1_DAT1>,
417			 <PIN_PA20__SDMMC1_DAT2>,
418			 <PIN_PA21__SDMMC1_DAT3>,
419			 <PIN_PA22__SDMMC1_CK>,
420			 <PIN_PA28__SDMMC1_CMD>,
421			 <PIN_PA30__SDMMC1_CD>;
422		bias-disable;
423	};
424
425	pinctrl_spi1_default: spi1-default {
426		pinmux = <PIN_PC1__SPI1_SPCK>,
427			 <PIN_PC2__SPI1_MOSI>,
428			 <PIN_PC3__SPI1_MISO>,
429			 <PIN_PC4__SPI1_NPCS0>,
430			 <PIN_PC5__SPI1_NPCS1>,
431			 <PIN_PC6__SPI1_NPCS2>,
432			 <PIN_PC7__SPI1_NPCS3>;
433		bias-disable;
434	};
435
436	pinctrl_usb_default: usb-default {
437		pinmux = <PIN_PA6__GPIO>;
438		bias-disable;
439	};
440
441	pinctrl_usba_vbus: usba-vbus {
442		pinmux = <PIN_PB13__GPIO>;
443		bias-disable;
444	};
445};
446
447&pwm0 {
448	pinctrl-names = "default";
449	pinctrl-0 = <&pinctrl_mikrobus1_pwm &pinctrl_mikrobus2_pwm>;
450	status = "okay";
451};
452
453&qspi1 {
454	pinctrl-names = "default";
455	pinctrl-0 = <&pinctrl_qspi1_default>;
456	status = "okay";
457
458	flash@0 {
459		#address-cells = <1>;
460		#size-cells = <1>;
461		compatible = "jedec,spi-nor";
462		reg = <0>;
463		spi-max-frequency = <80000000>;
464		spi-tx-bus-width = <4>;
465		spi-rx-bus-width = <4>;
466		m25p,fast-read;
467		label = "atmel_qspi1";
468		status = "okay";
469
470		at91bootstrap@0 {
471			label = "at91bootstrap";
472			reg = <0x0 0x40000>;
473		};
474
475		bootloader@40000 {
476			label = "bootloader";
477			reg = <0x40000 0xc0000>;
478		};
479
480		bootloaderenvred@100000 {
481			label = "bootloader env redundant";
482			reg = <0x100000 0x40000>;
483		};
484
485		bootloaderenv@140000 {
486			label = "bootloader env";
487			reg = <0x140000 0x40000>;
488		};
489
490		dtb@180000 {
491			label = "device tree";
492			reg = <0x180000 0x80000>;
493		};
494
495		kernel@200000 {
496			label = "kernel";
497			reg = <0x200000 0x600000>;
498		};
499	};
500};
501
502&sdmmc0 {
503	bus-width = <4>;
504	pinctrl-names = "default";
505	pinctrl-0 = <&pinctrl_sdmmc0_default>;
506	disable-wp;
507	status = "okay";
508};
509
510&sdmmc1 {
511	bus-width = <4>;
512	pinctrl-names = "default";
513	pinctrl-0 = <&pinctrl_sdmmc1_default>;
514	disable-wp;
515	status = "okay";
516};
517
518&shutdown_controller {
519	debounce-delay-us = <976>;
520	atmel,wakeup-rtc-timer;
521
522	input@0 {
523		reg = <0>;
524	};
525};
526
527&spi1 {
528	pinctrl-names = "default";
529	pinctrl-0 = <&pinctrl_spi1_default>;
530	status = "okay";
531};
532
533&tcb0 {
534	timer0: timer@0 {
535		compatible = "atmel,tcb-timer";
536		reg = <0>;
537	};
538
539	timer1: timer@1 {
540		compatible = "atmel,tcb-timer";
541		reg = <1>;
542	};
543};
544
545&uart0 {
546	pinctrl-names = "default";
547	pinctrl-0 = <&pinctrl_debug_uart>;
548	atmel,use-dma-rx;
549	atmel,use-dma-tx;
550	status = "okay";
551};
552
553&uart1 {
554	pinctrl-names = "default";
555	pinctrl-0 = <&pinctrl_rpi_uart>;
556	atmel,use-dma-rx;
557	atmel,use-dma-tx;
558	status = "okay";
559};
560
561&uart3 {
562	pinctrl-names = "default";
563	pinctrl-0 = <&pinctrl_mikrobus2_uart>;
564	atmel,use-dma-rx;
565	atmel,use-dma-tx;
566	status = "okay";
567};
568
569&uart4 {
570	pinctrl-names = "default";
571	pinctrl-0 = <&pinctrl_mikrobus1_uart>;
572	atmel,use-dma-rx;
573	atmel,use-dma-tx;
574	status = "okay";
575};
576
577&usb0 {
578	atmel,vbus-gpio = <&pioA PIN_PB13 GPIO_ACTIVE_HIGH>;
579	pinctrl-names = "default";
580	pinctrl-0 = <&pinctrl_usba_vbus>;
581	status = "okay";
582};
583
584&usb1 {
585	num-ports = <3>;
586	atmel,vbus-gpio = <0
587			   &pioA PIN_PA6 GPIO_ACTIVE_HIGH
588			   0>;
589	pinctrl-names = "default";
590	pinctrl-0 = <&pinctrl_usb_default>;
591	status = "okay";
592};
593
594&usb2 {
595	status = "okay";
596};
597
598&watchdog {
599	status = "okay";
600};
601