1/*
2 * Copyright (c) 2022 Seco Spa
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f3/stm32f302Xc.dtsi>
9#include <st/f3/stm32f302v(b-c)tx-pinctrl.dtsi>
10
11/ {
12	model = "SECO JUNO SBC-D23 board (STM32F302VCT6)";
13	compatible = "seco,stm32f3-d23";
14
15	chosen {
16		zephyr,console = &usart1;
17		zephyr,code-partition = &slot0_partition;
18		zephyr,shell-uart = &usart1;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,canbus = &can1;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		led_1: led_1 {
27			gpios = <&gpiod 8 GPIO_ACTIVE_HIGH>;
28			label = "LED-1";
29		};
30		led_2: led_2 {
31			gpios = <&gpiod 9 GPIO_ACTIVE_HIGH>;
32			label = "LED-2";
33		};
34	};
35
36	out_3p3v_pwr: 3p3v-out-pwr-ctrl {
37		compatible = "regulator-fixed";
38		regulator-name = "3p3v-out-pwr-ctrl";
39		enable-gpios = <&gpioe 7 GPIO_ACTIVE_HIGH>;
40		regulator-always-on;
41		regulator-boot-on;
42		status = "okay";
43	};
44
45	out_gpio_bufa_pwr: out-gpio-bufa-pwr-ctrl {
46		compatible = "regulator-fixed";
47		regulator-name = "out-gpio-bufa-pwr-ctrl";
48		enable-gpios = <&gpiof 2 GPIO_ACTIVE_LOW>;
49		regulator-boot-on;
50		status = "okay";
51	};
52
53	out_gpio_bufb_pwr: out-gpio-bufb-pwr-ctrl {
54		compatible = "regulator-fixed";
55		regulator-name = "out-gpio-bufb-pwr-ctrl";
56		enable-gpios = <&gpiof 4 GPIO_ACTIVE_LOW>;
57		regulator-boot-on;
58		status = "okay";
59	};
60
61	in_gpio_buf_pwr: in-gpio-buf-pwr-ctrl {
62		compatible = "regulator-fixed";
63		regulator-name = "in-gpio-buf-pwr-ctrl";
64		enable-gpios = <&gpiof 6 GPIO_ACTIVE_LOW>;
65		regulator-boot-on;
66		status = "okay";
67	};
68
69	transceiver0: can-phy0 {
70		compatible = "nxp,tja1040", "can-transceiver-gpio";
71		standby-gpios = <&gpiod 0 GPIO_ACTIVE_HIGH>;
72		max-bitrate = <1000000>;
73		#phy-cells = <0>;
74	};
75
76	aliases {
77		led0 = &led_1;
78		led1 = &led_2;
79	};
80};
81
82&clk_lsi {
83	status = "okay";
84};
85
86&clk_hse {
87	clock-frequency = <DT_FREQ_M(8)>;
88	status = "okay";
89};
90
91&pll {
92	prediv = <1>;
93	mul = <9>;
94	clocks = <&clk_hse>;
95	status = "okay";
96};
97
98&rcc {
99	clocks = <&pll>;
100	clock-frequency = <DT_FREQ_M(72)>;
101	ahb-prescaler = <1>;
102	apb1-prescaler = <2>;
103	apb2-prescaler = <1>;
104	status = "okay";
105};
106
107/* Debug Serial */
108&usart1 {
109	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
110	pinctrl-names = "default";
111	current-speed = <115200>;
112	status = "okay";
113};
114
115/* Modbus */
116&usart2 {
117	pinctrl-0 = <&usart2_tx_pd5 &usart2_rx_pd6
118		     &usart2_cts_pd3 &usart2_rts_pd4>;
119	pinctrl-names = "default";
120	current-speed = <115200>;
121};
122
123/* RS-485 */
124&usart3 {
125	pinctrl-0 = <&usart3_tx_pc10 &usart3_rx_pc11
126		     &usart3_rts_pd12>;
127	pinctrl-names = "default";
128	current-speed = <115200>;
129};
130
131&uart5 {
132	pinctrl-0 = <&uart5_tx_pc12 &uart5_rx_pd2>;
133	pinctrl-names = "default";
134	current-speed = <115200>;
135};
136
137&i2c1 {
138	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
139	pinctrl-names = "default";
140	clock-frequency = <I2C_BITRATE_FAST>;
141	status = "okay";
142};
143
144&i2c2 {
145	/* alternate config usart1 */
146	pinctrl-0 = <&i2c2_scl_pa9 &i2c2_sda_pa10>;
147	pinctrl-names = "default";
148	clock-frequency = <I2C_BITRATE_FAST>;
149};
150
151&spi1 {
152	pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pb3
153		     &spi1_miso_pb4 &spi1_mosi_pb5>;
154	pinctrl-names = "default";
155	status = "okay";
156};
157
158&spi2 {
159	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
160		     &spi2_miso_pb14 &spi2_mosi_pb15>;
161	pinctrl-names = "default";
162	status = "okay";
163};
164
165zephyr_udc0: &usb {
166	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
167	pinctrl-names = "default";
168	status = "okay";
169};
170
171&rtc {
172	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
173		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
174	status = "okay";
175};
176
177&can1 {
178	pinctrl-0 = <&can_rx_pb8 &can_tx_pb9>;
179	pinctrl-names = "default";
180	bus-speed = <125000>;
181	phys = <&transceiver0>;
182	status = "okay";
183};
184
185&flash0 {
186	partitions {
187		compatible = "fixed-partitions";
188		#address-cells = <1>;
189		#size-cells = <1>;
190		boot_partition: partition@0 {
191			label = "mcuboot";
192			reg = <0x00000000 0x00010000>;
193			read-only;
194		};
195		/*
196		 * The flash starting at 0x00010000 and ending at
197		 * 0x0001ffff (sectors 16-31) is reserved for use
198		 * by the application.
199		 */
200		slot0_partition: partition@20000 {
201			label = "image-0";
202			reg = <0x00020000 0x00008000>;
203		};
204		slot1_partition: partition@28000 {
205			label = "image-1";
206			reg = <0x00028000 0x00008000>;
207		};
208		storage_partition: partition@30000 {
209			label = "storage";
210			reg = <0x00030000 0x00002000>;
211		};
212		scratch_partition: partition@32000 {
213			label = "image-scratch";
214			reg = <0x00032000 0x00008000>;
215		};
216	};
217};
218
219&iwdg {
220	status = "okay";
221};
222
223&timers1 {
224	st,prescaler = <10000>;
225	status = "okay";
226	pwm1: pwm {
227		pinctrl-0 = <&tim1_ch1_pe9 &tim1_ch2n_pe10 &tim1_ch2_pe11
228			     &tim1_ch3n_pe12 &tim1_ch3_pe13 &tim1_ch4_pe14>;
229		pinctrl-names = "default";
230		status = "okay";
231	};
232};
233
234&timers4 {
235	st,prescaler = <10000>;
236	status = "okay";
237	pwm4: pwm {
238		pinctrl-0 = <&tim4_ch2_pd13 &tim4_ch3_pd14 &tim4_ch4_pd15>;
239		pinctrl-names = "default";
240		status = "okay";
241	};
242};
243