1/*
2 * Copyright (c) 2024 STMicroelectronics
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8 #include <st/u5/stm32u585Xi.dtsi>
9 #include <st/u5/stm32u585aiixq-pinctrl.dtsi>
10 #include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics STEVAL-STWINBX1 Development kit";
14	compatible = "st,steval_stwinbx1";
15
16	chosen {
17		zephyr,sram = &sram0;
18		zephyr,flash = &flash0;
19		zephyr,code-partition = &slot0_partition;
20
21		zephyr,bt-hci = &hci_spi;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		green_led: led_1 {
27			gpios = <&gpioh 12 GPIO_ACTIVE_HIGH>;
28			label = "LED_1";
29		};
30		orange_led: led_2 {
31			gpios = <&gpioh 10 GPIO_ACTIVE_HIGH>;
32			label = "LED_2";
33		};
34	};
35
36	pwmleds {
37		compatible = "pwm-leds";
38
39		green_pwm_led: green_pwm_led {
40			pwms = <&pwm5 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
41			label = "LED_1 - PWM5";
42		};
43	};
44
45	gpio_keys {
46		compatible = "gpio-keys";
47		user_button: button {
48			label = "User";
49			gpios = <&gpioe 0 GPIO_ACTIVE_HIGH>;
50			zephyr,code = <INPUT_KEY_0>;
51		};
52	};
53
54	aliases {
55		led0 = &green_led;
56		led1 = &orange_led;
57		pwm-led0 = &green_pwm_led;
58		sw0 = &user_button;
59		mcuboot-led0 = &green_led;
60		mcuboot-button0 = &user_button;
61		watchdog0 = &iwdg;
62		die-temp0 = &die_temp;
63		volt-sensor0 = &vref1;
64		volt-sensor1 = &vbat4;
65	};
66};
67
68&clk_hsi48 {
69	status = "okay";
70};
71
72&clk_hse {
73	clock-frequency = <DT_FREQ_M(16)>;
74	status = "okay";
75};
76
77&clk_lse {
78	status = "okay";
79};
80
81&clk_msis {
82	status = "okay";
83	msi-range = <4>;
84	msi-pll-mode;
85};
86
87&pll1 {
88	div-m = <1>;
89	mul-n = <10>;
90	div-q = <2>;
91	div-r = <1>;
92	clocks = <&clk_hse>;
93	status = "okay";
94};
95
96&pll2 {
97	div-m = <2>;
98	mul-n = <48>;
99	div-p = <2>;
100	div-q = <7>;
101	div-r = <25>;
102	clocks = <&clk_hse>;
103	status = "okay";
104};
105
106&pll3 {
107	div-m = <2>;
108	mul-n = <48>;
109	div-p = <2>;
110	div-q = <25>;
111	div-r = <2>;
112	clocks = <&clk_hse>;
113	status = "okay";
114};
115
116&rcc {
117	clocks = <&pll1>;
118	clock-frequency = <DT_FREQ_M(160)>;
119	ahb-prescaler = <1>;
120	apb1-prescaler = <1>;
121	apb2-prescaler = <1>;
122	apb3-prescaler = <1>;
123};
124
125&gpioe {
126	status = "okay";
127
128	/* Enable 2.7V Analog LDO */
129	ldo-enable-gpios {
130		gpio-hog;
131		gpios = <15 GPIO_ACTIVE_HIGH>;
132		output-high;
133	};
134};
135
136stm32_lp_tick_source: &lptim1 {
137	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000800>,
138		<&rcc STM32_SRC_LSE LPTIM1_SEL(3)>;
139	status = "okay";
140};
141
142&usart2 {
143	pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;
144	pinctrl-names = "default";
145	current-speed = <115200>;
146	status = "okay";
147};
148
149&spi2 {
150	pinctrl-0 = <&spi2_sck_pi1 &spi2_miso_pd3 &spi2_mosi_pi3>;
151	pinctrl-names = "default";
152	status = "okay";
153
154	cs-gpios = <&gpioh 6 GPIO_ACTIVE_LOW>,
155		   <&gpioh 15 GPIO_ACTIVE_LOW>,
156		   <&gpioi 7 GPIO_ACTIVE_LOW>;
157	iis2dlpc: iis2dlpc@0 {
158		compatible = "st,iis2dlpc";
159		spi-max-frequency = <DT_FREQ_M(10)>;
160		reg = <0>;
161		drdy-gpios = <&gpiof 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
162		drdy-int =  <1>;
163	};
164
165	ism330dhcx: ism330dhcx@1 {
166		compatible = "st,ism330dhcx";
167		spi-max-frequency = <DT_FREQ_M(10)>;
168		reg = <1>;
169		drdy-gpios =  <&gpiob 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
170		int-pin = <1>;
171	};
172
173	iis2iclx: iis2iclx@2 {
174		compatible = "st,iis2iclx";
175		spi-max-frequency = <DT_FREQ_M(10)>;
176		reg = <2>;
177		drdy-gpios = <&gpiof 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
178		int-pin =  <2>;
179	};
180};
181
182&spi3 {
183	pinctrl-0 = <&spi3_sck_pg9 &spi3_miso_pb4 &spi3_mosi_pb5>;
184	pinctrl-names = "default";
185	status = "okay";
186	cs-gpios = <&gpioe 1 GPIO_ACTIVE_LOW>;
187	hci_spi: bluenrg-2@0 {
188		compatible = "st,hci-spi-v2";
189		reg = <0>;
190		reset-gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
191		irq-gpios = <&gpiof 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
192		spi-cpha; /* CPHA=1 */
193		spi-hold-cs;
194		spi-max-frequency = <DT_FREQ_M(1)>;
195		reset-assert-duration-ms = <6>;
196	};
197};
198
199&i2c2 {
200	pinctrl-0 = <&i2c2_scl_ph4 &i2c2_sda_pf0>;
201	pinctrl-names = "default";
202	status = "okay";
203	clock-frequency = <I2C_BITRATE_FAST>;
204
205	stts22h@3f {
206		compatible = "st,stts22h";
207		reg = <0x3f>;
208		int-gpios = <&gpiof 5 GPIO_ACTIVE_HIGH>;
209		status = "okay";
210	};
211
212	iis2mdc@1e {
213		compatible = "st,iis2mdc";
214		reg = <0x1e>;
215		drdy-gpios = <&gpiof 9 GPIO_ACTIVE_HIGH>;
216		status = "okay";
217	};
218
219	ilps22qs@5c {
220		compatible = "st,ilps22qs";
221		reg = <0x5c>;
222		status = "okay";
223	};
224};
225
226&timers5 {
227	st,prescaler = <10000>;
228	status = "okay";
229
230	pwm5: pwm {
231		status = "okay";
232		pinctrl-0 = <&tim5_ch3_ph12>;
233		pinctrl-names = "default";
234	};
235};
236
237
238&aes {
239	status = "okay";
240};
241
242&rng {
243	status = "okay";
244};
245
246zephyr_udc0: &usbotg_fs {
247	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
248	pinctrl-names = "default";
249	status = "okay";
250};
251
252#include <../boards/common/usb/cdc_acm_serial.dtsi>
253
254&adc1 {
255	pinctrl-0 = <&adc1_in1_pc0>;
256	pinctrl-names = "default";
257	st,adc-clock-source = "ASYNC";
258	st,adc-prescaler = <4>;
259	vref-mv = <2750>;
260	status = "okay";
261};
262
263&adc4 {
264	pinctrl-0 = <&adc4_in3_pc2>;
265	pinctrl-names = "default";
266	st,adc-clock-source = "ASYNC";
267	st,adc-prescaler = <4>;
268	vref-mv = <2750>;
269	status = "okay";
270};
271
272&die_temp {
273	status = "okay";
274};
275
276&iwdg {
277	status = "okay";
278};
279
280&vref1 {
281	status = "okay";
282};
283
284&vbat4 {
285	status = "okay";
286};
287
288&sdmmc1 {
289	status = "okay";
290	pinctrl-0 = <&sdmmc1_d0_pc8 &sdmmc1_d1_pc9
291		&sdmmc1_d2_pc10 &sdmmc1_d3_pc11
292		&sdmmc1_ck_pc12 &sdmmc1_cmd_pd2>;
293	pinctrl-names = "default";
294	cd-gpios = <&gpiog 1 GPIO_ACTIVE_LOW>;
295	bus-width = <4>;
296	clk-div = <4>;
297};
298
299&flash0 {
300	partitions {
301		compatible = "fixed-partitions";
302		#address-cells = <1>;
303		#size-cells = <1>;
304
305		/*
306		 * Following flash partition is dedicated to the use of steval_stwinbx1
307		 * with TZEN=0 (so w/o TFM).
308		 * Set the partitions with first MB to make use of the whole Bank1
309		 */
310		boot_partition: partition@0 {
311			label = "mcuboot";
312			reg = <0x00000000 DT_SIZE_K(64)>;
313		};
314		slot0_partition: partition@10000 {
315			label = "image-0";
316			reg = <0x00010000 DT_SIZE_K(416)>;
317		};
318		slot1_partition: partition@78000 {
319			label = "image-1";
320			reg = <0x00078000 DT_SIZE_K(416)>;
321		};
322		scratch_partition: partition@e0000 {
323			label = "image-scratch";
324			reg = <0x000e0000 DT_SIZE_K(64)>;
325		};
326		storage_partition: partition@f0000 {
327			label = "storage";
328			reg = <0x000f0000 DT_SIZE_K(64)>;
329		};
330
331	};
332};
333
334&gpdma1 {
335	status = "okay";
336};
337