1/*
2 * Copyright (c) 2019-2023 Gerson Fernando Budke
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <atmel/sam4e16e.dtsi>
10#include "sam4e_xpro-pinctrl.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "Atmel SAM4E Xplained Pro Board with an Atmel SAM4E16E SoC";
15	compatible = "atmel,sam4e_xpro", "atmel,sam4e16e", "atmel,sam4e";
16
17	aliases {
18		i2c-0 = &twi0;
19		pwm-0 = &pwm0;
20		led0 = &yellow_led_1;
21		sw0 = &user_button;
22		wdog = &wdt;
23		watchdog0 = &wdt;
24		sdhc0 = &hsmci;
25	};
26
27	chosen {
28		zephyr,console = &uart0;
29		zephyr,shell-uart = &uart0;
30		zephyr,sram = &sram0;
31		zephyr,flash = &flash0;
32	};
33
34	leds {
35		compatible = "gpio-leds";
36		yellow_led_1: led_1 {
37			gpios = <&piod 22 GPIO_ACTIVE_LOW>;
38			label = "LED 1";
39		};
40	};
41
42	gpio_keys {
43		compatible = "gpio-keys";
44		user_button: button_1 {
45			label = "User Button";
46			gpios = <&pioa 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
47			zephyr,code = <INPUT_KEY_0>;
48		};
49	};
50
51	ext1_header: xplained-pro-connector1 {
52		compatible = "atmel-xplained-pro-header";
53		#gpio-cells = <2>;
54		gpio-map-mask = <0xffffffff 0xffffffc0>;
55		gpio-map-pass-thru = <0 0x3f>;		/*           Shared */
56		gpio-map =	<0  0 &piob  2 0>,	/* AFE AD0          */
57				<1  0 &piob  3 0>,	/* AFE AD1          */
58				<2  0 &pioa 24 0>,	/* GPIO             */
59				<3  0 &pioa 25 0>,	/* GPIO             */
60				<4  0 &pioa 15 0>,	/* TIOA1            */
61				<5  0 &pioa 16 0>,	/* TIOB1            */
62				<6  0 &pioa 11 0>,	/* WKUP7            */
63				<7  0 &piod 25 0>,	/* GPIO             */
64				<8  0 &pioa  3 0>,	/* TWD0        EXTx */
65				<9  0 &pioa  4 0>,	/* TWCK0       EXTx */
66				<10 0 &pioa 21 0>,	/* RXD1             */
67				<11 0 &pioa 22 0>,	/* TXD1             */
68				<12 0 &piob 14 0>,	/* SPI(NPCS1)       */
69				<13 0 &pioa 13 0>,	/* SPI(MOSI)   EXTx */
70				<14 0 &pioa 12 0>,	/* SPI(MISO)   EXTx */
71				<15 0 &pioa 14 0>;	/* SPI(SCK)    EXTx */
72							/* GND              */
73							/* +3.3V            */
74	};
75
76	ext2_header: xplained-pro-connector2 {
77		compatible = "atmel-xplained-pro-header";
78		#gpio-cells = <2>;
79		gpio-map-mask = <0xffffffff 0xffffffc0>;
80		gpio-map-pass-thru = <0 0x3f>;		/*           Shared */
81		gpio-map =    /*<0  0 -      - 0>,	   -                */
82			      /*<1  0 -      - 0>,	   -                */
83				<2  0 &pioe  2 0>,	/* GPIO        EBDG */
84				<3  0 &piob  5 0>,	/* GPIO        EDBG */
85				<4  0 &piod 21 0>,	/* PWMHI1           */
86			      /*<5  0 -      - 0>,	   -                */
87				<6  0 &piod 29 0>,	/* GPIO        ETH  */
88				<7  0 &piob  4 0>,	/* GPIO             */
89				<8  0 &pioa  3 0>,	/* TWD0        EXTx */
90				<9  0 &pioa  4 0>,	/* TWCK0       EXTx */
91				<10 0 &pioa  5 0>,	/* URXD1       EXT3 */
92				<11 0 &pioa  6 0>,	/* UTXD1       EXT3 */
93				<12 0 &piod 23 0>,	/* GPIO             */
94				<13 0 &pioa 13 0>,	/* SPI(MOSI)   EXTx */
95				<14 0 &pioa 12 0>,	/* SPI(MISO)   EXTx */
96				<15 0 &pioa 14 0>;	/* SPI(SCK)    EXTx */
97							/* GND              */
98							/* +3.3V            */
99	};
100
101	ext3_header: xplained-pro-connector3 {
102		compatible = "atmel-xplained-pro-header";
103		#gpio-cells = <2>;
104		gpio-map-mask = <0xffffffff 0xffffffc0>;
105		gpio-map-pass-thru = <0 0x3f>;		/*           Shared */
106		gpio-map =	<0  0 &pioa 17 0>,	/* AFE AD0          */
107				<1  0 &pioc 13 0>,	/* AFE AD6          */
108				<2  0 &piod 28 0>,	/* GPIO             */
109				<3  0 &piod 17 0>,	/* GPIO             */
110				<4  0 &piod 20 0>,	/* PWMH0            */
111				<5  0 &piod 24 0>,	/* PWML0            */
112				<6  0 &pioe  1 0>,	/* GPIO             */
113				<7  0 &piod 26 0>,	/* GPIO             */
114				<8  0 &pioa  3 0>,	/* TWD0        EXTx */
115				<9  0 &pioa  4 0>,	/* TWCK0       EXTx */
116				<10 0 &pioa  5 0>,	/* URXD1       EXT2 */
117				<11 0 &pioa  6 0>,	/* UTXD1       EXT2 */
118				<12 0 &piod 30 0>,	/* GPIO             */
119				<13 0 &pioa 13 0>,	/* SPI(MOSI)   EXTx */
120				<14 0 &pioa 12 0>,	/* SPI(MISO)   EXTx */
121				<15 0 &pioa 14 0>;	/* SPI(SCK)    EXTx */
122							/* GND              */
123							/* +3.3V            */
124	};
125};
126
127&cpu0 {
128	clock-frequency = <120000000>;
129};
130
131&afec0 {
132	status = "okay";
133
134	pinctrl-0 = <&afec0_default>;
135	pinctrl-names = "default";
136};
137
138&afec1 {
139	status = "okay";
140
141	pinctrl-0 = <&afec1_default>;
142	pinctrl-names = "default";
143};
144
145&twi0 {
146	status = "okay";
147
148	pinctrl-0 = <&twi0_default>;
149	pinctrl-names = "default";
150};
151
152&spi0 {
153	status = "okay";
154
155	pinctrl-0 = <&spi0_default>;
156	pinctrl-names = "default";
157
158	cs-gpios = <&piob 14 GPIO_ACTIVE_LOW>,
159		   <&piod 23 GPIO_ACTIVE_LOW>,
160		   <&piod 30 GPIO_ACTIVE_LOW>;
161};
162
163&uart0 {
164	status = "okay";
165	current-speed = <115200>;
166
167	pinctrl-0 = <&uart0_default>;
168	pinctrl-names = "default";
169};
170
171&uart1 {
172	pinctrl-0 = <&uart1_default>;
173	pinctrl-names = "default";
174};
175
176&usart1 {
177	status = "okay";
178	current-speed = <115200>;
179
180	pinctrl-0 = <&usart1_default>;
181	pinctrl-names = "default";
182};
183
184&gmac {
185	status = "okay";
186
187	pinctrl-0 = <&gmac_mii>;
188	pinctrl-names = "default";
189
190	zephyr,random-mac-address;
191
192	phy-handle = <&phy>;
193};
194
195&mdio {
196	status = "okay";
197
198	pinctrl-0 = <&mdio_default>;
199	pinctrl-names = "default";
200
201	phy: ethernet-phy@0 {
202		compatible = "ethernet-phy";
203		status = "okay";
204		reg = <0>;
205	};
206};
207
208&pwm0 {
209	status = "okay";
210
211	pinctrl-0 = <&pwm0_default>;
212	pinctrl-names = "default";
213};
214
215&hsmci {
216	status = "okay";
217
218	pinctrl-0 = <&hsmci_default>;
219	pinctrl-names = "default";
220	mmc {
221		compatible = "zephyr,sdmmc-disk";
222		status = "okay";
223	};
224};
225
226&wdt {
227	status = "okay";
228};
229
230ext1_spi: &spi0 {
231};
232
233ext1_i2c: &twi0 {
234};
235
236ext1_serial: &usart1 {
237};
238
239ext2_spi: &spi0 {
240};
241
242ext2_i2c: &twi0 {
243};
244
245ext2_serial: &uart1 {
246};
247
248ext3_spi: &spi0 {
249};
250
251ext3_i2c: &twi0 {
252};
253
254ext3_serial: &uart1 {
255};
256