From 865150f666a2627e98a54b7d4f06205b19dc7113 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 16 Jun 2016 13:36:50 -0600 Subject: [PATCH] STM32: Logic to reset backup domain only applies if the RTC is enabled. --- arch/arm/src/stm32/stm32_rcc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/arm/src/stm32/stm32_rcc.c b/arch/arm/src/stm32/stm32_rcc.c index 5196dafa51..80e87fb37a 100644 --- a/arch/arm/src/stm32/stm32_rcc.c +++ b/arch/arm/src/stm32/stm32_rcc.c @@ -67,10 +67,6 @@ #define HSERDY_TIMEOUT (100 * CONFIG_BOARD_LOOPSPERMSEC) -/**************************************************************************** - * Private Data - ****************************************************************************/ - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -106,7 +102,7 @@ ****************************************************************************/ /************************************************************************************ - * Name: rcc_enablebkp + * Name: rcc_resetbkp * * Description: * The RTC needs to reset the Backup Domain to change RTCSEL and resetting the @@ -122,8 +118,8 @@ * ************************************************************************************/ -#if defined(CONFIG_STM32_PWR) && !defined(CONFIG_STM32_STM32F10XX) -static inline rcc_enablebkp(void) +#if defined(CONFIG_RTC) && defined(CONFIG_STM32_PWR) && !defined(CONFIG_STM32_STM32F10XX) +static inline rcc_resetbkp(void) { uint32_t regval; @@ -145,7 +141,7 @@ static inline rcc_enablebkp(void) } } #else -# define rcc_enablebkp() +# define rcc_resetbkp() #endif /**************************************************************************** @@ -181,9 +177,9 @@ void stm32_clockconfig(void) rcc_reset(); - /* Reset backup domain */ + /* Reset backup domain if appropriate */ - rcc_enablebkp(); + rcc_resetbkp(); #if defined(CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG)