1/*
2 * Copyright (c) 2020 u-blox AG
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <nordic/nrf52833_qiaa.dtsi>
9#include "ubx_evkninab4_nrf52833-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "u-blox EVK-NINA-B4 NRF52833";
14	compatible = "u-blox,ubx_evkninab4_nrf52833";
15
16	chosen {
17		zephyr,console = &uart0;
18		zephyr,shell-uart = &uart0;
19		zephyr,uart-mcumgr = &uart0;
20		zephyr,bt-mon-uart = &uart0;
21		zephyr,bt-c2h-uart = &uart0;
22		zephyr,sram = &sram0;
23		zephyr,flash = &flash0;
24		zephyr,code-partition = &slot0_partition;
25		zephyr,ieee802154 = &ieee802154;
26	};
27
28	leds {
29		compatible = "gpio-leds";
30		led0: led_0 {
31			/* NINA-B1 GPIO_1 */
32			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
33			label = "Red LED";
34		};
35		led1: led_1 {
36			/* NINA-B4 GPIO_7 */
37			gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
38			label = "Green LED";
39		};
40		led2: led_2 {
41			/*NINA-B1 GPIO_8 */
42			gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
43			label = "Blue LED";
44		};
45	};
46
47	pwmleds {
48		compatible = "pwm-leds";
49		red_pwm_led: red_pwm_led {
50			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
51		};
52		green_pwm_led: green_pwm_led {
53			pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
54		};
55		blue_pwm_led: blue_pwm_led {
56			pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
57		};
58	};
59
60	buttons {
61		compatible = "gpio-keys";
62		button0: button_0 {
63			/* EVK-NINA-B4 SW1 button */
64			gpios = <&gpio1 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
65			label = "Push button switch 0";
66			zephyr,code = <INPUT_KEY_0>;
67		};
68		button1: button_1 {
69			/* EVK-NINA-B4 SW2 button */
70			gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
71			label = "Push button switch 1";
72			zephyr,code = <INPUT_KEY_1>;
73		};
74	};
75
76	arduino_header: connector {
77		compatible = "arduino-header-r3";
78		#gpio-cells = <2>;
79		gpio-map-mask = <0xffffffff 0xffffffc0>;
80		gpio-map-pass-thru = <0 0x3f>;
81		gpio-map = <0 0 &gpio0 4 0>,	/* A0 */
82			   <1 0 &gpio0 30 0>,	/* A1 */
83			   <2 0 &gpio0 5 0>,	/* A2 */
84			   <3 0 &gpio0 2 0>,	/* A3 */
85			   <4 0 &gpio0 28 0>,	/* A4 */
86			   <5 0 &gpio0 3 0>,	/* A5 */
87			   <6 0 &gpio0 29 0>,	/* D0 */
88			   <7 0 &gpio1 5 0>,	/* D1 */
89			   <8 0 &gpio0 23 0>,	/* D2 */
90			   <9 0 &gpio0 31 0>,	/* D3 */
91			   <10 0 &gpio0 13 0>,	/* D4 */
92			   <11 0 &gpio0 11 0>,	/* D5 */
93			   <12 0 &gpio0 9 0>,	/* D6 */ /* NFC use by default */
94			   <13 0 &gpio0 10 0>,	/* D7 */ /* NFC use by default */
95			   <14 0 &gpio1 9 0>,	/* D8 */
96			   <15 0 &gpio0 12 0>,	/* D9 */
97			   <16 0 &gpio0 0 0>,	/* D10 */ /* Disconnected, see EVK User Guide */
98			   <17 0 &gpio0 1 0>,	/* D11 */ /* Disconnected, see EVK User Guide */
99			   <18 0 &gpio1 0 0>,	/* D12 */
100			   <19 0 &gpio0 7 0>,	/* D13 */
101			   <20 0 &gpio0 16 0>,	/* D14 */  /* SDA */
102			   <21 0 &gpio0 17 0>;	/* D15 */  /* SCL */
103	};
104
105	arduino_adc: analog-connector {
106		compatible = "arduino,uno-adc";
107		#io-channel-cells = <1>;
108		io-channel-map = <0 &adc 2>,	/* A0 = P0.04 = AIN2 */
109				 <1 &adc 6>,	/* A1 = P0.30 = AIN6 */
110				 <2 &adc 3>,	/* A2 = P0.5 = AIN3 */
111				 <3 &adc 0>,	/* A3 = P0.2 = AIN0 */
112				 <4 &adc 4>,	/* A4 = P0.28 = AIN4 */
113				 <5 &adc 1>;	/* A5 = P0.3 = AIN1 */
114	};
115
116	/* These aliases are provided for compatibility with samples */
117	aliases {
118		led0 = &led0;
119		led1 = &led1;
120		led2 = &led2;
121		pwm-led0 = &red_pwm_led;
122		pwm-led1 = &green_pwm_led;
123		pwm-led2 = &blue_pwm_led;
124		red-pwm-led = &red_pwm_led;
125		green-pwm-led = &green_pwm_led;
126		blue-pwm-led = &blue_pwm_led;
127		sw0 = &button0;
128		sw1 = &button1;
129		watchdog0 = &wdt0;
130	};
131};
132
133&reg1 {
134	regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
135};
136
137&adc {
138	status = "okay";
139};
140
141&uicr {
142	gpio-as-nreset;
143};
144
145&gpiote {
146	status = "okay";
147};
148
149&gpio0 {
150	status = "okay";
151};
152
153&gpio1 {
154	status = "okay";
155};
156
157&uart0 {
158	compatible = "nordic,nrf-uart";
159	status = "okay";
160	current-speed = <115200>;
161	pinctrl-0 = <&uart0_default>;
162	pinctrl-1 = <&uart0_sleep>;
163	pinctrl-names = "default", "sleep";
164};
165
166arduino_i2c: &i2c0 {
167	compatible = "nordic,nrf-twi";
168	status = "okay";
169	pinctrl-0 = <&i2c0_default>;
170	pinctrl-1 = <&i2c0_sleep>;
171	pinctrl-names = "default", "sleep";
172};
173
174&spi0 {
175	compatible = "nordic,nrf-spi";
176	/* Cannot be used together with i2c0. */
177	/* status = "okay"; */
178	pinctrl-0 = <&spi0_default>;
179	pinctrl-1 = <&spi0_sleep>;
180	pinctrl-names = "default", "sleep";
181};
182
183&spi1 {
184	compatible = "nordic,nrf-spi";
185	status = "okay";
186	pinctrl-0 = <&spi1_default>;
187	pinctrl-1 = <&spi1_sleep>;
188	pinctrl-names = "default", "sleep";
189};
190
191arduino_spi: &spi2 {
192	compatible = "nordic,nrf-spim";
193	status = "okay";
194	cs-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>; /* D10 */
195	pinctrl-0 = <&spi2_default>;
196	pinctrl-1 = <&spi2_sleep>;
197	pinctrl-names = "default", "sleep";
198};
199
200&pwm0 {
201	status = "okay";
202	pinctrl-0 = <&pwm0_default>;
203	pinctrl-1 = <&pwm0_sleep>;
204	pinctrl-names = "default", "sleep";
205};
206
207&ieee802154 {
208	status = "okay";
209};
210
211&flash0 {
212	partitions {
213		compatible = "fixed-partitions";
214		#address-cells = <1>;
215		#size-cells = <1>;
216
217		boot_partition: partition@0 {
218			label = "mcuboot";
219			reg = <0x00000000 0xC000>;
220		};
221		slot0_partition: partition@c000 {
222			label = "image-0";
223			reg = <0x0000C000 0x32000>;
224		};
225		slot1_partition: partition@3e000 {
226			label = "image-1";
227			reg = <0x0003E000 0x32000>;
228		};
229		scratch_partition: partition@70000 {
230			label = "image-scratch";
231			reg = <0x00070000 0xA000>;
232		};
233		storage_partition: partition@7a000 {
234			label = "storage";
235			reg = <0x0007A000 0x00006000>;
236		};
237	};
238};
239
240zephyr_udc0: &usbd {
241	compatible = "nordic,nrf-usbd";
242	status = "okay";
243};
244