1/*
2 * Copyright (c) 2021 Linaro Limited
3 * Copyright (c) 2023 Thomas Stranger
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#include <st/h5/stm32h563Xi.dtsi>
9#include <st/h5/stm32h563zitx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include "st_morpho_connector.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	leds: leds {
16		compatible = "gpio-leds";
17		green_led_1: led_1 {
18			gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>;
19			label = "User LD1";
20		};
21		yellow_led_1: led_2 {
22			gpios = <&gpiof 4 GPIO_ACTIVE_HIGH>;
23			label = "User LD2";
24		};
25		red_led_1: led_3 {
26			gpios = <&gpiog 4 GPIO_ACTIVE_HIGH>;
27			label = "User LD3";
28		};
29	};
30
31	gpio_keys {
32		compatible = "gpio-keys";
33		user_button: button {
34			label = "User";
35			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
36			zephyr,code = <INPUT_KEY_0>;
37		};
38	};
39
40	pwmleds: pwmleds {
41		compatible = "pwm-leds";
42		status = "disabled";
43
44		pwm_led_1: green_led_1 {
45			pwms = <&pwm3 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
46			label = "green led";
47		};
48	};
49};
50
51&clk_hse {
52	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
53	hse-bypass;
54	status = "okay";
55};
56
57&clk_hsi48 {
58	status = "okay";
59};
60
61&clk_lse {
62	status = "okay";
63};
64
65&pll {
66	div-m = <2>;
67	mul-n = <120>;
68	div-p = <2>;
69	div-q = <2>;
70	div-r = <2>;
71	clocks = <&clk_hse>;
72	status = "okay";
73};
74
75&rcc {
76	clocks = <&pll>;
77	clock-frequency = <DT_FREQ_M(240)>;
78	ahb-prescaler = <1>;
79	apb1-prescaler = <1>;
80	apb2-prescaler = <1>;
81	apb3-prescaler = <1>;
82};
83
84&lpuart1 {
85	pinctrl-0 = <&lpuart1_tx_pb6 &lpuart1_rx_pb7>;
86	pinctrl-names = "default";
87	current-speed = <115200>;
88	status = "okay";
89};
90
91&usart3 {
92	pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>;
93	pinctrl-names = "default";
94	current-speed = <115200>;
95	status = "okay";
96};
97
98&spi1 {
99	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pg9 &spi1_mosi_pb5>;
100	pinctrl-names = "default";
101	cs-gpios = <&gpiod 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
102	status = "okay";
103};
104
105&timers3 {
106	st,prescaler = <10000>;
107	status = "okay";
108
109	pwm3: pwm {
110		status = "okay";
111		pinctrl-0 = <&tim3_ch3_pb0>;
112		pinctrl-names = "default";
113	};
114};
115
116&rtc {
117	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>,
118		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
119	status = "okay";
120};
121
122&iwdg {
123	status = "okay";
124};
125
126&gpdma1 {
127	status = "okay";
128};
129
130&gpdma2 {
131	status = "okay";
132};
133
134&dac1 {
135	/* outputs only on 2 pins and pa4 is reserved for VBUS_SENSE */
136	pinctrl-0 = <&dac1_out2_pa5>;  /* Zio D13 (on CN7) */
137	pinctrl-names = "default";
138	status = "okay";
139};
140
141&adc1 {
142	pinctrl-0 = <&adc1_inp3_pa6 &adc1_inp15_pa3>; /* Zio A0, Zio D35 */
143	pinctrl-names = "default";
144	st,adc-clock-source = <ASYNC>;
145	st,adc-prescaler = <6>;
146	status = "okay";
147};
148
149&flash0 {
150	partitions {
151		compatible = "fixed-partitions";
152		#address-cells = <1>;
153		#size-cells = <1>;
154
155		boot_partition: partition@0 {
156			label = "mcuboot";
157			reg = <0x00000000 DT_SIZE_K(64)>;
158		};
159		slot0_partition: partition@10000 {
160			label = "image-0";
161			reg = <0x00010000 DT_SIZE_K(960)>;
162		};
163		slot1_partition: partition@100000 {
164			label = "image-1";
165			reg = <0x00100000 DT_SIZE_K(960)>;
166		};
167		storage_partition: partition@1f0000 {
168			label = "storage";
169			reg = <0x001f0000 DT_SIZE_K(64)>;
170		};
171	};
172};
173
174zephyr_udc0: &usb {
175	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
176	pinctrl-names = "default";
177	status = "okay";
178};
179
180&vref {
181	status = "okay";
182};
183
184&vbat {
185	status = "okay";
186};
187