1/*
2 * Copyright (c) 2019-2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#include "nrf5340_cpuapp_common-pinctrl.dtsi"
7#include <zephyr/dt-bindings/input/input-event-codes.h>
8
9/ {
10
11	chosen {
12		zephyr,console = &uart0;
13		zephyr,shell-uart = &uart0;
14		zephyr,uart-mcumgr = &uart0;
15		zephyr,bt-mon-uart = &uart0;
16		zephyr,bt-c2h-uart = &uart0;
17		zephyr,bt-hci-rpmsg-ipc = &ipc0;
18		nordic,802154-spinel-ipc = &ipc0;
19		zephyr,ieee802154 = &ieee802154;
20	};
21
22	leds {
23		compatible = "gpio-leds";
24		led0: led_0 {
25			gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
26			label = "Green LED 0";
27		};
28		led1: led_1 {
29			gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
30			label = "Green LED 1";
31		};
32		led2: led_2 {
33			gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
34			label = "Green LED 2";
35		};
36		led3: led_3 {
37			gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
38			label = "Green LED 3";
39		};
40	};
41
42	pwmleds {
43		compatible = "pwm-leds";
44		pwm_led0: pwm_led_0 {
45			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
46		};
47	};
48
49	buttons {
50		compatible = "gpio-keys";
51		button0: button_0 {
52			gpios = <&gpio0 23 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
53			label = "Push button 1";
54			zephyr,code = <INPUT_KEY_0>;
55		};
56		button1: button_1 {
57			gpios = <&gpio0 24 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
58			label = "Push button 2";
59			zephyr,code = <INPUT_KEY_1>;
60		};
61		button2: button_2 {
62			gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
63			label = "Push button 3";
64			zephyr,code = <INPUT_KEY_2>;
65		};
66		button3: button_3 {
67			gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
68			label = "Push button 4";
69			zephyr,code = <INPUT_KEY_3>;
70		};
71	};
72
73	arduino_header: connector {
74		compatible = "arduino-header-r3";
75		#gpio-cells = <2>;
76		gpio-map-mask = <0xffffffff 0xffffffc0>;
77		gpio-map-pass-thru = <0 0x3f>;
78		gpio-map = <0 0 &gpio0 4 0>,	/* A0 */
79			   <1 0 &gpio0 5 0>,	/* A1 */
80			   <2 0 &gpio0 6 0>,	/* A2 */
81			   <3 0 &gpio0 7 0>,	/* A3 */
82			   <4 0 &gpio0 25 0>,	/* A4 */
83			   <5 0 &gpio0 26 0>,	/* A5 */
84			   <6 0 &gpio1 0 0>,	/* D0 */
85			   <7 0 &gpio1 1 0>,	/* D1 */
86			   <8 0 &gpio1 4 0>,	/* D2 */
87			   <9 0 &gpio1 5 0>,	/* D3 */
88			   <10 0 &gpio1 6 0>,	/* D4 */
89			   <11 0 &gpio1 7 0>,	/* D5 */
90			   <12 0 &gpio1 8 0>,	/* D6 */
91			   <13 0 &gpio1 9 0>,	/* D7 */
92			   <14 0 &gpio1 10 0>,	/* D8 */
93			   <15 0 &gpio1 11 0>,	/* D9 */
94			   <16 0 &gpio1 12 0>,	/* D10 */
95			   <17 0 &gpio1 13 0>,	/* D11 */
96			   <18 0 &gpio1 14 0>,	/* D12 */
97			   <19 0 &gpio1 15 0>,	/* D13 */
98			   <20 0 &gpio1 2 0>,	/* D14 */
99			   <21 0 &gpio1 3 0>;	/* D15 */
100	};
101
102	arduino_adc: analog-connector {
103		compatible = "arduino,uno-adc";
104		#io-channel-cells = <1>;
105		io-channel-map = <0 &adc 0>,	/* A0 = P0.4 = AIN0 */
106				 <1 &adc 1>,	/* A1 = P0.5 = AIN1 */
107				 <2 &adc 2>,	/* A2 = P0.6 = AIN2 */
108				 <3 &adc 3>,	/* A3 = P0.7 = AIN3 */
109				 <4 &adc 4>,	/* A4 = P0.25 = AIN4 */
110				 <5 &adc 5>;	/* A5 = P0.26 = AIN5 */
111	};
112
113	gpio_fwd: nrf-gpio-forwarder {
114		compatible = "nordic,nrf-gpio-forwarder";
115		status = "okay";
116		uart {
117			gpios = <&gpio1 1 0>, <&gpio1 0 0>, <&gpio0 11 0>, <&gpio0 10 0>;
118		};
119	};
120
121	/* These aliases are provided for compatibility with samples */
122	aliases {
123		led0 = &led0;
124		led1 = &led1;
125		led2 = &led2;
126		led3 = &led3;
127		pwm-led0 = &pwm_led0;
128		sw0 = &button0;
129		sw1 = &button1;
130		sw2 = &button2;
131		sw3 = &button3;
132		bootloader-led0 = &led0;
133		mcuboot-button0 = &button0;
134		mcuboot-led0 = &led0;
135		watchdog0 = &wdt0;
136		spi-flash0 = &mx25r64;
137	};
138};
139
140&adc {
141	status = "okay";
142};
143
144&gpiote {
145	status = "okay";
146};
147
148&gpio0 {
149	status = "okay";
150};
151
152&gpio1 {
153	status = "okay";
154};
155
156&i2c1 {
157	compatible = "nordic,nrf-twim";
158	status = "okay";
159	pinctrl-0 = <&i2c1_default>;
160	pinctrl-1 = <&i2c1_sleep>;
161	pinctrl-names = "default", "sleep";
162};
163
164&uart0 {
165	status = "okay";
166	current-speed = <115200>;
167	pinctrl-0 = <&uart0_default>;
168	pinctrl-1 = <&uart0_sleep>;
169	pinctrl-names = "default", "sleep";
170};
171
172&pwm0 {
173	status = "okay";
174	pinctrl-0 = <&pwm0_default>;
175	pinctrl-1 = <&pwm0_sleep>;
176	pinctrl-names = "default", "sleep";
177};
178
179&qspi {
180	status = "okay";
181	pinctrl-0 = <&qspi_default>;
182	pinctrl-1 = <&qspi_sleep>;
183	pinctrl-names = "default", "sleep";
184	mx25r64: mx25r6435f@0 {
185		compatible = "nordic,qspi-nor";
186		reg = <0>;
187		/* MX25R64 supports only pp and pp4io */
188		writeoc = "pp4io";
189		/* MX25R64 supports all readoc options */
190		readoc = "read4io";
191		sck-frequency = <8000000>;
192		jedec-id = [c2 28 17];
193		sfdp-bfp = [
194			e5 20 f1 ff  ff ff ff 03  44 eb 08 6b  08 3b 04 bb
195			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
196			10 d8 00 ff  23 72 f5 00  82 ed 04 cc  44 83 68 44
197			30 b0 30 b0  f7 c4 d5 5c  00 be 29 ff  f0 d0 ff ff
198		];
199		size = <67108864>;
200		has-dpd;
201		t-enter-dpd = <10000>;
202		t-exit-dpd = <35000>;
203	};
204};
205
206arduino_serial: &uart1 {
207	compatible = "nordic,nrf-uarte";
208	current-speed = <115200>;
209	pinctrl-0 = <&uart1_default>;
210	pinctrl-1 = <&uart1_sleep>;
211	pinctrl-names = "default", "sleep";
212};
213
214arduino_i2c: &i2c1 {};
215
216arduino_spi: &spi4 {
217	compatible = "nordic,nrf-spim";
218	status = "okay";
219	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
220	pinctrl-0 = <&spi4_default>;
221	pinctrl-1 = <&spi4_sleep>;
222	pinctrl-names = "default", "sleep";
223};
224
225&flash0 {
226
227	partitions {
228		compatible = "fixed-partitions";
229		#address-cells = <1>;
230		#size-cells = <1>;
231
232		boot_partition: partition@0 {
233			label = "mcuboot";
234			reg = <0x00000000 0x00010000>;
235		};
236		slot0_partition: partition@10000 {
237			label = "image-0";
238		};
239		slot0_ns_partition: partition@50000 {
240			label = "image-0-nonsecure";
241		};
242		slot1_partition: partition@80000 {
243			label = "image-1";
244		};
245		slot1_ns_partition: partition@c0000 {
246			label = "image-1-nonsecure";
247		};
248		/* 0xf0000 to 0xf7fff reserved for TF-M partitions */
249		storage_partition: partition@f8000 {
250			label = "storage";
251			reg = <0x000f8000 0x00008000>;
252		};
253	};
254};
255
256&ieee802154 {
257	status = "okay";
258};
259
260zephyr_udc0: &usbd {
261	compatible = "nordic,nrf-usbd";
262	status = "okay";
263};
264
265/ {
266
267	reserved-memory {
268		#address-cells = <1>;
269		#size-cells = <1>;
270		ranges;
271
272		sram0_image: image@20000000 {
273			/* Zephyr image(s) memory */
274		};
275
276		sram0_s: image_s@20000000 {
277			/* Secure image memory */
278		};
279
280		sram0_ns: image_ns@20040000 {
281			/* Non-Secure image memory */
282		};
283	};
284};
285
286/* Include partition configuration file */
287#include "nrf5340_cpuapp_partition_conf.dtsi"
288