1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#include "thingy53_nrf5340_common-pinctrl.dtsi"
7#include <zephyr/dt-bindings/input/input-event-codes.h>
8
9/ {
10	chosen {
11		zephyr,console = &cdc_acm_uart;
12		zephyr,shell-uart = &cdc_acm_uart;
13		zephyr,uart-mcumgr = &cdc_acm_uart;
14		zephyr,bt-mon-uart = &cdc_acm_uart;
15		zephyr,bt-c2h-uart = &cdc_acm_uart;
16		zephyr,bt-hci-ipc = &ipc0;
17		zephyr,bt-hci = &bt_hci_ipc0;
18		nordic,802154-spinel-ipc = &ipc0;
19		zephyr,ieee802154 = &ieee802154;
20	};
21
22	buttons {
23		compatible = "gpio-keys";
24		button0: button_0 {
25			gpios = <&gpio1 14 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
26			label = "Push button 1";
27			zephyr,code = <INPUT_KEY_0>;
28		};
29		button1: button_1 {
30			gpios = <&gpio1 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
31			label = "Push button 2";
32			zephyr,code = <INPUT_KEY_1>;
33		};
34	};
35
36	leds {
37		compatible = "gpio-leds";
38		red_led: led_1 {
39			gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
40			label = "RGB red LED";
41		};
42		green_led: led_2 {
43			gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
44			label = "RGB green LED";
45		};
46		blue_led: led_3 {
47			gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
48			label = "RGB blue LED";
49		};
50	};
51
52	pwmleds {
53		compatible = "pwm-leds";
54		red_led_pwm: led_pwm_0 {
55			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
56			label = "Red PWM LED";
57		};
58
59		green_led_pwm: led_pwm_1 {
60			pwms = <&pwm0 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
61			label = "Green PWM LED";
62		};
63
64		blue_led_pwm: led_pwm_2 {
65			pwms = <&pwm0 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
66			label = "Blue PWM LED";
67		};
68	};
69
70	edge_connector: connector {
71		compatible = "nordic-thingy53-edge-connector";
72		#gpio-cells = <2>;
73		gpio-map-mask = <0xffffffff 0xffffffc0>;
74		gpio-map-pass-thru = <0 0x3f>;
75		gpio-map = <8 0 &gpio0 5 0>,	/* P8, P0.05/AIN1 */
76			   <9 0 &gpio0 4 0>,	/* P9, P0.04/AIN0 */
77			   <15 0 &gpio0 8 0>,	/* P15, P0.08/TRACEDATA3 */
78			   <16 0 &gpio0 9 0>,	/* P16, P0.09/TRACEDATA2 */
79			   <17 0 &gpio0 10 0>,	/* P17, P0.10/TRACEDATA1 */
80			   <18 0 &gpio0 11 0>,	/* P18, P0.11/TRACEDATA0 */
81			   <19 0 &gpio0 12 0>;	/* P19, P0.12/TRACECLK */
82	};
83
84	npm1100_force_pwm_mode: npm1100_force_pwm_mode {
85		compatible = "regulator-fixed";
86		regulator-name = "npm1100_force_pwm_mode";
87		enable-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
88		status = "disabled";
89		regulator-boot-on;
90	};
91
92	vbatt: vbatt {
93		compatible = "voltage-divider";
94		io-channels = <&adc 2>;
95		output-ohms = <180000>;
96		full-ohms = <(1500000 + 180000)>;
97		power-gpios = <&gpio0 16 0>;
98	};
99
100	regulator_3v3: regulator-3v3-ctrl {
101		compatible = "regulator-fixed";
102		regulator-name = "ncp114";
103		enable-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
104		regulator-boot-on;
105	};
106
107	sensor_pwr_ctrl: sensor-pwr-ctrl {
108		compatible = "regulator-fixed";
109		regulator-name = "tck106ag";
110		enable-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
111		regulator-boot-on;
112	};
113
114	gpio_fwd: nrf-gpio-forwarder {
115		compatible = "nordic,nrf-gpio-forwarder";
116		status = "okay";
117		fem-gpio-if {
118			gpios = <&gpio1 11 0>,
119				<&gpio1 12 0>,
120				<&gpio1 10 0>,
121				<&gpio0 30 0>;
122		};
123	};
124
125	aliases {
126		sw0 = &button0;
127		sw1 = &button1;
128		led0 = &red_led;
129		led1 = &green_led;
130		led2 = &blue_led;
131		pwm-led0 = &red_led_pwm;
132		pwm-led1 = &green_led_pwm;
133		pwm-led2 = &blue_led_pwm;
134		magn0 = &bmm150;
135		watchdog0 = &wdt0;
136		accel0 = &adxl362;
137		mcuboot-button0 = &button1;
138		mcuboot-led0 = &blue_led;
139	};
140};
141
142/* RGB LED control */
143&pwm0 {
144	status = "okay";
145	pinctrl-0 = <&pwm0_default>;
146	pinctrl-1 = <&pwm0_sleep>;
147	pinctrl-names = "default", "sleep";
148};
149
150/* Buzzer control */
151&pwm1 {
152	status = "okay";
153	pinctrl-0 = <&pwm1_default>;
154	pinctrl-1 = <&pwm1_sleep>;
155	pinctrl-names = "default", "sleep";
156};
157
158&adc {
159	#address-cells = <1>;
160	#size-cells = <0>;
161	status = "okay";
162
163	channel@2 {
164		reg = <2>;
165		zephyr,gain = "ADC_GAIN_1";
166		zephyr,reference = "ADC_REF_INTERNAL";
167		zephyr,vref-mv = <600>;
168		zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
169		zephyr,resolution = <12>;
170		zephyr,input-positive = <NRF_SAADC_AIN2>;
171	};
172};
173
174&gpiote {
175	status = "okay";
176};
177
178&gpio0 {
179	status = "okay";
180};
181
182&gpio1 {
183	status = "okay";
184};
185
186&i2c1 {
187	compatible = "nordic,nrf-twim";
188	status = "okay";
189	clock-frequency = <I2C_BITRATE_FAST>;
190
191	pinctrl-0 = <&i2c1_default>;
192	pinctrl-1 = <&i2c1_sleep>;
193	pinctrl-names = "default", "sleep";
194	bmm150: bmm150@10 {
195		compatible = "bosch,bmm150";
196		reg = <0x10>;
197	};
198
199	bh1749: bh1749@38 {
200		compatible = "rohm,bh1749";
201		reg = <0x38>;
202		int-gpios = <&gpio1 5 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
203	};
204
205	bme688: bme688@76 {
206		compatible = "bosch,bme680";
207		reg = <0x76>;
208	};
209};
210
211&spi3 {
212	compatible = "nordic,nrf-spim";
213	status = "okay";
214	cs-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>,
215		   <&gpio1 4  GPIO_ACTIVE_LOW>,
216		   <&gpio0 24 GPIO_ACTIVE_LOW>;
217
218	pinctrl-0 = <&spi3_default>;
219	pinctrl-1 = <&spi3_sleep>;
220	pinctrl-names = "default", "sleep";
221	adxl362: spi-dev-adxl362@0 {
222		compatible = "adi,adxl362";
223		spi-max-frequency = <8000000>;
224		reg = <0>;
225		int1-gpios = <&gpio0 19 0>;
226	};
227
228	bmi270: spi-dev-bmi270@1 {
229		compatible = "bosch,bmi270";
230		status = "disabled";
231		spi-max-frequency = <8000000>;
232		reg = <1>;
233	};
234
235	nrf_radio_fem_spi: fem_spi@2 {
236		compatible = "nordic,nrf21540-fem-spi";
237		status = "disabled";
238		reg = <2>;
239		spi-max-frequency = <8000000>;
240	};
241};
242
243/* UART0 GPIOs can be configured for other use-cases */
244&uart0 {
245	/* Disabled by default */
246	current-speed = <115200>;
247	status = "disabled";
248	pinctrl-0 = <&uart0_default>;
249	pinctrl-1 = <&uart0_sleep>;
250	pinctrl-names = "default", "sleep";
251};
252
253&qspi {
254	status = "okay";
255	pinctrl-0 = <&qspi_default>;
256	pinctrl-1 = <&qspi_sleep>;
257	pinctrl-names = "default", "sleep";
258	mx25r64: mx25r6435f@0 {
259		compatible = "nordic,qspi-nor";
260		reg = <0>;
261		/* MX25R64 supports only pp and pp4io */
262		/* Thingy:53 supports only pp and pp2o options */
263		writeoc = "pp";
264		/* MX25R64 supports all readoc options */
265		/* Thingy:53 supports only fastread and read2io options */
266		readoc = "read2io";
267		sck-frequency = <8000000>;
268		jedec-id = [c2 28 17];
269		sfdp-bfp = [
270			e5 20 f1 ff  ff ff ff 03  44 eb 08 6b  08 3b 04 bb
271			ee ff ff ff  ff ff 00 ff  ff ff 00 ff  0c 20 0f 52
272			10 d8 00 ff  23 72 f5 00  82 ed 04 cc  44 83 68 44
273			30 b0 30 b0  f7 c4 d5 5c  00 be 29 ff  f0 d0 ff ff
274		];
275		size = <67108864>;
276		has-dpd;
277		t-enter-dpd = <10000>;
278		t-exit-dpd = <35000>;
279	};
280};
281
282edge_connector_spi: &spi4 {
283	compatible = "nordic,nrf-spim";
284	status = "okay";
285	cs-gpios = <&edge_connector 18 GPIO_ACTIVE_LOW>;
286	pinctrl-0 = <&spi4_default>;
287	pinctrl-1 = <&spi4_sleep>;
288	pinctrl-names = "default", "sleep";
289};
290
291&flash0 {
292	partitions {
293		compatible = "fixed-partitions";
294		#address-cells = <1>;
295		#size-cells = <1>;
296
297		boot_partition: partition@0 {
298			label = "mcuboot";
299			reg = <0x00000000 0x00010000>;
300		};
301		slot0_partition: partition@10000 {
302			label = "image-0";
303		};
304		slot0_ns_partition: partition@50000 {
305			label = "image-0-nonsecure";
306		};
307		slot1_partition: partition@80000 {
308			label = "image-1";
309		};
310		slot1_ns_partition: partition@c0000 {
311			label = "image-1-nonsecure";
312		};
313		scratch_partition: partition@f0000 {
314			label = "image-scratch";
315			reg = <0x000f0000 0xa000>;
316		};
317		storage_partition: partition@fa000 {
318			label = "storage";
319			reg = <0x000fa000 0x00006000>;
320		};
321	};
322};
323
324&ieee802154 {
325	status = "okay";
326};
327
328zephyr_udc0: &usbd {
329	compatible = "nordic,nrf-usbd";
330	status = "okay";
331
332	cdc_acm_uart: cdc_acm_uart {
333		compatible = "zephyr,cdc-acm-uart";
334	};
335};
336
337/ {
338
339	reserved-memory {
340		#address-cells = <1>;
341		#size-cells = <1>;
342		ranges;
343
344		sram0_image: image@20000000 {
345			/* Zephyr image(s) memory */
346		};
347
348		sram0_s: image_s@20000000 {
349			/* Secure image memory */
350		};
351
352		sram0_ns: image_ns@20040000 {
353			/* Non-Secure image memory */
354		};
355	};
356};
357
358/* Include partition configuration file */
359#include "thingy53_nrf5340_partition_conf.dtsi"
360