stm32/rcc: enable power supply configurability for rm0455 and rm0468

This commit is contained in:
Badr Bouslikhin 2023-12-02 14:45:36 +01:00
parent c97f65ac60
commit 87c0f1525d
No known key found for this signature in database

View File

@ -119,7 +119,7 @@ impl From<TimerPrescaler> for Timpre {
/// Power supply configuration /// Power supply configuration
/// See RM0433 Rev 4 7.4 /// See RM0433 Rev 4 7.4
#[cfg(pwr_h7rm0399)] #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
pub enum SupplyConfig { pub enum SupplyConfig {
/// Default power supply configuration. /// Default power supply configuration.
/// V CORE Power Domains are supplied from the LDO according to VOS. /// V CORE Power Domains are supplied from the LDO according to VOS.
@ -162,7 +162,7 @@ pub enum SupplyConfig {
/// SMPS step-down converter voltage output level. /// SMPS step-down converter voltage output level.
/// This is only used in certain power supply configurations: /// This is only used in certain power supply configurations:
/// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass. /// SMPSLDO, SMPSExternalLDO, SMPSExternalLDOBypass.
#[cfg(pwr_h7rm0399)] #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
pub enum SMPSSupplyVoltage { pub enum SMPSSupplyVoltage {
V1_8, V1_8,
V2_5, V2_5,
@ -196,7 +196,7 @@ pub struct Config {
pub voltage_scale: VoltageScale, pub voltage_scale: VoltageScale,
pub ls: super::LsConfig, pub ls: super::LsConfig,
#[cfg(pwr_h7rm0399)] #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
pub supply_config: SupplyConfig, pub supply_config: SupplyConfig,
pub smps_supply_voltage: Option<SMPSSupplyVoltage>, pub smps_supply_voltage: Option<SMPSSupplyVoltage>,
} }
@ -233,7 +233,7 @@ impl Default for Config {
voltage_scale: VoltageScale::Scale0, voltage_scale: VoltageScale::Scale0,
ls: Default::default(), ls: Default::default(),
#[cfg(pwr_h7rm0399)] #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
supply_config: SupplyConfig::Default, supply_config: SupplyConfig::Default,
smps_supply_voltage: None, smps_supply_voltage: None,
} }
@ -253,15 +253,7 @@ pub(crate) unsafe fn init(config: Config) {
w.set_bypass(false); w.set_bypass(false);
}); });
#[cfg(any(pwr_h7rm0455, pwr_h7rm0468))] #[cfg(any(pwr_h7rm0399, pwr_h7rm0455, pwr_h7rm0468))]
PWR.cr3().modify(|w| {
// hardcode "Direct SPMS" for now, this is what works on nucleos with the
// default solderbridge configuration.
w.set_sden(true);
w.set_ldoen(false);
});
#[cfg(pwr_h7rm0399)]
{ {
match config.supply_config { match config.supply_config {
SupplyConfig::Default => { SupplyConfig::Default => {