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