1/*
2 * Copyright (c) 2017 Linaro Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <nordic/nrf51822_qfac.dtsi>
9#include "nrf51dk_nrf51822-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "Nordic nRF51 DK NRF51822";
14	compatible = "nordic,nrf51-dk-nrf51822";
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	};
26
27	leds {
28		compatible = "gpio-leds";
29		led0: led_0 {
30			gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
31			label = "Green LED 0";
32		};
33		led1: led_1 {
34			gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
35			label = "Green LED 1";
36		};
37		led2: led_2 {
38			gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
39			label = "Green LED 2";
40		};
41		led3: led_3 {
42			gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
43			label = "Green LED 3";
44		};
45	};
46
47	pwmleds {
48		compatible = "pwm-leds";
49		pwm_led0: pwm_led_0 {
50			pwms = <&sw_pwm 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
51		};
52	};
53
54	buttons {
55		compatible = "gpio-keys";
56		button0: button_0 {
57			gpios = <&gpio0 17 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
58			label = "Push button switch 0";
59			zephyr,code = <INPUT_KEY_0>;
60		};
61		button1: button_1 {
62			gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
63			label = "Push button switch 1";
64			zephyr,code = <INPUT_KEY_1>;
65		};
66		button2: button_2 {
67			gpios = <&gpio0 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
68			label = "Push button switch 2";
69			zephyr,code = <INPUT_KEY_2>;
70		};
71		button3: button_3 {
72			gpios = <&gpio0 20 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
73			label = "Push button switch 3";
74			zephyr,code = <INPUT_KEY_3>;
75		};
76	};
77
78	/* These aliases are provided for compatibility with samples */
79	aliases {
80		led0 = &led0;
81		led1 = &led1;
82		led2 = &led2;
83		led3 = &led3;
84		pwm-led0 = &pwm_led0;
85		sw0 = &button0;
86		sw1 = &button1;
87		sw2 = &button2;
88		sw3 = &button3;
89		bootloader-led0 = &led0;
90		mcuboot-button0 = &button0;
91		mcuboot-led0 = &led0;
92		watchdog0 = &wdt0;
93	};
94};
95
96&sw_pwm {
97	status ="okay";
98	channel-gpios = <&gpio0 21 PWM_POLARITY_INVERTED>;
99	clock-prescaler = <8>;
100};
101
102&gpiote {
103	status = "okay";
104};
105
106&gpio0 {
107	status = "okay";
108};
109
110&adc {
111	status = "okay";
112};
113
114&uart0 {
115	current-speed = <115200>;
116	status = "okay";
117	pinctrl-0 = <&uart0_default>;
118	pinctrl-1 = <&uart0_sleep>;
119	pinctrl-names = "default", "sleep";
120};
121
122&i2c0 {
123	status = "okay";
124	pinctrl-0 = <&i2c0_default>;
125	pinctrl-1 = <&i2c0_sleep>;
126	pinctrl-names = "default", "sleep";
127};
128
129&i2c1 {
130	/* Cannot be used together with spi1. */
131	/* status = "okay"; */
132	pinctrl-0 = <&i2c1_default>;
133	pinctrl-1 = <&i2c1_sleep>;
134	pinctrl-names = "default", "sleep";
135};
136
137&spi0 {
138	/* Cannot be used together with i2c0. */
139	/* status = "okay"; */
140	pinctrl-0 = <&spi0_default>;
141	pinctrl-1 = <&spi0_sleep>;
142	pinctrl-names = "default", "sleep";
143};
144
145&spi1 {
146	compatible = "nordic,nrf-spi";
147	status = "okay";
148	pinctrl-0 = <&spi1_default>;
149	pinctrl-1 = <&spi1_sleep>;
150	pinctrl-names = "default", "sleep";
151};
152
153&flash0 {
154
155	partitions {
156		compatible = "fixed-partitions";
157		#address-cells = <1>;
158		#size-cells = <1>;
159
160		boot_partition: partition@0 {
161			label = "mcuboot";
162			reg = <0x00000000 0x8000>;
163		};
164		slot0_partition: partition@8000 {
165			label = "image-0";
166			reg = <0x00008000 0x1b000>;
167		};
168		slot1_partition: partition@23000 {
169			label = "image-1";
170			reg = <0x00023000 0x1b000>;
171		};
172		storage_partition: partition@3e000 {
173			label = "storage";
174			reg = <0x0003e000 0x00002000>;
175		};
176	};
177};
178