summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorVishal Mahaveer <[email protected]>2026-01-21 13:53:37 -0600
committerTom Rini <[email protected]>2026-01-28 15:54:41 -0600
commitc927eefd969d3714d55ac56e7a2ba34f923b9c1e (patch)
tree4830951ccdad282943f981cb8d3f03f735b30804 /board
parentfd871fc6bb497c6ddd7b39622480b89add78f57b (diff)
board: ti: common: Add function for initialization of 32k crystal
Add a common helper function for doing the basic configuration required for enabling the 32k crystal on some of the TI boards. Signed-off-by: Vishal Mahaveer <[email protected]>
Diffstat (limited to 'board')
-rw-r--r--board/ti/common/Kconfig5
-rw-r--r--board/ti/common/Makefile1
-rw-r--r--board/ti/common/k3_32k_lfosc.c22
-rw-r--r--board/ti/common/k3_32k_lfosc.h15
4 files changed, 43 insertions, 0 deletions
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig
index 3dd2852e6b0..409454813f3 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -22,6 +22,11 @@ config CAPE_EEPROM_BUS_NUM
default 2
depends on SUPPORT_EXTENSION_SCAN
+config TI_K3_BOARD_LFOSC
+ bool "Initialize 32k LFOSC"
+ help
+ Enable the 32k LFOSC on the device
+
config TI_COMMON_CMD_OPTIONS
bool "Enable cmd options on TI platforms"
imply CMD_ASKENV
diff --git a/board/ti/common/Makefile b/board/ti/common/Makefile
index f58935b4103..b40c93cf312 100644
--- a/board/ti/common/Makefile
+++ b/board/ti/common/Makefile
@@ -5,3 +5,4 @@ obj-${CONFIG_TI_I2C_BOARD_DETECT} += board_detect.o
obj-${CONFIG_$(PHASE_)SUPPORT_EXTENSION_SCAN} += cape_detect.o
obj-${CONFIG_OF_LIBFDT} += fdt_ops.o
obj-${CONFIG_ARCH_K3} += k3-ddr.o
+obj-${CONFIG_TI_K3_BOARD_LFOSC} += k3_32k_lfosc.o
diff --git a/board/ti/common/k3_32k_lfosc.c b/board/ti/common/k3_32k_lfosc.c
new file mode 100644
index 00000000000..24c5bad76b9
--- /dev/null
+++ b/board/ti/common/k3_32k_lfosc.c
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Library to support LFOSC operations common to some of the K3 devices
+ *
+ * Copyright (C) 2026 Texas Instruments Incorporated - https://www.ti.com/
+ */
+
+#include <asm/arch/hardware.h>
+
+void enable_32k_lfosc(void)
+{
+ u32 val;
+
+ /* We have 32k crystal, so lets enable it */
+ val = readl(MCU_CTRL_LFXOSC_CTRL);
+ val &= ~(MCU_CTRL_LFXOSC_32K_DISABLE_VAL);
+ writel(val, MCU_CTRL_LFXOSC_CTRL);
+ /* Add any TRIM needed for the crystal here.. */
+ /* Make sure to mux up to take the SoC 32k from the crystal */
+ writel(MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL,
+ MCU_CTRL_DEVICE_CLKOUT_32K_CTRL);
+}
diff --git a/board/ti/common/k3_32k_lfosc.h b/board/ti/common/k3_32k_lfosc.h
new file mode 100644
index 00000000000..08752033f2e
--- /dev/null
+++ b/board/ti/common/k3_32k_lfosc.h
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Library to support LFOSC operations common to some of the K3 devices
+ *
+ * Copyright (C) 2026 Texas Instruments Incorporated - https://www.ti.com/
+ */
+#ifndef __32K_LFOSC_OPS_H
+#define __32K_LFOSC_OPS_H
+
+/**
+ * enable_32k_lfosc - Do basic initialization of the 32k crystal
+ */
+void enable_32k_lfosc(void);
+
+#endif /* __32K_LFOSC_OPS_H */