jlaitine commented on code in PR #20365:
URL: https://github.com/apache/nuttx/pull/20365#discussion_r4104998695
##########
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:
There are quite many clock sources, and this would require adding all of
them to this table. Some of the sources don't need any configuration, and some
do... So yes, I agree with your comment, but do we want to expand this table to
cover all possible sources already before they are actually needed? I can come
back to this next week
--
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]