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