1/*
2 * Copyright (c) 2018-2023 Nordic Semiconductor ASA
3 * Copyright (c) 2017 Linaro Limited
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <nordic/nrf52840_qiaa.dtsi>
10#include "nrf52840dongle_nrf52840-pinctrl.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "Nordic nRF52840 Dongle NRF52840";
15	compatible = "nordic,nrf52840-dongle-nrf52840";
16
17	chosen {
18		zephyr,console = &cdc_acm_uart;
19		zephyr,shell-uart = &cdc_acm_uart;
20		zephyr,uart-mcumgr = &cdc_acm_uart;
21		zephyr,bt-mon-uart = &cdc_acm_uart;
22		zephyr,bt-c2h-uart = &cdc_acm_uart;
23		zephyr,sram = &sram0;
24		zephyr,flash = &flash0;
25		zephyr,code-partition = &slot0_partition;
26		zephyr,ieee802154 = &ieee802154;
27	};
28
29	leds {
30		compatible = "gpio-leds";
31		led0_green: led_0 {
32			gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
33			label = "Green LED 0";
34		};
35		led1_red: led_1 {
36			gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
37			label = "Red LED 1";
38		};
39		led1_green: led_2 {
40			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
41			label = "Green LED 1";
42		};
43		led1_blue: led_3 {
44			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
45			label = "Blue LED 1";
46		};
47	};
48
49	pwmleds {
50		compatible = "pwm-leds";
51		red_pwm_led: pwm_led_0 {
52			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
53		};
54		green_pwm_led: pwm_led_1 {
55			pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
56		};
57		blue_pwm_led: pwm_led_2 {
58			pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
59		};
60	};
61
62	buttons {
63		compatible = "gpio-keys";
64		button0: button_0 {
65			gpios = <&gpio1 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
66			label = "Push button switch 0";
67			zephyr,code = <INPUT_KEY_0>;
68		};
69	};
70
71	/* These aliases are provided for compatibility with samples */
72	aliases {
73		sw0 = &button0;
74		led0 = &led0_green;
75		led1 = &led1_red;
76		led2 = &led1_green;
77		led3 = &led1_blue;
78		led0-green = &led0_green;
79		led1-red   = &led1_red;
80		led1-green = &led1_green;
81		led1-blue  = &led1_blue;
82		pwm-led0 = &red_pwm_led;
83		pwm-led1 = &green_pwm_led;
84		pwm-led2 = &blue_pwm_led;
85		red-pwm-led = &red_pwm_led;
86		green-pwm-led = &green_pwm_led;
87		blue-pwm-led = &blue_pwm_led;
88		mcuboot-button0 = &button0;
89		mcuboot-led0 = &led0_green;
90		watchdog0 = &wdt0;
91	};
92};
93
94&adc {
95	status = "okay";
96};
97
98&gpiote {
99	status = "okay";
100};
101
102&uicr {
103	nfct-pins-as-gpios;
104	gpio-as-nreset;
105};
106
107&gpio0 {
108	status = "okay";
109};
110
111&gpio1 {
112	status = "okay";
113};
114
115&uart0 {
116	compatible = "nordic,nrf-uarte";
117	status = "okay";
118	current-speed = <115200>;
119	pinctrl-0 = <&uart0_default>;
120	pinctrl-1 = <&uart0_sleep>;
121	pinctrl-names = "default", "sleep";
122};
123
124&i2c0 {
125	compatible = "nordic,nrf-twi";
126	status = "okay";
127	pinctrl-0 = <&i2c0_default>;
128	pinctrl-1 = <&i2c0_sleep>;
129	pinctrl-names = "default", "sleep";
130};
131
132&i2c1 {
133	compatible = "nordic,nrf-twi";
134	/* Cannot be used together with spi1. */
135	/* status = "okay"; */
136	pinctrl-0 = <&i2c1_default>;
137	pinctrl-1 = <&i2c1_sleep>;
138	pinctrl-names = "default", "sleep";
139};
140
141&pwm0 {
142	status = "okay";
143	pinctrl-0 = <&pwm0_default>;
144	pinctrl-1 = <&pwm0_sleep>;
145	pinctrl-names = "default", "sleep";
146};
147
148/*
149 * By default, not adding all available SPI instances (spi2, spi3) due to
150 * limited GPIOs available on dongle board.
151 */
152&spi0 {
153	compatible = "nordic,nrf-spi";
154	/* Cannot be used together with i2c0. */
155	/* status = "okay"; */
156	pinctrl-0 = <&spi0_default>;
157	pinctrl-1 = <&spi0_sleep>;
158	pinctrl-names = "default", "sleep";
159};
160
161&spi1 {
162	compatible = "nordic,nrf-spi";
163	status = "okay";
164	pinctrl-0 = <&spi1_default>;
165	pinctrl-1 = <&spi1_sleep>;
166	pinctrl-names = "default", "sleep";
167};
168
169&ieee802154 {
170	status = "okay";
171};
172
173/* Include flash partition table.
174 * Two partition tables are available:
175 * fstab-stock		-compatible with Nordic nRF5 bootloader, default
176 * fstab-debugger	-to use an external debugger, w/o the nRF5 bootloader
177 */
178#include "fstab-stock.dtsi"
179
180zephyr_udc0: &usbd {
181	compatible = "nordic,nrf-usbd";
182	status = "okay";
183
184	cdc_acm_uart: cdc_acm_uart {
185		compatible = "zephyr,cdc-acm-uart";
186	};
187};
188