1/*
2 * Copyright (c) 2021 Linaro Limited
3 * Copyright (c) 2024 STMicroelectronics
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#include <st/u5/stm32u575Xi.dtsi>
9#include <st/u5/stm32u575zitxq-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	leds: leds {
15		compatible = "gpio-leds";
16		green_led_1: led_1 {
17			gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>;
18			label = "User LD1";
19		};
20		blue_led_1: led_2 {
21			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
22			label = "User LD2";
23		};
24		red_led_1: led_3 {
25			gpios = <&gpiog 2 GPIO_ACTIVE_HIGH>;
26			label = "User LD3";
27		};
28	};
29
30	gpio_keys {
31		compatible = "gpio-keys";
32		user_button: button {
33			label = "User";
34			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
35			zephyr,code = <INPUT_KEY_0>;
36		};
37	};
38
39	pwmleds: pwmleds {
40		compatible = "pwm-leds";
41		status = "disabled";
42
43		pwm_led_1: green_led_1 {
44			pwms = <&pwm3 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
45			label = "green led";
46		};
47
48		pwm_led_2: blue_led_1 {
49			pwms = <&pwm4 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
50			label = "blue led";
51		};
52	};
53};
54
55&clk_hsi48 {
56	status = "okay";
57};
58
59&clk_lse {
60	status = "okay";
61};
62
63&clk_msis {
64	status = "okay";
65	msi-range = <4>;
66	msi-pll-mode;
67};
68
69&pll1 {
70	div-m = <1>;
71	mul-n = <80>;
72	div-q = <2>;
73	div-r = <2>;
74	clocks = <&clk_msis>;
75	status = "okay";
76};
77
78&rcc {
79	clocks = <&pll1>;
80	clock-frequency = <DT_FREQ_M(160)>;
81	ahb-prescaler = <1>;
82	apb1-prescaler = <1>;
83	apb2-prescaler = <1>;
84	apb3-prescaler = <1>;
85};
86
87&lpuart1 {
88	pinctrl-0 = <&lpuart1_tx_pg7 &lpuart1_rx_pg8>;
89	pinctrl-names = "default";
90	current-speed = <115200>;
91	status = "okay";
92};
93
94&usart2 {
95	pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6>;
96	pinctrl-names = "default";
97	current-speed = <115200>;
98	status = "okay";
99};
100
101&i2c1 {
102	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
103	pinctrl-names = "default";
104	status = "okay";
105	clock-frequency = <I2C_BITRATE_FAST>;
106};
107
108&i2c2 {
109	pinctrl-0 = <&i2c2_scl_pf1 &i2c2_sda_pf0>;
110	pinctrl-names = "default";
111	status = "okay";
112	clock-frequency = <I2C_BITRATE_FAST>;
113};
114
115&spi1 {
116	pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5
117		     &spi1_miso_pa6 &spi1_mosi_pa7>;
118	pinctrl-names = "default";
119	status = "okay";
120};
121
122&dac1 {
123	/* CAUTION: DAC on PA4 may conflict with SPI1 NSS on same pin */
124	pinctrl-0 = <&dac1_out1_pa4>;
125	pinctrl-names = "default";
126	status = "okay";
127};
128
129&adc1 {
130	pinctrl-0 = <&adc1_in1_pc0>;
131	pinctrl-names = "default";
132	st,adc-clock-source = "ASYNC";
133	st,adc-prescaler = <4>;
134	status = "okay";
135};
136
137&adc4 {
138	pinctrl-0 = <&adc4_in18_pb0>;
139	pinctrl-names = "default";
140	st,adc-clock-source = "ASYNC";
141	st,adc-prescaler = <4>;
142	status = "okay";
143};
144
145&timers3 {
146	st,prescaler = <10000>;
147	status = "okay";
148
149	pwm3: pwm {
150	pinctrl-0 = <&tim3_ch2_pc7>;
151		pinctrl-names = "default";
152		status = "okay";
153	};
154};
155
156&timers4 {
157	st,prescaler = <10000>;
158	status = "okay";
159
160	pwm4: pwm {
161		pinctrl-0 = <&tim4_ch2_pb7>;
162		pinctrl-names = "default";
163		status = "okay";
164	};
165};
166
167&iwdg {
168	status = "okay";
169};
170
171&rng {
172	status = "okay";
173};
174
175zephyr_udc0: &usbotg_fs {
176	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;
177	pinctrl-names = "default";
178	status = "okay";
179};
180
181&fdcan1 {
182	clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>,
183		 <&rcc STM32_SRC_PLL1_Q FDCAN1_SEL(1)>;
184	pinctrl-0 = <&fdcan1_rx_pd0 &fdcan1_tx_pd1>;
185	pinctrl-names = "default";
186	status = "okay";
187};
188
189&rtc {
190	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>,
191		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
192	status = "okay";
193};
194
195&vref1 {
196	status = "okay";
197};
198
199&vbat4 {
200	status = "okay";
201};
202
203&clk_lsi {
204	status = "okay";
205};
206
207stm32_lp_tick_source: &lptim1 {
208	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000800>,
209		 <&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
210	status = "okay";
211};
212