1/*
2 * Copyright (c) 2019 Gerson Fernando Budke
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <arm/armv7-m.dtsi>
8#include <dt-bindings/i2c/i2c.h>
9#include <dt-bindings/gpio/gpio.h>
10
11#include "sam4e-pinctrl.dtsi"
12
13/ {
14	aliases {
15		watchdog0 = &wdt;
16	};
17
18	chosen {
19		zephyr,flash-controller = &eefc;
20	};
21
22	cpus {
23		#address-cells = <1>;
24		#size-cells = <0>;
25
26		cpu0: cpu@0 {
27			device_type = "cpu";
28			compatible = "arm,cortex-m4f";
29			reg = <0>;
30			#address-cells = <1>;
31			#size-cells = <1>;
32
33			mpu: mpu@e000ed90 {
34				compatible = "arm,armv7m-mpu";
35				reg = <0xe000ed90 0x40>;
36				arm,num-mpu-regions = <8>;
37			};
38		};
39	};
40
41	soc {
42		sram0: memory@20000000 {
43			compatible = "mmio-sram";
44		};
45
46		/* Only used for HWINFO device ID */
47		eefc: flash-controller@400e0a00 {
48			compatible = "atmel,sam-flash-controller";
49			label = "FLASH_CTRL";
50			reg = <0x400e0a00 0x200>;
51			peripheral-id = <6>;
52
53			#address-cells = <1>;
54			#size-cells = <1>;
55
56			flash0: flash@400000 {
57				compatible = "soc-nv-flash";
58				label = "FLASH_0";
59
60				write-block-size = <16>;
61			};
62		};
63
64		wdt: watchdog@400e1850 {
65			compatible = "atmel,sam-watchdog";
66			reg = <0x400e1850 0x10>;
67			interrupts = <4 0>;
68			peripheral-id = <4>;
69			label = "WATCHDOG_0";
70			status = "disabled";
71		};
72
73		twi0: i2c@400a8000 {
74			compatible = "atmel,sam-i2c-twi";
75			clock-frequency = <I2C_BITRATE_STANDARD>;
76			reg = <0x400a8000 0x4000>;
77			interrupts = <17 0>;
78			peripheral-id = <17>;
79			label = "I2C_0";
80			status = "disabled";
81			#address-cells = <1>;
82			#size-cells = <0>;
83			pinctrl-0 = <&pa4a_twi0_twck0 &pa3a_twi0_twd0>;
84		};
85
86		twi1: i2c@400ac000 {
87			compatible = "atmel,sam-i2c-twi";
88			clock-frequency = <I2C_BITRATE_STANDARD>;
89			reg = <0x400ac000 0x4000>;
90			interrupts = <18 0>;
91			peripheral-id = <18>;
92			label = "I2C_1";
93			status = "disabled";
94			#address-cells = <1>;
95			#size-cells = <0>;
96			pinctrl-0 = <&pb5a_twi1_twck1 &pb4a_twi1_twd1>;
97		};
98
99		spi0: spi@40088000 {
100			compatible = "atmel,sam-spi";
101			#address-cells = <1>;
102			#size-cells = <0>;
103			reg = <0x40088000 0x4000>;
104			interrupts = <19 0>;
105			peripheral-id = <19>;
106			label = "SPI_0";
107			status = "disabled";
108			pinctrl-0 = <&pa12a_spi_miso &pa13a_spi_mosi &pa14a_spi_spck>;
109		};
110
111		uart0: uart@400e0600 {
112			compatible = "atmel,sam-uart";
113			reg = <0x400e0600 0x140>;
114			interrupts = <7 1>;
115			peripheral-id = <7>;
116			status = "disabled";
117			label = "UART_0";
118			pinctrl-0 = <&pa9a_uart0_urxd0 &pa10a_uart0_utxd0>;
119		};
120
121		uart1: uart@40060600 {
122			compatible = "atmel,sam-uart";
123			reg = <0x40060600 0x200>;
124			interrupts = <45 1>;
125			peripheral-id = <45>;
126			status = "disabled";
127			label = "UART_1";
128			pinctrl-0 = <&pa5c_uart1_urxd1 &pa6c_uart1_utxd1>;
129		};
130
131		usart0: usart@400a0000 {
132			compatible = "atmel,sam-usart";
133			reg = <0x400a0000 0x4000>;
134			interrupts = <14 1>;
135			peripheral-id = <14>;
136			status = "disabled";
137			label = "USART_0";
138		};
139
140		usart1: usart@400a4000 {
141			compatible = "atmel,sam-usart";
142			reg = <0x400a4000 0x4000>;
143			interrupts = <15 1>;
144			peripheral-id = <15>;
145			status = "disabled";
146			label = "USART_1";
147		};
148
149		gmac: ethernet@40034000 {
150			compatible = "atmel,sam-gmac";
151			reg = <0x40034000 0x4000>;
152			peripheral-id = <44>;
153			interrupts = <44 0>;
154			interrupt-names = "gmac";
155			num-queues = <1>;
156			phy-connection-type = "mii";
157			label = "GMAC";
158			status = "disabled";
159			/* Default to MII config */
160			pinctrl-0 = <&pd0a_gmac_gtxck &pd1a_gmac_gtxen
161				     &pd2a_gmac_gtx0 &pd3a_gmac_gtx1
162				     &pd15a_gmac_gtx2 &pd16a_gmac_gtx3
163				     &pd4a_gmac_grxdv &pd7a_gmac_grxer
164				     &pd14a_gmac_grxck &pd5a_gmac_grx0
165				     &pd6a_gmac_grx1 &pd11a_gmac_grx2
166				     &pd12a_gmac_grx3 &pd13a_gmac_gcol
167				     &pd10a_gmac_gcrs &pd8a_gmac_gmdc
168				     &pd9a_gmac_gmdio>;
169
170			mdio: mdio {
171				compatible = "atmel,sam-mdio";
172				label = "MDIO";
173				status = "disabled";
174			};
175		};
176
177		pinctrl@400e0e00 {
178			compatible = "atmel,sam-pinctrl";
179			#address-cells = <1>;
180			#size-cells = <1>;
181			ranges = <0x400e0e00 0x400e0e00 0xa00>;
182
183			pioa: gpio@400e0e00 {
184				compatible = "atmel,sam-gpio";
185				reg = <0x400e0e00 0x200>;
186				interrupts = <9 1>;
187				peripheral-id = <9>;
188				label = "PORTA";
189				gpio-controller;
190				#gpio-cells = <2>;
191				#atmel,pin-cells = <2>;
192			};
193
194			piob: gpio@400e1000 {
195				compatible = "atmel,sam-gpio";
196				reg = <0x400e1000 0x200>;
197				interrupts = <10 1>;
198				peripheral-id = <10>;
199				label = "PORTB";
200				gpio-controller;
201				#gpio-cells = <2>;
202				#atmel,pin-cells = <2>;
203			};
204
205			pioc: gpio@400e1200 {
206				compatible = "atmel,sam-gpio";
207				reg = <0x400e1200 0x200>;
208				interrupts = <11 1>;
209				peripheral-id = <11>;
210				label = "PORTC";
211				gpio-controller;
212				#gpio-cells = <2>;
213				#atmel,pin-cells = <2>;
214			};
215
216			piod: gpio@400e1400 {
217				compatible = "atmel,sam-gpio";
218				reg = <0x400e1400 0x200>;
219				interrupts = <12 1>;
220				peripheral-id = <12>;
221				label = "PORTD";
222				gpio-controller;
223				#gpio-cells = <2>;
224				#atmel,pin-cells = <2>;
225			};
226
227			pioe: gpio@400e1600 {
228				compatible = "atmel,sam-gpio";
229				reg = <0x400e1600 0x200>;
230				interrupts = <13 1>;
231				peripheral-id = <13>;
232				label = "PORTE";
233				gpio-controller;
234				#gpio-cells = <2>;
235				#atmel,pin-cells = <2>;
236			};
237		};
238
239		tc0: tc@40090000 {
240			compatible = "atmel,sam-tc";
241			reg = <0x40090000 0x100>;
242			interrupts = <21 0
243				      22 0
244				      23 0>;
245			peripheral-id = <21 22 23>;
246			status = "disabled";
247			label = "TC0";
248			pinctrl-0 = <>;
249		};
250
251		tc1: tc@40094000 {
252			compatible = "atmel,sam-tc";
253			reg = <0x40094000 0x100>;
254			interrupts = <24 0
255				      25 0
256				      26 0>;
257			peripheral-id = <24 25 26>;
258			status = "disabled";
259			label = "TC1";
260			pinctrl-0 = <>;
261		};
262
263		tc2: tc@40098000 {
264			compatible = "atmel,sam-tc";
265			reg = <0x40098000 0x100>;
266			interrupts = <27 0
267				      28 0
268				      29 0>;
269			peripheral-id = <27 28 29>;
270			status = "disabled";
271			label = "TC2";
272			pinctrl-0 = <>;
273		};
274	};
275};
276
277&nvic {
278	arm,num-irq-priority-bits = <4>;
279};
280