1/*
2 * Copyright (c) 2018-2020 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#include "nrf9160dk_nrf9160_common-pinctrl.dtsi"
7#include <zephyr/dt-bindings/input/input-event-codes.h>
8
9/ {
10	model = "Nordic nRF9160 DK NRF9160";
11	compatible = "nordic,nrf9160-dk-nrf9160";
12
13	chosen {
14		zephyr,console = &uart0;
15		zephyr,shell-uart = &uart0;
16		zephyr,uart-mcumgr = &uart0;
17	};
18
19	leds {
20		compatible = "gpio-leds";
21		led0: led_0 {
22			gpios = <&gpio0 2 0>;
23			label = "Green LED 1";
24		};
25		led1: led_1 {
26			gpios = <&gpio0 3 0>;
27			label = "Green LED 2";
28		};
29		led2: led_2 {
30			gpios = <&gpio0 4 0>;
31			label = "Green LED 3";
32		};
33		led3: led_3 {
34			gpios = <&gpio0 5 0>;
35			label = "Green LED 4";
36		};
37	};
38
39	pwmleds {
40		compatible = "pwm-leds";
41		pwm_led0: pwm_led_0 {
42			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
43		};
44	};
45
46	buttons {
47		/*
48		 * Unlike most DK boards, we do not actually have 4 buttons
49		 * on nRF9160 DK. Instead, we have 2 buttons and 2 switches.
50		 * Treat the switches as buttons anyway, for convenience.
51		 * This makes life easier for software that wants to deal with
52		 * the usual "4 buttons per DK board" convention.
53		 */
54		compatible = "gpio-keys";
55		button0: button_0 {
56			gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
57			label = "Push button 1";
58			zephyr,code = <INPUT_KEY_0>;
59		};
60		button1: button_1 {
61			gpios = <&gpio0 7 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
62			label = "Push button 2";
63			zephyr,code = <INPUT_KEY_1>;
64		};
65		button2: button_2 {
66			gpios = <&gpio0 8 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
67			label = "Switch 1";
68			zephyr,code = <INPUT_KEY_2>;
69		};
70		button3: button_3 {
71			gpios = <&gpio0 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
72			label = "Switch 2";
73			zephyr,code = <INPUT_KEY_3>;
74		};
75	};
76
77	interface_to_nrf52840: gpio-interface {
78		compatible = "nordic,nrf9160dk-nrf52840-interface";
79		#gpio-cells = <2>;
80		gpio-map-mask = <0xf 0>;
81		gpio-map-pass-thru = <0 0xffffffff>;
82		gpio-map = <0 0 &gpio0 17 0>,
83			   <1 0 &gpio0 18 0>,
84			   <2 0 &gpio0 19 0>,
85			   <3 0 &gpio0 21 0>,
86			   <4 0 &gpio0 22 0>,
87			   <5 0 &gpio0 23 0>;
88			   /* 6: COEX0 */
89			   /* 7: COEX1 */
90			   /* 8: COEX2 */
91	};
92
93	nrf52840_reset: gpio-reset {
94		compatible = "nordic,nrf9160dk-nrf52840-reset";
95		status = "disabled";
96		/*
97		 * This line is specified as active high for compatibility
98		 * with the previously used Kconfig-based configuration.
99		 */
100		gpios = <&interface_to_nrf52840 5 GPIO_ACTIVE_HIGH>;
101	};
102
103	arduino_header: connector {
104		compatible = "arduino-header-r3";
105		#gpio-cells = <2>;
106		gpio-map-mask = <0xffffffff 0xffffffc0>;
107		gpio-map-pass-thru = <0 0x3f>;
108		gpio-map = <0 0 &gpio0 14 0>,	/* A0 */
109			   <1 0 &gpio0 15 0>,	/* A1 */
110			   <2 0 &gpio0 16 0>,	/* A2 */
111			   <3 0 &gpio0 17 0>,	/* A3 */
112			   <4 0 &gpio0 18 0>,	/* A4 */
113			   <5 0 &gpio0 19 0>,	/* A5 */
114			   <6 0 &gpio0 0 0>,	/* D0 */
115			   <7 0 &gpio0 1 0>,	/* D1 */
116			   <8 0 &gpio0 2 0>,	/* D2 */
117			   <9 0 &gpio0 3 0>,	/* D3 */
118			   <10 0 &gpio0 4 0>,	/* D4 */
119			   <11 0 &gpio0 5 0>,	/* D5 */
120			   <12 0 &gpio0 6 0>,	/* D6 */
121			   <13 0 &gpio0 7 0>,	/* D7 */
122			   <14 0 &gpio0 8 0>,	/* D8 */
123			   <15 0 &gpio0 9 0>,	/* D9 */
124			   <16 0 &gpio0 10 0>,	/* D10 */
125			   <17 0 &gpio0 11 0>,	/* D11 */
126			   <18 0 &gpio0 12 0>,	/* D12 */
127			   <19 0 &gpio0 13 0>,	/* D13 */
128			   <20 0 &gpio0 30 0>,	/* D14 */
129			   <21 0 &gpio0 31 0>;	/* D15 */
130	};
131
132	arduino_adc: analog-connector {
133		compatible = "arduino,uno-adc";
134		#io-channel-cells = <1>;
135		io-channel-map = <0 &adc 1>,	/* A0 = P0.14 = AIN1 */
136				 <1 &adc 2>,	/* A1 = P0.15 = AIN2 */
137				 <2 &adc 3>,	/* A2 = P0.16 = AIN3 */
138				 <3 &adc 4>,	/* A3 = P0.17 = AIN4 */
139				 <4 &adc 5>,	/* A4 = P0.18 = AIN5 */
140				 <5 &adc 6>;	/* A5 = P0.19 = AIN6 */
141	};
142
143	/* These aliases are provided for compatibility with samples */
144	aliases {
145		led0 = &led0;
146		led1 = &led1;
147		led2 = &led2;
148		led3 = &led3;
149		pwm-led0 = &pwm_led0;
150		sw0 = &button0;
151		sw1 = &button1;
152		sw2 = &button2;
153		sw3 = &button3;
154		bootloader-led0 = &led0;
155		mcuboot-button0 = &button0;
156		mcuboot-led0 = &led0;
157		watchdog0 = &wdt0;
158	};
159};
160
161&adc {
162	status = "okay";
163};
164
165&gpiote {
166	status = "okay";
167};
168
169&gpio0 {
170	status = "okay";
171};
172
173&uart0 {
174	status = "okay";
175	current-speed = <115200>;
176	pinctrl-0 = <&uart0_default>;
177	pinctrl-1 = <&uart0_sleep>;
178	pinctrl-names = "default", "sleep";
179};
180
181arduino_serial: &uart1 {
182	status = "okay";
183	current-speed = <115200>;
184	pinctrl-0 = <&uart1_default>;
185	pinctrl-1 = <&uart1_sleep>;
186	pinctrl-names = "default", "sleep";
187};
188
189&uart2 {
190	pinctrl-0 = <&uart2_default>;
191	pinctrl-1 = <&uart2_sleep>;
192	pinctrl-names = "default", "sleep";
193};
194
195arduino_i2c: &i2c2 {
196	compatible = "nordic,nrf-twim";
197	status = "okay";
198	pinctrl-0 = <&i2c2_default>;
199	pinctrl-1 = <&i2c2_sleep>;
200	pinctrl-names = "default", "sleep";
201};
202
203&pwm0 {
204	status = "okay";
205	pinctrl-0 = <&pwm0_default>;
206	pinctrl-1 = <&pwm0_sleep>;
207	pinctrl-names = "default", "sleep";
208};
209
210arduino_spi: &spi3 {
211	compatible = "nordic,nrf-spim";
212	status = "okay";
213	cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
214	pinctrl-0 = <&spi3_default>;
215	pinctrl-1 = <&spi3_sleep>;
216	pinctrl-names = "default", "sleep";
217};
218
219&flash0 {
220
221	partitions {
222		compatible = "fixed-partitions";
223		#address-cells = <1>;
224		#size-cells = <1>;
225
226		boot_partition: partition@0 {
227			label = "mcuboot";
228			reg = <0x00000000 0x10000>;
229		};
230		slot0_partition: partition@10000 {
231			label = "image-0";
232		};
233		slot0_ns_partition: partition@50000 {
234			label = "image-0-nonsecure";
235		};
236		slot1_partition: partition@80000 {
237			label = "image-1";
238		};
239		slot1_ns_partition: partition@c0000 {
240			label = "image-1-nonsecure";
241		};
242		/* 0xf0000 to 0xf7fff reserved for TF-M partitions */
243		storage_partition: partition@f8000 {
244			label = "storage";
245			reg = <0x000f8000 0x00008000>;
246		};
247	};
248};
249
250/ {
251
252	reserved-memory {
253		#address-cells = <1>;
254		#size-cells = <1>;
255		ranges;
256
257		sram0_s: image_s@20000000 {
258			/* Secure image memory */
259		};
260
261		sram0_modem: image_modem@20016000 {
262			/* Modem (shared) memory */
263		};
264
265		sram0_ns: image_ns@20020000 {
266			/* Non-Secure image memory */
267		};
268	};
269};
270
271/* Include partition configuration file */
272#include "nrf9160dk_nrf9160_partition_conf.dtsi"
273