1/*
2 * Copyright (c) 2017 Shawn Nock <shawn@monadnock.ca>
3 * Copyright (c) 2017 Linaro Limited
4 * Copyright (c) 2018 Aapo Vienamo
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9/dts-v1/;
10#include <nordic/nrf52832_qfaa.dtsi>
11#include "thingy52_nrf52832-pinctrl.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "Nordic Thingy52 NRF52832";
16	compatible = "nordic,thingy52-nrf52832";
17
18	chosen {
19		zephyr,console = &uart0;
20		zephyr,shell-uart = &uart0;
21		zephyr,bt-mon-uart = &uart0;
22		zephyr,bt-c2h-uart = &uart0;
23		zephyr,sram = &sram0;
24		zephyr,flash = &flash0;
25		zephyr,code-partition = &slot0_partition;
26	};
27
28	/* These aliases are provided for compatibility with samples */
29	aliases {
30		led0 = &led0;
31		led1 = &led1;
32		led2 = &led2;
33		sw0 = &button0;
34		watchdog0 = &wdt0;
35		accel0 = &lis2dh12;
36	};
37
38	leds {
39		compatible = "gpio-leds";
40		/* Lightwell RGB */
41		led0: led_0 {
42			gpios = <&sx1509b 7 GPIO_ACTIVE_LOW>;
43			label = "Red LED";
44			//vin-supply = <&vdd_pwr>;
45		};
46		led1: led_1 {
47			gpios = <&sx1509b 5 GPIO_ACTIVE_LOW>;
48			label = "Green LED";
49			//vin-supply = <&vdd_pwr>;
50		};
51		led2: led_2 {
52			gpios = <&sx1509b 6 GPIO_ACTIVE_LOW>;
53			label = "Blue LED";
54			//vin-supply = <&vdd_pwr>;
55		};
56	};
57
58	buttons {
59		compatible = "gpio-keys";
60		button0: button_0 {
61			/* gpio flags need validation */
62			gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
63			label = "Button";
64			zephyr,code = <INPUT_KEY_0>;
65		};
66	};
67
68	vbatt {
69		compatible = "voltage-divider";
70		io-channels = <&adc 4>;
71		output-ohms = <180000>;
72		full-ohms = <(1500000 + 180000)>;
73		power-gpios = <&sx1509b 4 0>;
74	};
75
76	vdd_pwr: vdd-pwr-ctrl {
77		compatible = "regulator-fixed";
78		regulator-name = "vdd-pwr-ctrl";
79		enable-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
80		regulator-boot-on;
81		startup-delay-us = <1000>;
82	};
83
84	spk_pwr: spk-pwr-ctrl {
85		compatible = "regulator-fixed";
86		regulator-name = "spk-pwr-ctrl";
87		enable-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
88	};
89
90	mpu_pwr: mpu-pwr-ctrl {
91		compatible = "regulator-fixed";
92		regulator-name = "mpu-pwr-ctrl";
93		enable-gpios = <&sx1509b 8 GPIO_ACTIVE_HIGH>;
94		status = "disabled";
95	};
96
97	mic_pwr: mic-pwr-ctrl {
98		compatible = "regulator-fixed";
99		regulator-name = "mic-pwr-ctrl";
100		enable-gpios = <&sx1509b 9 GPIO_ACTIVE_HIGH>;
101		status = "disabled";
102	};
103
104	ccs_pwr: ccs-pwr-ctrl {
105		compatible = "regulator-fixed";
106		regulator-name = "ccs-pwr-ctrl";
107		enable-gpios = <&sx1509b 10 GPIO_ACTIVE_HIGH>;
108		status = "disabled";
109	};
110};
111
112&adc {
113	status = "okay";
114};
115
116&gpiote {
117	status = "okay";
118};
119
120&gpio0 {
121	status = "okay";
122};
123
124&uart0 {
125	compatible = "nordic,nrf-uarte";
126	status = "okay";
127	current-speed = <115200>;
128	pinctrl-0 = <&uart0_default>;
129	pinctrl-1 = <&uart0_sleep>;
130	pinctrl-names = "default", "sleep";
131};
132
133&i2c0 {
134	compatible = "nordic,nrf-twim";
135	status = "okay";
136	clock-frequency = <I2C_BITRATE_FAST>;
137
138	pinctrl-0 = <&i2c0_default>;
139	pinctrl-1 = <&i2c0_sleep>;
140	pinctrl-names = "default", "sleep";
141	sx1509b: sx1509b@3e {
142		compatible = "semtech,sx1509b";
143		reg = <0x3e>;
144		vin-supply = <&vdd_pwr>;
145		gpio-controller;
146		#gpio-cells = <2>;
147		ngpios = <16>;
148		/* Active-low LEDs init high, all else init low */
149		init-out-high = <0xe0e0>;
150		init-out-low = <0x1f1f>;
151	};
152
153	lps22hb_press: lps22hb_press@5c {
154		compatible = "st,lps22hb-press";
155		reg = <0x5c>;
156		vin-supply = <&vdd_pwr>;
157	};
158
159	hts221: hts221@5f {
160		compatible = "st,hts221";
161		reg = <0x5f>;
162		vin-supply = <&vdd_pwr>;
163		drdy-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
164	};
165
166	ccs811: ccs811@5a {
167		compatible = "ams,ccs811";
168		reg = <0x5a>;
169		vin-supply = <&ccs_pwr>;
170		irq-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
171		reset-gpios = <&sx1509b 11 GPIO_ACTIVE_LOW>;
172		wake-gpios = <&sx1509b 12 GPIO_ACTIVE_LOW>;
173	};
174};
175
176&i2c1 {
177	compatible = "nordic,nrf-twim";
178	status = "okay";
179	clock-frequency = <I2C_BITRATE_FAST>;
180
181	pinctrl-0 = <&i2c1_default>;
182	pinctrl-1 = <&i2c1_sleep>;
183	pinctrl-names = "default", "sleep";
184	lis2dh12: lis2dh12@19 {
185		compatible = "st,lis2dh12", "st,lis2dh";
186		reg = <0x19>;
187		irq-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
188	};
189};
190
191&flash0 {
192	partitions {
193		compatible = "fixed-partitions";
194		#address-cells = <1>;
195		#size-cells = <1>;
196
197		boot_partition: partition@0 {
198			label = "mcuboot";
199			reg = <0x00000000 0xc000>;
200		};
201		slot0_partition: partition@c000 {
202			label = "image-0";
203			reg = <0x0000C000 0x32000>;
204		};
205		slot1_partition: partition@3e000 {
206			label = "image-1";
207			reg = <0x0003E000 0x32000>;
208		};
209		scratch_partition: partition@70000 {
210			label = "image-scratch";
211			reg = <0x00070000 0xa000>;
212		};
213
214		/*
215		 * The flash starting at 0x0007a000 and ending at
216		 * 0x0007ffff (sectors 122-127) is reserved for use
217		 * by the application.
218		 * Storage partition will be used by FCB/LittleFS/NVS
219		 * if enabled.
220		 */
221		storage_partition: partition@7a000 {
222			label = "storage";
223			reg = <0x0007a000 0x00006000>;
224		};
225	};
226};
227