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