From 8fde2b75d7e390fc18ca54032fe9b43a884476e1 Mon Sep 17 00:00:00 2001 From: Mahesh Mahadevan Date: Sat, 22 Jun 2024 21:31:26 +0100 Subject: [PATCH] soc: nxp_rw6xx: Add support for XTAL32K clock This clock is used for certain peripherals such as RTC. On certain RW612 boards such as rd_rw612_bga, XTAL32K and ENET share pins. Add code to check if ENET and XTAL32 are enabled at the same time. Signed-off-by: Mahesh Mahadevan --- soc/nxp/rw/Kconfig | 5 +++++ soc/nxp/rw/soc.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/soc/nxp/rw/Kconfig b/soc/nxp/rw/Kconfig index 13b6b4e5dc9..a32483ad0c1 100644 --- a/soc/nxp/rw/Kconfig +++ b/soc/nxp/rw/Kconfig @@ -55,4 +55,9 @@ endif # NXP_RW6XX_BOOT_HEADER rsource "../common/Kconfig.flexspi_xip" rsource "../common/Kconfig.nbu" +config XTAL32K + bool "Use the External 32K clock" + help + This clock is used by certain peripherals such as RTC. + endif # SOC_SERIES_RW6XX diff --git a/soc/nxp/rw/soc.c b/soc/nxp/rw/soc.c index 6da997315b1..a936978995b 100644 --- a/soc/nxp/rw/soc.c +++ b/soc/nxp/rw/soc.c @@ -201,6 +201,10 @@ __weak __ramfunc void clock_init(void) #if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm14), nxp_lpc_i2c, okay)) && CONFIG_I2C CLOCK_AttachClk(kSFRO_to_FLEXCOMM14); #endif +#if CONFIG_XTAL32K + CLOCK_EnableXtal32K(true); + CLOCK_AttachClk(kXTAL32K_to_CLK32K); +#endif /* Clock flexcomms when used as SPI */ #ifdef CONFIG_SPI