1/*
2 * Copyright (c) 2024 Maxin John
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l1/stm32l152Xc.dtsi>
9#include <st/l1/stm32l152r(6-8-b)tx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics STM32L152CDISCOVERY board";
14	compatible = "st,stm32l1discovery";
15
16	chosen {
17		zephyr,console = &usart1;
18		zephyr,shell-uart = &usart1;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21	};
22
23	leds {
24		compatible = "gpio-leds";
25		green_led: ld3 {
26			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
27			label = "User LD3";
28		};
29		blue_led: ld4 {
30			gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
31			label = "User LD4";
32		};
33	};
34
35	gpio_keys {
36		compatible = "gpio-keys";
37		user_button: button {
38			label = "User";
39			gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
40			zephyr,code = <INPUT_KEY_0>;
41		};
42	};
43
44	aliases {
45		led0 = &green_led;
46		led1 = &blue_led;
47		sw0 = &user_button;
48	};
49};
50
51&clk_lsi {
52	status = "okay";
53};
54
55&clk_hsi {
56	status = "okay";
57};
58
59&pll {
60	div = <4>;
61	mul = <8>;
62	/* out of the box, MCO from stlink is not enabled, unlike later discos */
63	clocks = <&clk_hsi>;
64	status = "okay";
65};
66
67&rcc {
68	clocks = <&pll>;
69	clock-frequency = <DT_FREQ_M(32)>;
70	ahb-prescaler = <1>;
71	apb1-prescaler = <1>;
72	apb2-prescaler = <1>;
73};
74
75&usart1 {
76	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
77	pinctrl-names = "default";
78	current-speed = <115200>;
79	status = "okay";
80};
81
82&usart2 {
83	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
84	pinctrl-names = "default";
85	current-speed = <115200>;
86	status = "okay";
87};
88
89&usart3 {
90	pinctrl-0 = <&usart3_tx_pb10 &usart3_rx_pb11>;
91	pinctrl-names = "default";
92	current-speed = <115200>;
93	status = "okay";
94};
95
96&i2c1 {
97	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
98	pinctrl-names = "default";
99	status = "okay";
100	clock-frequency = <I2C_BITRATE_FAST>;
101};
102
103&i2c2 {
104	pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
105	pinctrl-names = "default";
106	status = "okay";
107	clock-frequency = <I2C_BITRATE_FAST>;
108};
109
110&spi1 {
111	pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5
112		     &spi1_miso_pa6 &spi1_mosi_pa7>;
113	pinctrl-names = "default";
114	status = "okay";
115};
116
117&spi2 {
118	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
119		     &spi2_miso_pb14 &spi2_mosi_pb15>;
120	pinctrl-names = "default";
121	status = "okay";
122};
123
124&rtc {
125	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
126		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
127	status = "okay";
128
129	backup_regs {
130		status = "okay";
131	};
132};
133