firmware: Fix Kasli v2 runtime rtio_clock selection

SI5324_EXT_REF now only controls the (deprecated) fallbacks
for when the rtio_clock option is not set.
This commit is contained in:
David Nadlinger 2022-12-04 02:23:38 +00:00
parent b2b559e73b
commit 740543d4e2
2 changed files with 7 additions and 4 deletions

View File

@ -214,8 +214,11 @@ pub fn bypass(input: Input) -> Result<()> {
Ok(())
}
pub fn setup(settings: &FrequencySettings, input: Input) -> Result<()> {
pub fn setup(settings: &FrequencySettings, ext_input: Input) -> Result<()> {
let s = map_frequency_settings(settings)?;
// FREE_RUN=1 routes XA/XB to CKIN2.
let input = if settings.crystal_ref { Input::Ckin2 } else { ext_input };
let cksel_reg = match input {
Input::Ckin1 => 0b00,
Input::Ckin2 => 0b01,

View File

@ -212,9 +212,8 @@ fn setup_si5324_as_synthesizer(cfg: RtioClock) {
}
}
};
#[cfg(all(soc_platform = "kasli", hw_rev = "v2.0", not(si5324_ext_ref)))]
let si5324_ref_input = si5324::Input::Ckin2;
#[cfg(all(soc_platform = "kasli", hw_rev = "v2.0", si5324_ext_ref))]
#[cfg(all(soc_platform = "kasli", hw_rev = "v2.0"))]
let si5324_ref_input = si5324::Input::Ckin1;
#[cfg(all(soc_platform = "kasli", not(hw_rev = "v2.0")))]
let si5324_ref_input = si5324::Input::Ckin2;
@ -222,6 +221,7 @@ fn setup_si5324_as_synthesizer(cfg: RtioClock) {
let si5324_ref_input = si5324::Input::Ckin2;
#[cfg(soc_platform = "kc705")]
let si5324_ref_input = si5324::Input::Ckin2;
si5324::setup(&si5324_settings, si5324_ref_input).expect("cannot initialize Si5324");
}