acassis commented on code in PR #20365:
URL: https://github.com/apache/nuttx/pull/20365#discussion_r4104616173
##########
arch/arm/src/imxrt/imxrt_clockconfig_ver3.c:
##########
@@ -267,6 +260,49 @@ static void imxrt_init_arm_pll(void)
#endif /* CONFIG_ARCH_CHIP_MIMXRT1189CVM8C_CM33 */
+static void imxrt_enable_osc_24m(void)
+{
+ uint32_t reg;
+
+ /* Check if the 24 MHz crystal oscillator not enabled, is gated
+ * or is not stable
+ */
+
+ reg = getreg32(IMXRT_ANADIG_OSC_24M_CTRL);
+
+ if ((reg & (ANADIG_OSC_24M_CTRL_OSC_EN |
+ ANADIG_OSC_24M_CTRL_GATE |
+ ANADIG_OSC_24M_CTRL_STABLE)) !=
+ (ANADIG_OSC_24M_CTRL_OSC_EN |
+ ANADIG_OSC_24M_CTRL_STABLE))
+ {
+ /* It needs to be enabled */
+
+ reg |= ANADIG_OSC_24M_CTRL_OSC_EN;
+ putreg32(reg, IMXRT_ANADIG_OSC_24M_CTRL);
+
+ while ((getreg32(IMXRT_ANADIG_OSC_24M_CTRL) &
+ ANADIG_OSC_24M_CTRL_STABLE) == 0);
+
+ reg = getreg32(IMXRT_ANADIG_OSC_24M_CTRL);
+ reg &= ~ANADIG_OSC_24M_CTRL_GATE;
+ putreg32(reg, IMXRT_ANADIG_OSC_24M_CTRL);
+ }
+}
+
+static void imxrt_enable_clock_source(int source)
+{
+ switch (source)
+ {
+ case OSC_24M:
+ imxrt_enable_osc_24m();
+ break;
+
+ default:
Review Comment:
@jlaitine I think it should be helpful to add a debug error, if int source
is invalid, this is a kind of issue that could waste people it if the passed
the wrong parameter
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]