1/*
2 * Copyright (c) 2023 STMicroelectronics
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/h5/stm32h573Xi.dtsi>
9#include <st/h5/stm32h573iikxq-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12#include <zephyr/dt-bindings/memory-attr/memory-attr.h>
13#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
14/ {
15	model = "STMicroelectronics STM32H573I DISCOVERY KIT board";
16	compatible = "st,stm32h573i-dk";
17
18	chosen {
19		zephyr,console = &usart1;
20		zephyr,shell-uart = &usart1;
21		zephyr,sram = &sram1;
22		zephyr,flash = &flash0;
23		zephyr,code-partition = &slot0_partition;
24		zephyr,canbus = &fdcan1;
25	};
26
27	leds {
28		compatible = "gpio-leds";
29		green_led_0: led_1 {
30			gpios = <&gpioi 9 GPIO_ACTIVE_LOW>;
31			label = "User LD1";
32		};
33		orange_led_0: led_2 {
34			gpios = <&gpioi 8 GPIO_ACTIVE_LOW>;
35			label = "User LD2";
36		};
37		red_led_0: led_3 {
38			gpios = <&gpiof 1 GPIO_ACTIVE_LOW>;
39			label = "User LD3";
40		};
41		blue_led_0: led_4 {
42			gpios = <&gpiof 4 GPIO_ACTIVE_LOW>;
43			label = "User LD4";
44		};
45	};
46
47	gpio_keys {
48		compatible = "gpio-keys";
49		user_button: button {
50			label = "User";
51			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
52			zephyr,code = <INPUT_KEY_0>;
53		};
54	};
55
56	aliases {
57		led0 = &blue_led_0;
58		sw0 = &user_button;
59		watchdog0 = &iwdg;
60		die-temp0 = &die_temp;
61		volt-sensor0 = &vref;
62		volt-sensor1 = &vbat;
63	};
64
65	ext_memory: memory@90000000 {
66		compatible = "zephyr,memory-region";
67		reg = <0x90000000 DT_SIZE_M(64)>;
68		zephyr,memory-region = "EXTMEM";
69		/* The ATTR_MPU_EXTMEM attribut causing a MPU FAULT */
70		zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO) )>;
71	};
72};
73
74&clk_hsi48 {
75	status = "okay";
76};
77
78&clk_lse {
79	status = "okay";
80};
81
82&clk_hse {
83	clock-frequency = <DT_FREQ_M(25)>;
84	hse-bypass; /* X3 is a 25MHz oscillator on PH0 */
85	status = "okay";
86};
87
88&pll {
89	div-m = <5>;
90	mul-n = <96>;
91	div-p = <2>;
92	div-q = <6>;
93	div-r = <2>;
94	clocks = <&clk_hse>;
95	status = "okay";
96};
97
98&rcc {
99	clocks = <&pll>;
100	clock-frequency = <DT_FREQ_M(240)>;
101	ahb-prescaler = <1>;
102	apb1-prescaler = <2>;
103	apb2-prescaler = <1>;
104	apb3-prescaler = <1>;
105};
106
107&i2c1 {
108	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
109	pinctrl-names = "default";
110	clock-frequency = <I2C_BITRATE_FAST>;
111	status = "okay";
112};
113
114&i2c2 {
115	pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
116	pinctrl-names = "default";
117	clock-frequency = <I2C_BITRATE_FAST>;
118	status = "okay";
119};
120
121&usart1 {
122	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
123	pinctrl-names = "default";
124	current-speed = <115200>;
125	status = "okay";
126};
127
128&timers2 {
129	st,prescaler = <10000>;
130	status = "okay";
131
132	pwm2: pwm {
133		status = "okay";
134		pinctrl-0 = <&tim2_ch4_pa3>;
135		pinctrl-names = "default";
136	};
137};
138
139&timers3 {
140	st,prescaler = <10000>;
141	status = "okay";
142
143	pwm3: pwm {
144		status = "okay";
145		pinctrl-0 = <&tim3_ch2_pb5>;
146		pinctrl-names = "default";
147	};
148};
149
150&aes {
151	status = "okay";
152};
153
154&rng {
155	status = "okay";
156};
157
158&mac {
159	status = "okay";
160	pinctrl-0 = <&eth_rxd0_pc4
161		     &eth_rxd1_pc5
162		     &eth_ref_clk_pa1
163		     &eth_crs_dv_pa7
164		     &eth_tx_en_pg11
165		     &eth_txd0_pg13
166		     &eth_txd1_pg12>;
167	pinctrl-names = "default";
168};
169
170&mdio {
171	status = "okay";
172	pinctrl-0 = <&eth_mdio_pa2 &eth_mdc_pc1>;
173	pinctrl-names = "default";
174
175	ethernet-phy@0 {
176		compatible = "ethernet-phy";
177		reg = <0x00>;
178		status = "okay";
179	};
180};
181
182&flash0 {
183	partitions {
184		compatible = "fixed-partitions";
185		#address-cells = <1>;
186		#size-cells = <1>;
187
188		/* Set the partitions with first MB to make use of the whole Bank1 */
189		boot_partition: partition@0 {
190			label = "mcuboot";
191			reg = <0x00000000 DT_SIZE_K(64)>;
192		};
193		slot0_partition: partition@10000 {
194			label = "image-0";
195			reg = <0x00010000 DT_SIZE_K(416)>;
196		};
197		slot1_partition: partition@78000 {
198			label = "image-1";
199			reg = <0x00078000 DT_SIZE_K(416)>;
200		};
201		scratch_partition: partition@e0000 {
202			label = "image-scratch";
203			reg = <0x000e0000 DT_SIZE_K(64)>;
204		};
205		/* Set 64KB of storage at the end of Bank1 */
206		storage_partition: partition@f0000 {
207			label = "storage";
208			reg = <0x000f0000 DT_SIZE_K(64)>;
209		};
210	};
211};
212
213&rtc {
214	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>,
215		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
216	status = "okay";
217};
218
219&iwdg {
220	status = "okay";
221};
222
223&gpdma1 {
224	status = "okay";
225};
226
227&gpdma2 {
228	status = "okay";
229};
230
231&dac1 {
232	/* only 2 output channels : out1 on pa4 or out2 on pa5 */
233	pinctrl-0 = <&dac1_out1_pa4>;  /* Arduino A1 */
234	pinctrl-names = "default";
235	status = "okay";
236};
237
238&adc1 {
239	pinctrl-0 = <&adc1_inp6_pf12>; /* Arduino A5 */
240	pinctrl-names = "default";
241	st,adc-clock-source = <ASYNC>;
242	st,adc-prescaler = <6>;
243	status = "okay";
244};
245
246&spi2 {
247	pinctrl-0 = <&spi2_nss_pa3 &spi2_sck_pi1
248		     &spi2_miso_pi2 &spi2_mosi_pb15>;
249	pinctrl-names = "default";
250	status = "okay";
251};
252
253&fdcan1 {
254	clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>,
255		<&rcc STM32_SRC_PLL1_Q FDCAN_SEL(1)>;
256	pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
257	pinctrl-names = "default";
258	status = "okay";
259};
260
261&xspi1 {
262	pinctrl-0 = <&octospi1_io0_pb1 &octospi1_io1_pd12
263		     &octospi1_io2_pc2 &octospi1_io3_pd13
264		     &octospi1_io4_ph2 &octospi1_io5_ph3
265		     &octospi1_io6_pg9 &octospi1_io7_pc0
266		     &octospi1_clk_pf10 &octospi1_ncs_pg6
267		     &octospi1_dqs_pb2>;
268	pinctrl-names = "default";
269
270	status = "okay";
271
272	mx25lm51245: ospi-nor-flash@90000000 {
273		compatible = "st,stm32-xspi-nor";
274		reg = <0x90000000 DT_SIZE_M(64)>; /* 512 Mbits */
275		ospi-max-frequency = <DT_FREQ_M(50)>;
276		spi-bus-width = <XSPI_OCTO_MODE>;
277		data-rate = <XSPI_DTR_TRANSFER>;
278		four-byte-opcodes;
279		status = "okay";
280
281		partitions {
282			   compatible = "fixed-partitions";
283			   #address-cells = <1>;
284			   #size-cells = <1>;
285
286			   partition@0 {
287			       label = "nor";
288			       reg = <0x00000000 DT_SIZE_M(64)>;
289			   };
290		};
291	};
292};
293
294&sdmmc1 {
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 = <&gpioh 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
300	status = "okay";
301};
302
303
304zephyr_udc0: &usb {
305	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
306	pinctrl-names = "default";
307	status = "okay";
308};
309
310&die_temp {
311	status = "okay";
312};
313
314&vref {
315	status = "okay";
316};
317
318&vbat {
319	status = "okay";
320};
321