1/*
2 * Copyright (c) 2017 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <nordic/nrf52840_qiaa.dtsi>
9#include <nordic/nrf52840_partition.dtsi>
10#include "nrf52840dk_nrf52840-pinctrl.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "Nordic nRF52840 DK NRF52840";
15	compatible = "nordic,nrf52840-dk-nrf52840";
16
17	chosen {
18		zephyr,console = &uart0;
19		zephyr,shell-uart = &uart0;
20		zephyr,uart-mcumgr = &uart0;
21		zephyr,bt-mon-uart = &uart0;
22		zephyr,bt-c2h-uart = &uart0;
23		zephyr,ieee802154 = &ieee802154;
24	};
25
26	leds {
27		compatible = "gpio-leds";
28		led0: led_0 {
29			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
30			label = "Green LED 0";
31		};
32		led1: led_1 {
33			gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
34			label = "Green LED 1";
35		};
36		led2: led_2 {
37			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
38			label = "Green LED 2";
39		};
40		led3: led_3 {
41			gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
42			label = "Green LED 3";
43		};
44	};
45
46	pwmleds {
47		compatible = "pwm-leds";
48		pwm_led0: pwm_led_0 {
49			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
50		};
51	};
52
53	buttons {
54		compatible = "gpio-keys";
55		button0: button_0 {
56			gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
57			label = "Push button switch 0";
58			zephyr,code = <INPUT_KEY_0>;
59		};
60		button1: button_1 {
61			gpios = <&gpio0 12 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
62			label = "Push button switch 1";
63			zephyr,code = <INPUT_KEY_1>;
64		};
65		button2: button_2 {
66			gpios = <&gpio0 24 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
67			label = "Push button switch 2";
68			zephyr,code = <INPUT_KEY_2>;
69		};
70		button3: button_3 {
71			gpios = <&gpio0 25 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
72			label = "Push button switch 3";
73			zephyr,code = <INPUT_KEY_3>;
74		};
75	};
76
77	arduino_header: connector {
78		compatible = "arduino-header-r3";
79		#gpio-cells = <2>;
80		gpio-map-mask = <0xffffffff 0xffffffc0>;
81		gpio-map-pass-thru = <0 0x3f>;
82		gpio-map = <0 0 &gpio0 3 0>,	/* A0 */
83			   <1 0 &gpio0 4 0>,	/* A1 */
84			   <2 0 &gpio0 28 0>,	/* A2 */
85			   <3 0 &gpio0 29 0>,	/* A3 */
86			   <4 0 &gpio0 30 0>,	/* A4 */
87			   <5 0 &gpio0 31 0>,	/* A5 */
88			   <6 0 &gpio1 1 0>,	/* D0 */
89			   <7 0 &gpio1 2 0>,	/* D1 */
90			   <8 0 &gpio1 3 0>,	/* D2 */
91			   <9 0 &gpio1 4 0>,	/* D3 */
92			   <10 0 &gpio1 5 0>,	/* D4 */
93			   <11 0 &gpio1 6 0>,	/* D5 */
94			   <12 0 &gpio1 7 0>,	/* D6 */
95			   <13 0 &gpio1 8 0>,	/* D7 */
96			   <14 0 &gpio1 10 0>,	/* D8 */
97			   <15 0 &gpio1 11 0>,	/* D9 */
98			   <16 0 &gpio1 12 0>,	/* D10 */
99			   <17 0 &gpio1 13 0>,	/* D11 */
100			   <18 0 &gpio1 14 0>,	/* D12 */
101			   <19 0 &gpio1 15 0>,	/* D13 */
102			   <20 0 &gpio0 26 0>,	/* D14 */
103			   <21 0 &gpio0 27 0>;	/* D15 */
104	};
105
106	arduino_adc: analog-connector {
107		compatible = "arduino,uno-adc";
108		#io-channel-cells = <1>;
109		io-channel-map = <0 &adc 1>,	/* A0 = P0.3 = AIN1 */
110				 <1 &adc 2>,	/* A1 = P0.4 = AIN2 */
111				 <2 &adc 4>,	/* A2 = P0.28 = AIN4 */
112				 <3 &adc 5>,	/* A3 = P0.29 = AIN5 */
113				 <4 &adc 6>,	/* A4 = P0.30 = AIN6 */
114				 <5 &adc 7>;	/* A5 = P0.31 = AIN7 */
115	};
116
117	/* These aliases are provided for compatibility with samples */
118	aliases {
119		led0 = &led0;
120		led1 = &led1;
121		led2 = &led2;
122		led3 = &led3;
123		pwm-led0 = &pwm_led0;
124		sw0 = &button0;
125		sw1 = &button1;
126		sw2 = &button2;
127		sw3 = &button3;
128		bootloader-led0 = &led0;
129		mcuboot-button0 = &button0;
130		mcuboot-led0 = &led0;
131		watchdog0 = &wdt0;
132	};
133};
134
135&reg0 {
136	status = "okay";
137};
138
139&reg1 {
140	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
141};
142
143&adc {
144	status = "okay";
145};
146
147&uicr {
148	gpio-as-nreset;
149};
150
151&gpiote {
152	status = "okay";
153};
154
155&gpio0 {
156	status = "okay";
157	gpio-reserved-ranges = <0 2>, <6 1>, <8 3>, <17 7>;
158	gpio-line-names = "XL1", "XL2", "AREF", "A0", "A1", "RTS", "TXD",
159		"CTS", "RXD", "NFC1", "NFC2", "BUTTON1", "BUTTON2", "LED1",
160		"LED2", "LED3", "LED4", "QSPI CS", "RESET", "QSPI CLK",
161		"QSPI DIO0", "QSPI DIO1", "QSPI DIO2", "QSPI DIO3","BUTTON3",
162		"BUTTON4", "SDA", "SCL", "A2", "A3", "A4", "A5";
163};
164
165&gpio1 {
166	status = "okay";
167	gpio-line-names = "", "D0", "D1", "D2", "D3", "D4", "D5", "D6",
168		"D7", "", "D8", "D9", "D10", "D11", "D12", "D13";
169};
170
171&uart0 {
172	compatible = "nordic,nrf-uarte";
173	status = "okay";
174	current-speed = <115200>;
175	pinctrl-0 = <&uart0_default>;
176	pinctrl-1 = <&uart0_sleep>;
177	pinctrl-names = "default", "sleep";
178};
179
180arduino_serial: &uart1 {
181	current-speed = <115200>;
182	pinctrl-0 = <&uart1_default>;
183	pinctrl-1 = <&uart1_sleep>;
184	pinctrl-names = "default", "sleep";
185};
186
187arduino_i2c: &i2c0 {
188	compatible = "nordic,nrf-twi";
189	status = "okay";
190	pinctrl-0 = <&i2c0_default>;
191	pinctrl-1 = <&i2c0_sleep>;
192	pinctrl-names = "default", "sleep";
193};
194
195&i2c1 {
196	compatible = "nordic,nrf-twi";
197	/* Cannot be used together with spi1. */
198	/* status = "okay"; */
199	pinctrl-0 = <&i2c1_default>;
200	pinctrl-1 = <&i2c1_sleep>;
201	pinctrl-names = "default", "sleep";
202};
203
204&pwm0 {
205	status = "okay";
206	pinctrl-0 = <&pwm0_default>;
207	pinctrl-1 = <&pwm0_sleep>;
208	pinctrl-names = "default", "sleep";
209};
210
211&spi0 {
212	compatible = "nordic,nrf-spi";
213	/* Cannot be used together with i2c0. */
214	/* status = "okay"; */
215	pinctrl-0 = <&spi0_default>;
216	pinctrl-1 = <&spi0_sleep>;
217	pinctrl-names = "default", "sleep";
218};
219
220&spi1 {
221	compatible = "nordic,nrf-spi";
222	status = "okay";
223	pinctrl-0 = <&spi1_default>;
224	pinctrl-1 = <&spi1_sleep>;
225	pinctrl-names = "default", "sleep";
226};
227
228&spi2 {
229	compatible = "nordic,nrf-spi";
230	status = "disabled";
231	pinctrl-0 = <&spi2_default>;
232	pinctrl-1 = <&spi2_sleep>;
233	pinctrl-names = "default", "sleep";
234};
235
236&qspi {
237	status = "okay";
238	pinctrl-0 = <&qspi_default>;
239	pinctrl-1 = <&qspi_sleep>;
240	pinctrl-names = "default", "sleep";
241	mx25r64: mx25r6435f@0 {
242		compatible = "nordic,qspi-nor";
243		reg = <0>;
244		/* MX25R64 supports only pp and pp4io */
245		writeoc = "pp4io";
246		/* MX25R64 supports all readoc options */
247		readoc = "read4io";
248		sck-frequency = <8000000>;
249		jedec-id = [c2 28 17];
250		sfdp-bfp = [
251			e5 20 f1 ff  ff ff ff 03  44 eb 08 6b  08 3b 04 bb
252			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
253			10 d8 00 ff  23 72 f5 00  82 ed 04 cc  44 83 68 44
254			30 b0 30 b0  f7 c4 d5 5c  00 be 29 ff  f0 d0 ff ff
255		];
256		size = <67108864>;
257		has-dpd;
258		t-enter-dpd = <10000>;
259		t-exit-dpd = <35000>;
260	};
261};
262
263arduino_spi: &spi3 {
264	status = "okay";
265	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
266	pinctrl-0 = <&spi3_default>;
267	pinctrl-1 = <&spi3_sleep>;
268	pinctrl-names = "default", "sleep";
269};
270
271&ieee802154 {
272	status = "okay";
273};
274
275zephyr_udc0: &usbd {
276	compatible = "nordic,nrf-usbd";
277	status = "okay";
278};
279