Skip to content

Commit 6c8ef27

Browse files
benjaminbjornssoncarlescufi
authored andcommitted
drivers: counter: stm32_rtc: enable backup domain only when supported
The STM32C0-series does not have a backup domain, this patch enables us to extend this driver to the C0-series. Signed-off-by: Benjamin Björnsson <[email protected]>
1 parent c8e1b1e commit 6c8ef27

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/counter/counter_ll_stm32_rtc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,9 @@ static int rtc_stm32_init(const struct device *dev)
402402

403403
/* Enable Backup access */
404404
z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
405+
#if defined(PWR_CR_DBP) || defined(PWR_CR1_DBP) || defined(PWR_DBPR_DBP)
405406
LL_PWR_EnableBkUpAccess();
407+
#endif /* PWR_CR_DBP || PWR_CR1_DBP || PWR_DBPR_DBP */
406408

407409
/* Enable RTC clock source */
408410
if (clock_control_configure(clk,

0 commit comments

Comments
 (0)