summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-01-28 15:54:50 -0600
committerTom Rini <[email protected]>2026-01-28 15:54:50 -0600
commitfcd28a598d8b88baf8858fe161c1249b893ee055 (patch)
tree3628d31bf5277600a2835b9b096ff374b343aebf /board
parent3a53a03f50118e329a0f38bd28ea5f7d8e22147a (diff)
parentde6b11e27b3a127d6e500e970f6ee7a70d7ab4bd (diff)
Merge patch series "board: ti: Add 32k crystal initialization"
Vishal Mahaveer <[email protected]> says: Add 32k crystal initialization support for am62x, am62ax and am62px TI boards. Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'board')
-rw-r--r--board/ti/am62ax/evm.c7
-rw-r--r--board/ti/am62dx/evm.c7
-rw-r--r--board/ti/am62px/evm.c4
-rw-r--r--board/ti/am62x/evm.c4
-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
8 files changed, 65 insertions, 0 deletions
diff --git a/board/ti/am62ax/evm.c b/board/ti/am62ax/evm.c
index da6c31176cd..4916eec3b2b 100644
--- a/board/ti/am62ax/evm.c
+++ b/board/ti/am62ax/evm.c
@@ -15,6 +15,7 @@
#include <asm/arch/k3-ddr.h>
#include "../common/fdt_ops.h"
+#include "../common/k3_32k_lfosc.h"
#if defined(CONFIG_XPL_BUILD)
void spl_perform_board_fixups(struct spl_image_info *spl_image)
@@ -26,6 +27,12 @@ void spl_perform_board_fixups(struct spl_image_info *spl_image)
fixup_memory_node(spl_image);
}
}
+
+void spl_board_init(void)
+{
+ if (IS_ENABLED(CONFIG_TI_K3_BOARD_LFOSC))
+ enable_32k_lfosc();
+}
#endif
#ifdef CONFIG_BOARD_LATE_INIT
diff --git a/board/ti/am62dx/evm.c b/board/ti/am62dx/evm.c
index 0924954c738..94d6043200a 100644
--- a/board/ti/am62dx/evm.c
+++ b/board/ti/am62dx/evm.c
@@ -15,6 +15,7 @@
#include <asm/arch/k3-ddr.h>
#include "../common/fdt_ops.h"
+#include "../common/k3_32k_lfosc.h"
#if defined(CONFIG_XPL_BUILD)
void spl_perform_board_fixups(struct spl_image_info *spl_image)
@@ -26,6 +27,12 @@ void spl_perform_board_fixups(struct spl_image_info *spl_image)
fixup_memory_node(spl_image);
}
}
+
+void spl_board_init(void)
+{
+ if (IS_ENABLED(CONFIG_TI_K3_BOARD_LFOSC))
+ enable_32k_lfosc();
+}
#endif
#ifdef CONFIG_BOARD_LATE_INIT
diff --git a/board/ti/am62px/evm.c b/board/ti/am62px/evm.c
index 85c332b9339..8fde47fb1be 100644
--- a/board/ti/am62px/evm.c
+++ b/board/ti/am62px/evm.c
@@ -16,6 +16,7 @@
#include <spl.h>
#include <asm/arch/k3-ddr.h>
#include "../common/fdt_ops.h"
+#include "../common/k3_32k_lfosc.h"
struct efi_fw_image fw_images[] = {
{
@@ -45,6 +46,9 @@ struct efi_capsule_update_info update_info = {
#if IS_ENABLED(CONFIG_SPL_BUILD)
void spl_board_init(void)
{
+ if (IS_ENABLED(CONFIG_TI_K3_BOARD_LFOSC))
+ enable_32k_lfosc();
+
enable_caches();
}
#endif
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index e9eba57eba7..2e8336900d1 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -24,6 +24,7 @@
#include "../common/board_detect.h"
#include "../common/fdt_ops.h"
+#include "../common/k3_32k_lfosc.h"
#define board_is_am62x_skevm() (board_ti_k3_is("AM62-SKEVM") || \
board_ti_k3_is("AM62B-SKEVM"))
@@ -139,6 +140,9 @@ int board_late_init(void)
#if defined(CONFIG_XPL_BUILD)
void spl_board_init(void)
{
+ if (IS_ENABLED(CONFIG_TI_K3_BOARD_LFOSC))
+ enable_32k_lfosc();
+
enable_caches();
if (IS_ENABLED(CONFIG_SPL_SPLASH_SCREEN) && IS_ENABLED(CONFIG_SPL_BMP))
splash_display();
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 */