A consequence of Max's change to the logic to enable access to the backup domain is that every call to enabledbkp(true) must be followed by a matching call to enablebkp(false). There was one cse in both RTCC drivers where that may not always be true.

This commit is contained in:
Gregory Nutt 2016-08-09 11:33:47 -06:00
parent 5d91b8cabb
commit 8b5833f7fe
3 changed files with 16 additions and 12 deletions

View File

@ -83,6 +83,10 @@ static inline void stm32_pwr_modifyreg(uint8_t offset, uint16_t clearbits, uint1
* Enables access to the backup domain (RTC registers, RTC backup data registers
* and backup SRAM).
*
* NOTE: Reference counting is used in order to supported nested calles to this
* function. As a consequence, every call to stm32_pwr_enablebkp(true) must
* be followed by a call to stm32_pwr_enablebkp(false).
*
* Input Parameters:
* writable - True: enable ability to write to backup domain registers
*

View File

@ -729,6 +729,12 @@ int up_rtc_initialize(void)
/* Remember that the RTC is initialized */
putreg32(RTC_MAGIC, RTC_MAGIC_REG);
/* Disable write access to the backup domain (RTC registers, RTC
* backup data registers and backup SRAM).
*/
stm32_pwr_enablebkp(false);
}
else
{
@ -740,12 +746,6 @@ int up_rtc_initialize(void)
rtc_dumpregs("Did resume");
}
/* Disable write access to the backup domain (RTC registers, RTC backup
* data registers and backup SRAM).
*/
stm32_pwr_enablebkp(false);
if (ret != OK && nretry > 0)
{
rtcinfo("setup/resume ran %d times and failed with %d\n",

View File

@ -1028,6 +1028,12 @@ int up_rtc_initialize(void)
/* Remember that the RTC is initialized */
putreg32(RTC_MAGIC, RTC_MAGIC_REG);
/* Disable write access to the backup domain (RTC registers, RTC
* backup data registers and backup SRAM).
*/
stm32_pwr_enablebkp(false);
}
else
{
@ -1039,12 +1045,6 @@ int up_rtc_initialize(void)
rtc_dumpregs("Did resume");
}
/* Disable write access to the backup domain (RTC registers, RTC backup
* data registers and backup SRAM).
*/
stm32_pwr_enablebkp(false);
if (ret != OK && nretry > 0)
{
rtcinfo("setup/resume ran %d times and failed with %d\n",