board: ti: Add 32k crystal initialization
v2 cover board: ti: Add 32k crystal initialization
Add 32k crystal initialization support for am62x, am62ax and am62px TI boards.
Changes for v2:
- Created a common API which can be called from individual board files
- Squashed defconfig and board file changes into single commits
Vishal Mahaveer (4):
board: ti: common: Add function for initialization of 32k crystal
board: ti: am62x: Enable 32k crystal on the board
board: ti: am62ax: Enable 32k crystal on the board
board: ti: am62px: Enable 32k crystal on the board
board/ti/am62ax/evm.c | 7 +++++++ board/ti/am62px/evm.c | 4 ++++ board/ti/am62x/evm.c | 4 ++++ board/ti/common/Kconfig | 5 +++++ board/ti/common/Makefile | 1 + board/ti/common/k3_32k_lfosc.c | 22 ++++++++++++++++++++++ board/ti/common/k3_32k_lfosc.h | 15 +++++++++++++++ configs/am62ax_evm_r5_defconfig | 2 ++ configs/am62px_evm_r5_defconfig | 2 ++ configs/am62x_evm_r5_defconfig | 2 ++ 10 files changed, 64 insertions(+) create mode 100644 board/ti/common/k3_32k_lfosc.c create mode 100644 board/ti/common/k3_32k_lfosc.h
Signature · 1 line
2.34.1
PATCH v2 1/4 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.
--- board/ti/common/Kconfig | 5 +++++ board/ti/common/Makefile | 1 + board/ti/common/k3_32k_lfosc.c | 22 ++++++++++++++++++++++ board/ti/common/k3_32k_lfosc.h | 15 +++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 board/ti/common/k3_32k_lfosc.c create mode 100644 board/ti/common/k3_32k_lfosc.h
board/ti/common/Kconfig +5 -0
@@ -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
board/ti/common/Makefile +1 -0
@@ -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
board/ti/common/k3_32k_lfosc.c new file +22 -0
@@ -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 ); +}
board/ti/common/k3_32k_lfosc.h new file +15 -0
@@ -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 */
Signature · 1 line
2.34.1
PATCH v2 2/4 board: ti: am62x: Enable 32k crystal on the board
In reply to Vishal MahaveerEnable 32k crystal on the board. If external 32k source is not used, 32k rc-osc comes into play, which is accurate to +-20%.
--- board/ti/am62x/evm.c | 4 ++++ configs/am62x_evm_r5_defconfig | 2 ++ 2 files changed, 6 insertions(+)
board/ti/am62x/evm.c +4 -0
@@ -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 ();
configs/am62x_evm_r5_defconfig +2 -0
@@ -119,3 +119,5 @@ CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_LIB_RATIONAL=y CONFIG_SPL_LIB_RATIONAL=y +CONFIG_SPL_BOARD_INIT=y +CONFIG_TI_K3_BOARD_LFOSC=y
Signature · 1 line
2.34.1
PATCH v2 3/4 board: ti: am62ax: Enable 32k crystal on the board
In reply to Vishal MahaveerEnable 32k crystal on the board. If external 32k source is not used, 32k rc-osc comes into play, which is accurate to +-20%.
--- board/ti/am62ax/evm.c | 7 +++++++ configs/am62ax_evm_r5_defconfig | 2 ++ 2 files changed, 9 insertions(+)
board/ti/am62ax/evm.c +7 -0
@@ -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
configs/am62ax_evm_r5_defconfig +2 -0
@@ -102,3 +102,5 @@ CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_LIB_RATIONAL=y CONFIG_SPL_LIB_RATIONAL=y +CONFIG_SPL_BOARD_INIT=y +CONFIG_TI_K3_BOARD_LFOSC=y
Signature · 1 line
2.34.1
PATCH v2 4/4 board: ti: am62px: Enable 32k crystal on the board
In reply to Vishal MahaveerEnable 32k crystal on the board. If external 32k source is not used, 32k rc-osc comes into play, which is accurate to +-20%.
--- board/ti/am62px/evm.c | 4 ++++ configs/am62px_evm_r5_defconfig | 2 ++ 2 files changed, 6 insertions(+)
board/ti/am62px/evm.c +4 -0
@@ -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
configs/am62px_evm_r5_defconfig +2 -0
@@ -121,3 +121,5 @@ CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_LIB_RATIONAL=y CONFIG_SPL_LIB_RATIONAL=y +CONFIG_SPL_BOARD_INIT=y +CONFIG_TI_K3_BOARD_LFOSC=y
Signature · 1 line
2.34.1
On January 8, 2026 thus sayeth Vishal Mahaveer:
Quoted 11 lines
Add 32k crystal initialization support for am62x, am62ax and am62px TI boards.
Changes for v2:
- Created a common API which can be called from individual board files
- Squashed defconfig and board file changes into single commitsVishal Mahaveer (4):
board: ti: common: Add function for initialization of 32k crystal
board: ti: am62x: Enable 32k crystal on the board
board: ti: am62ax: Enable 32k crystal on the board
board: ti: am62px: Enable 32k crystal on the board
Thanks Vishal!
~Bryan
Quoted 11 lines · Vishal Mahaveer
Add 32k crystal initialization support for am62x, am62ax and am62px TI boards.
Changes for v2:
- Created a common API which can be called from individual board files
- Squashed defconfig and board file changes into single commitsVishal Mahaveer (4):
board: ti: common: Add function for initialization of 32k crystal
board: ti: am62x: Enable 32k crystal on the board
board: ti: am62ax: Enable 32k crystal on the board
board: ti: am62px: Enable 32k crystal on the board
This breaks building of am62dx_evm_r5 on current master, please rebase, thanks.
Signature · 1 line
Tom