1/*
2 * Copyright (c) 2022 Blues Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l4/stm32l4r5Xi.dtsi>
9#include <st/l4/stm32l4r5z(g-i)yx-pinctrl.dtsi>
10#include "feather_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "Blues Wireless Swan board";
15	compatible = "blues,swan-r5";
16
17	chosen {
18		zephyr,console = &lpuart1;
19		zephyr,shell-uart = &lpuart1;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		led0: led_0 {
27			gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
28			label = "User LD1";
29		};
30	};
31
32	gpio_keys {
33		compatible = "gpio-keys";
34		user_button: button {
35			label = "User";
36			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
37			zephyr,code = <INPUT_KEY_0>;
38		};
39	};
40
41
42	zephyr,user {
43		dischrg-gpios = <&gpioe 6 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
44	};
45
46	supply-3v3 {
47		compatible = "regulator-fixed";
48		regulator-name = "supply-3v3";
49		enable-gpios = <&gpioe 4 GPIO_ACTIVE_HIGH>;
50		regulator-boot-on;
51	};
52
53	aliases {
54		led0 = &led0;
55		sw0 = &user_button;
56		volt-sensor0 = &vref;
57		volt-sensor1 = &vbat;
58	};
59};
60
61&clk_lsi {
62	status = "okay";
63};
64
65&clk_hsi48 {
66	status = "okay";
67};
68
69&clk_hsi {
70	status = "okay";
71};
72
73&pll {
74	div-m = <4>;
75	mul-n = <40>;
76	div-p = <7>;
77	div-q = <2>;
78	div-r = <2>;
79	clocks = <&clk_hsi>;
80	status = "okay";
81};
82
83&rcc {
84	clocks = <&pll>;
85	clock-frequency = <DT_FREQ_M(80)>;
86	ahb-prescaler = <1>;
87	apb1-prescaler = <1>;
88	apb2-prescaler = <1>;
89};
90
91&usart1 {
92	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
93	pinctrl-names = "default";
94	current-speed = <115200>;
95	status = "okay";
96};
97
98&usart2 {
99	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pd6>;
100	pinctrl-names = "default";
101	current-speed = <115200>;
102	status = "okay";
103};
104
105&usart3 {
106	pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>;
107	pinctrl-names = "default";
108	current-speed = <115200>;
109	status = "okay";
110};
111
112&lpuart1 {
113	pinctrl-0 = <&lpuart1_tx_pg7 &lpuart1_rx_pg8>;
114	pinctrl-names = "default";
115	current-speed = <115200>;
116	status = "okay";
117};
118
119&i2c1 {
120	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
121	pinctrl-names = "default";
122	status = "okay";
123};
124
125&i2c2 {
126	pinctrl-0 = <&i2c2_scl_pf1 &i2c2_sda_pf0>;
127	pinctrl-names = "default";
128	status = "okay";
129};
130
131&i2c3 {
132	pinctrl-0 = <&i2c3_scl_pc0 &i2c3_sda_pc9>;
133	pinctrl-names = "default";
134	status = "okay";
135};
136
137&spi1 {
138	pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
139	pinctrl-names = "default";
140	cs-gpios = <&gpioa 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
141	status = "okay";
142};
143
144&spi2 {
145	pinctrl-0 = <&spi2_nss_pd0 &spi2_sck_pd1
146		     &spi2_miso_pb14 &spi2_mosi_pb15>;
147	pinctrl-names = "default";
148	status = "okay";
149};
150
151&spi3 {
152	pinctrl-0 = <&spi3_nss_pa15 &spi3_sck_pc10
153		     &spi3_miso_pc11 &spi3_mosi_pc12>;
154	pinctrl-names = "default";
155	status = "okay";
156};
157
158zephyr_udc0: &usbotg_fs {
159	pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12
160		     &usb_otg_fs_id_pa10>;
161	pinctrl-names = "default";
162	status = "okay";
163};
164
165&timers2 {
166	status = "okay";
167
168	pwm2: pwm {
169		status = "okay";
170		pinctrl-0 = <&tim2_ch1_pa0>;
171		pinctrl-names = "default";
172	};
173};
174
175&rtc {
176	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
177		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
178	status = "okay";
179};
180
181&flash0 {
182	partitions {
183		compatible = "fixed-partitions";
184		#address-cells = <1>;
185		#size-cells = <1>;
186
187		/* Reserve last 16KiB for property storage */
188		storage_partition: partition@1FB000 {
189			label = "storage";
190			reg = <0x001FB000 0x00004000>;
191		};
192	};
193};
194
195&adc1 {
196	pinctrl-0 = <&adc1_in6_pa1>;
197	pinctrl-names = "default";
198	st,adc-clock-source = <SYNC>;
199	st,adc-prescaler = <4>;
200	status = "okay";
201};
202
203&vref {
204	status = "okay";
205};
206
207&vbat {
208	status = "okay";
209};
210