From d97a77147927b8ea6b245ec88a52de92db33813b Mon Sep 17 00:00:00 2001 From: pennae Date: Tue, 16 May 2023 17:13:09 +0200 Subject: [PATCH] rp/clocks: remove unsupported xosc config input the datasheet says that the xosc may be run by feeding a square wave into the XIN pin of the chip, but requires that the oscillator be set to pass through XIN in that case. it does not mention how, the xosc peripheral does not seem to have any config bits that could be set to this effect, and pico-sdk seems to have no (or at least no special) handling for this configuration at all. it can thus be assumed to either be not supported even by the reference sdk or to not need different handling. --- embassy-rp/src/clocks.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/embassy-rp/src/clocks.rs b/embassy-rp/src/clocks.rs index 63f70cec..dc850598 100644 --- a/embassy-rp/src/clocks.rs +++ b/embassy-rp/src/clocks.rs @@ -34,7 +34,6 @@ impl ClockConfig { }), xosc: Some(XoscConfig { hz: crystal_hz, - clock_type: ExternalClock::Crystal, sys_pll: Some(PllConfig { refdiv: 1, fbdiv: 125, @@ -119,7 +118,6 @@ pub struct RoscConfig { pub struct XoscConfig { pub hz: u32, - pub clock_type: ExternalClock, pub sys_pll: Option, pub usb_pll: Option, } @@ -131,10 +129,6 @@ pub struct PllConfig { pub post_div2: u8, } -pub enum ExternalClock { - Crystal, - Clock, -} pub struct RefClkConfig { pub src: RefClkSrc, pub div: u8, @@ -223,12 +217,9 @@ pub(crate) unsafe fn init(config: ClockConfig) { }); // start XOSC - match config.clock_type { - ExternalClock::Crystal => start_xosc(config.hz), - // TODO The datasheet says the xosc needs to be put into a bypass mode to use an - // external clock, but is mum about how to do that. - ExternalClock::Clock => todo!(), - } + // datasheet mentions support for clock inputs into XIN, but doesn't go into + // how this is achieved. pico-sdk doesn't support this at all. + start_xosc(config.hz); if let Some(sys_pll_config) = config.sys_pll { configure_pll(pac::PLL_SYS, config.hz, sys_pll_config);