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		green_led_1: led_1 {
16			gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>;
17			label = "User LD1";
18		};
19		blue_led_1: led_2 {
20			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
21			label = "User LD2";
22		};
23		red_led_1: led_3 {
24			gpios = <&gpiog 2 GPIO_ACTIVE_HIGH>;
25			label = "User LD3";
26		};
27	};
28
29	gpio_keys {
30		compatible = "gpio-keys";
31		user_button: button {
32			label = "User";
33			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
34			zephyr,code = <INPUT_KEY_0>;
35		};
36	};
37
38	pwmleds: pwmleds {
39		compatible = "pwm-leds";
40		status = "disabled";
41
42		pwm_led_1: green_led_1 {
43			pwms = <&pwm3 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
44			label = "green led";
45		};
46
47		pwm_led_2: blue_led_1 {
48			pwms = <&pwm4 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
49			label = "blue led";
50		};
51	};
52};
53
54&clk_hsi48 {
55	status = "okay";
56};
57
58/* This board has a 16MHz crystal attached */
59&clk_hse {
60	clock-frequency = <DT_FREQ_M(16)>;
61	status = "okay";
62};
63
64&clk_lse {
65	status = "okay";
66};
67
68&pll1 {
69	/* HSE 16MHz source, outputting 160MHz to sysclk and apbclk */
70	div-m = <4>; /* input divisor */
71	mul-n = <80>; /* VCO multiplication factor */
72	div-q = <2>; /* system clock divisor */
73	div-r = <2>; /* peripheral clock divisor */
74	clocks = <&clk_hse>;
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_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
117	pinctrl-names = "default";
118	cs-gpios = <&gpiod 14 GPIO_ACTIVE_LOW>;
119	status = "okay";
120};
121
122&dac1 {
123	pinctrl-0 = <&dac1_out1_pa4>;
124	pinctrl-names = "default";
125	status = "okay";
126};
127
128&adc1 {
129	pinctrl-0 = <&adc1_in1_pc0>;
130	pinctrl-names = "default";
131	st,adc-clock-source = "ASYNC";
132	st,adc-prescaler = <4>;
133	status = "okay";
134};
135
136&adc4 {
137	pinctrl-0 = <&adc4_in18_pb0>;
138	pinctrl-names = "default";
139	st,adc-clock-source = "ASYNC";
140	st,adc-prescaler = <4>;
141	status = "okay";
142};
143
144&timers3 {
145	st,prescaler = <10000>;
146	status = "okay";
147
148	pwm3: pwm {
149	pinctrl-0 = <&tim3_ch2_pc7>;
150		pinctrl-names = "default";
151		status = "okay";
152	};
153};
154
155&timers4 {
156	st,prescaler = <10000>;
157	status = "okay";
158
159	pwm4: pwm {
160		pinctrl-0 = <&tim4_ch2_pb7>;
161		pinctrl-names = "default";
162		status = "okay";
163	};
164};
165
166&iwdg {
167	status = "okay";
168};
169
170&rng {
171	status = "okay";
172};
173
174&fdcan1 {
175	clocks = <&rcc STM32_CLOCK_BUS_APB1_2 0x00000200>,
176		 <&rcc STM32_SRC_PLL1_Q FDCAN1_SEL(1)>;
177	pinctrl-0 = <&fdcan1_rx_pd0 &fdcan1_tx_pd1>;
178	pinctrl-names = "default";
179	status = "okay";
180};
181
182&rtc {
183	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>,
184		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
185	status = "okay";
186};
187
188&vref1 {
189	status = "okay";
190};
191
192&vbat4 {
193	status = "okay";
194};
195