Skip to content

Commit a92a451

Browse files
soc: arm: st_stm32: stm32l1: Add RTC/Counter support
Add RTC/Counter support for STM32L1 SoCs. Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
1 parent 72220c5 commit a92a451

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

drivers/counter/counter_ll_stm32_rtc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ LOG_MODULE_REGISTER(counter_rtc_stm32, CONFIG_COUNTER_LOG_LEVEL);
3030
|| defined(CONFIG_SOC_SERIES_STM32F3X) \
3131
|| defined(CONFIG_SOC_SERIES_STM32F7X) \
3232
|| defined(CONFIG_SOC_SERIES_STM32WBX) \
33-
|| defined(CONFIG_SOC_SERIES_STM32G4X)
33+
|| defined(CONFIG_SOC_SERIES_STM32G4X) \
34+
|| defined(CONFIG_SOC_SERIES_STM32L1X)
3435
#define RTC_EXTI_LINE LL_EXTI_LINE_17
3536
#endif
3637

dts/arm/st/l1/stm32l1.dtsi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828
};
2929

3030
soc {
31+
rtc: rtc@40002800 {
32+
compatible = "st,stm32-rtc";
33+
reg = <0x40002800 0x400>;
34+
interrupts = <41 0>;
35+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>;
36+
prescaler = <32768>;
37+
status = "disabled";
38+
label = "RTC_0";
39+
};
40+
3141
usart2: serial@40004400 {
3242
compatible = "st,stm32-usart", "st,stm32-uart";
3343
reg = <0x40004400 0x400>;

soc/arm/st_stm32/stm32l1/dts_fixup.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,10 @@
130130
#define DT_WWDT_0_CLOCK_BITS DT_INST_0_ST_STM32_WINDOW_WATCHDOG_CLOCK_BITS
131131
#define DT_WWDT_0_CLOCK_BUS DT_INST_0_ST_STM32_WINDOW_WATCHDOG_CLOCK_BUS
132132

133+
#define DT_RTC_0_BASE_ADDRESS DT_ST_STM32_RTC_40002800_BASE_ADDRESS
134+
#define DT_RTC_0_IRQ_PRI DT_ST_STM32_RTC_40002800_IRQ_0_PRIORITY
135+
#define DT_RTC_0_IRQ DT_ST_STM32_RTC_40002800_IRQ_0
136+
#define DT_RTC_0_NAME DT_ST_STM32_RTC_40002800_LABEL
137+
#define DT_RTC_0_CLOCK_BITS DT_ST_STM32_RTC_40002800_CLOCK_BITS
138+
#define DT_RTC_0_CLOCK_BUS DT_ST_STM32_RTC_40002800_CLOCK_BUS
133139
/* End of SoC Level DTS fixup file */

soc/arm/st_stm32/stm32l1/soc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@
5151
#include <stm32l1xx_ll_i2c.h>
5252
#endif
5353

54+
#if defined(CONFIG_COUNTER_RTC_STM32)
55+
#include <stm32l1xx_ll_rtc.h>
56+
#include <stm32l1xx_ll_exti.h>
57+
#include <stm32l1xx_ll_pwr.h>
58+
#endif
59+
5460
#ifdef CONFIG_SPI_STM32
5561
#include <stm32l1xx_ll_spi.h>
5662
#endif

0 commit comments

Comments
 (0)