stm32f4: power: update rcc_clock_scale enum

- Change .power_save to .voltage_scale, a pwr_vos_scale enum
- Enable pwr clock before setting VOS scale
- Fix flash wait states
- Make flash_set_ws more robust
This commit is contained in:
Jordi Pakey-Rodriguez
2018-07-07 00:20:58 -07:00
committed by Karl Palsson
parent e076c3cadd
commit cc8c8a2f83
6 changed files with 52 additions and 36 deletions

View File

@@ -38,9 +38,8 @@
void pwr_set_vos_scale(enum pwr_vos_scale scale)
{
if (scale == PWR_SCALE1) {
PWR_CR |= PWR_CR_VOS;
} else if (scale == PWR_SCALE2) {
PWR_CR &= PWR_CR_VOS;
}
uint32_t reg32;
reg32 = PWR_CR & ~(PWR_CR_VOS_MASK << PWR_CR_VOS_SHIFT);
reg32 |= (scale & PWR_CR_VOS_MASK) << PWR_CR_VOS_SHIFT;
PWR_CR = reg32;
}