drivers: rtc: stm32: Updated scope of hsem

This commit updates the scope of  hsem.

Signed-off-by: Petr Hlineny <development@hlineny.cz>
This commit is contained in:
Petr Hlineny 2023-11-23 17:07:18 +01:00 committed by Carles Cufí
commit 0ed8f10d8a

View file

@ -139,7 +139,6 @@ static int rtc_stm32_init(const struct device *dev)
k_mutex_init(&data->lock); k_mutex_init(&data->lock);
/* Enable Backup access */ /* Enable Backup access */
z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
#if defined(PWR_CR_DBP) || defined(PWR_CR1_DBP) || defined(PWR_DBPCR_DBP) || defined(PWR_DBPR_DBP) #if defined(PWR_CR_DBP) || defined(PWR_CR1_DBP) || defined(PWR_DBPCR_DBP) || defined(PWR_DBPR_DBP)
LL_PWR_EnableBkUpAccess(); LL_PWR_EnableBkUpAccess();
#endif /* PWR_CR_DBP || PWR_CR1_DBP || PWR_DBPR_DBP */ #endif /* PWR_CR_DBP || PWR_CR1_DBP || PWR_DBPR_DBP */
@ -150,6 +149,8 @@ static int rtc_stm32_init(const struct device *dev)
return -EIO; return -EIO;
} }
z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
LL_RCC_EnableRTC(); LL_RCC_EnableRTC();
z_stm32_hsem_unlock(CFG_HW_RCC_SEMID); z_stm32_hsem_unlock(CFG_HW_RCC_SEMID);