From 9214e0f3e25dc8f0036970213acf90ee0cc56fb5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 2 Oct 2020 20:35:29 +0800 Subject: [PATCH] firmware: fix Si5324 CKIN selection on Kasli 2.0 https://github.com/sinara-hw/Kasli/issues/82#issuecomment-702129805 --- artiq/firmware/runtime/rtio_clocking.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/artiq/firmware/runtime/rtio_clocking.rs b/artiq/firmware/runtime/rtio_clocking.rs index 0a41ab8d0..63a595358 100644 --- a/artiq/firmware/runtime/rtio_clocking.rs +++ b/artiq/firmware/runtime/rtio_clocking.rs @@ -145,15 +145,25 @@ fn setup_si5324_as_synthesizer() { bwsel : 3, crystal_ref: true }; - si5324::setup(&SI5324_SETTINGS, si5324::Input::Ckin2).expect("cannot initialize Si5324"); + #[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))] + let si5324_ref_input = si5324::Input::Ckin1; + #[cfg(all(soc_platform = "kasli", not(hw_rev = "v2.0")))] + let si5324_ref_input = si5324::Input::Ckin2; + si5324::setup(&SI5324_SETTINGS, si5324_ref_input).expect("cannot initialize Si5324"); } pub fn init() { #[cfg(si5324_as_synthesizer)] { + #[cfg(all(soc_platform = "kasli", hw_rev = "v2.0"))] + let si5324_ext_input = si5324::Input::Ckin1; + #[cfg(all(soc_platform = "kasli", not(hw_rev = "v2.0")))] + let si5324_ext_input = si5324::Input::Ckin2; match get_rtio_clock_cfg() { RtioClock::Internal => setup_si5324_as_synthesizer(), - RtioClock::External => si5324::bypass(si5324::Input::Ckin2).expect("cannot bypass Si5324") + RtioClock::External => si5324::bypass(si5324_ext_input).expect("cannot bypass Si5324") } }