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
12/ {
13	model = "STMicroelectronics STM32H573I DISCOVERY KIT board";
14	compatible = "st,stm32h573i-dk";
15
16	chosen {
17		zephyr,console = &usart1;
18		zephyr,shell-uart = &usart1;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,code-partition = &slot0_partition;
22		zephyr,canbus = &can1;
23	};
24
25	leds {
26		compatible = "gpio-leds";
27		green_led_0: led_1 {
28			gpios = <&gpioi 9 GPIO_ACTIVE_LOW>;
29			label = "User LD1";
30		};
31		orange_led_0: led_2 {
32			gpios = <&gpioi 8 GPIO_ACTIVE_LOW>;
33			label = "User LD2";
34		};
35		red_led_0: led_3 {
36			gpios = <&gpiof 1 GPIO_ACTIVE_LOW>;
37			label = "User LD3";
38		};
39		blue_led_0: led_4 {
40			gpios = <&gpiof 4 GPIO_ACTIVE_LOW>;
41			label = "User LD4";
42		};
43	};
44
45	gpio_keys {
46		compatible = "gpio-keys";
47		user_button: button {
48			label = "User";
49			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
50		};
51	};
52
53	aliases {
54		led0 = &blue_led_0;
55		sw0 = &user_button;
56		watchdog0 = &iwdg;
57		spi-flash0 = &mx25lm51245;
58		die-temp0 = &die_temp;
59		volt-sensor0 = &vref;
60		volt-sensor1 = &vbat;
61	};
62};
63
64&clk_hsi48 {
65	status = "okay";
66};
67
68&clk_lse {
69	status = "okay";
70};
71
72&clk_hse {
73	clock-frequency = <DT_FREQ_M(25)>;
74	hse-bypass; /* X3 is a 25MHz oscillator on PH0 */
75	status = "okay";
76};
77
78&pll {
79	div-m = <5>;
80	mul-n = <96>;
81	div-p = <2>;
82	div-q = <2>;
83	div-r = <2>;
84	clocks = <&clk_hse>;
85	status = "okay";
86};
87
88&rcc {
89	clocks = <&pll>;
90	clock-frequency = <DT_FREQ_M(240)>;
91	ahb-prescaler = <1>;
92	apb1-prescaler = <1>;
93	apb2-prescaler = <1>;
94	apb3-prescaler = <1>;
95};
96
97&usart1 {
98	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
99	pinctrl-names = "default";
100	current-speed = <115200>;
101	status = "okay";
102};
103
104&timers2 {
105	st,prescaler = <10000>;
106	status = "okay";
107
108	pwm2: pwm {
109		status = "okay";
110		pinctrl-0 = <&tim2_ch4_pa3>;
111		pinctrl-names = "default";
112	};
113};
114
115&timers3 {
116	st,prescaler = <10000>;
117	status = "okay";
118
119	pwm3: pwm {
120		status = "okay";
121		pinctrl-0 = <&tim3_ch2_pb5>;
122		pinctrl-names = "default";
123	};
124};
125
126&aes {
127	status = "okay";
128};
129
130&rng {
131	status = "okay";
132};
133
134&flash0 {
135	partitions {
136		compatible = "fixed-partitions";
137		#address-cells = <1>;
138		#size-cells = <1>;
139
140		/* Set the partitions with first MB to make use of the whole Bank1 */
141		boot_partition: partition@0 {
142			label = "mcuboot";
143			reg = <0x00000000 DT_SIZE_K(64)>;
144		};
145		slot0_partition: partition@10000 {
146			label = "image-0";
147			reg = <0x00010000 DT_SIZE_K(416)>;
148		};
149		slot1_partition: partition@78000 {
150			label = "image-1";
151			reg = <0x00078000 DT_SIZE_K(416)>;
152		};
153		scratch_partition: partition@e0000 {
154			label = "image-scratch";
155			reg = <0x000e0000 DT_SIZE_K(64)>;
156		};
157		/* Set 64KB of storage at the end of Bank1 */
158		storage_partition: partition@f0000 {
159			label = "storage";
160			reg = <0x000f0000 DT_SIZE_K(64)>;
161		};
162	};
163};
164
165&rtc {
166	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>,
167		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
168	status = "okay";
169};
170
171&iwdg {
172	status = "okay";
173};
174
175&gpdma1 {
176	status = "okay";
177};
178
179&gpdma2 {
180	status = "okay";
181};
182
183&dac1 {
184	/* only 2 output channels : out1 on pa4 or out2 on pa5 */
185	pinctrl-0 = <&dac1_out1_pa4>;  /* Arduino A1 */
186	pinctrl-names = "default";
187	status = "okay";
188};
189
190&adc1 {
191	pinctrl-0 = <&adc1_inp6_pf12>; /* Arduino A5 */
192	pinctrl-names = "default";
193	status = "okay";
194};
195
196&spi2 {
197	pinctrl-0 = <&spi2_nss_pa3 &spi2_sck_pi1
198		     &spi2_miso_pi2 &spi2_mosi_pb15>;
199	pinctrl-names = "default";
200	status = "okay";
201};
202
203&can1 {
204	clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>,
205		<&rcc STM32_SRC_PLL1_Q FDCAN_SEL(1)>;
206	pinctrl-0 = <&fdcan1_rx_pa11 &fdcan1_tx_pa12>;
207	pinctrl-names = "default";
208	bus-speed = <125000>;
209	bus-speed-data = <1000000>;
210	status = "okay";
211};
212
213&octospi1 {
214	pinctrl-0 = <&octospi1_io0_pb1 &octospi1_io1_pd12
215		     &octospi1_io2_pc2 &octospi1_io3_pd13
216		     &octospi1_io4_ph2 &octospi1_io5_ph3
217		     &octospi1_io6_pg9 &octospi1_io7_pc0
218		     &octospi1_clk_pf10 &octospi1_ncs_pg6
219		     &octospi1_dqs_pb2>;
220	pinctrl-names = "default";
221
222	status = "okay";
223
224	mx25lm51245: ospi-nor-flash@0 {
225		compatible = "st,stm32-ospi-nor";
226		reg = <0>;
227		ospi-max-frequency = <DT_FREQ_M(50)>;
228		size = <DT_SIZE_M(512)>; /* 64 MBytes */
229		spi-bus-width = <OSPI_OPI_MODE>;
230		data-rate = <OSPI_DTR_TRANSFER>;
231		four-byte-opcodes;
232		status = "okay";
233
234		partitions {
235			   compatible = "fixed-partitions";
236			   #address-cells = <1>;
237			   #size-cells = <1>;
238
239			   partition@0 {
240			       label = "nor";
241			       reg = <0x00000000 DT_SIZE_M(64)>;
242			   };
243		};
244	};
245};
246
247&die_temp {
248	status = "okay";
249};
250
251&vref {
252	status = "okay";
253};
254
255&vbat {
256	status = "okay";
257};
258