board: ti: Add 32k crystal initialization
cover board: ti: Add 32k crystal initialization
Add 32k crystal initialization support for am62x, am62ax and am62px TI boards.
Vishal Mahaveer (6):
board: ti: am62x: Add basic initialization for 32k crystal
board: ti: am62ax: Add basic initialization for 32k crystal
board: ti: am62px: Add basic initialization for 32k crystal
configs: am62x_evm_a53_defconfig: Enable SPL_BOARD_INIT
configs: am62ax_evm_a53_defconfig: Enable SPL_BOARD_INIT
configs: am62px_evm_a53_defconfig: Enable SPL_BOARD_INIT
board/ti/am62ax/evm.c | 16 ++++++++++++++++ board/ti/am62px/evm.c | 13 +++++++++++++ board/ti/am62x/evm.c | 13 +++++++++++++ configs/am62ax_evm_a53_defconfig | 1 + configs/am62px_evm_a53_defconfig | 1 + configs/am62x_evm_a53_defconfig | 1 + 6 files changed, 45 insertions(+)
Signature · 1 line
2.34.1
PATCH 1/6 board: ti: am62x: Add basic initialization for 32k crystal
Do the basic configuration required for enabling the 32k crystal. If external 32k source is not used, 32k rc-osc comes into play, which is accurate to +-20%.
--- board/ti/am62x/evm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
board/ti/am62x/evm.c +13 -0
@@ -137,13 +137,26 @@ int board_late_init(void)#endif #if defined(CONFIG_XPL_BUILD ) +#if IS_ENABLED (CONFIG_SPL_BOARD_INIT )void spl_board_init (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 ); +enable_caches ();if (IS_ENABLED (CONFIG_SPL_SPLASH_SCREEN ) &&IS_ENABLED (CONFIG_SPL_BMP ))splash_display (); } +#endif void spl_perform_board_fixups (struct spl_image_info *spl_image) {
Signature · 1 line
2.34.1
PATCH 2/6 board: ti: am62ax: Add basic initialization for 32k crystal
In reply to Vishal MahaveerDo the basic configuration required for enabling the 32k crystal. If external 32k source is not used, 32k rc-osc comes into play, which is accurate to +-20%.
--- board/ti/am62ax/evm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
board/ti/am62ax/evm.c +16 -0
@@ -35,3 +35,19 @@ int board_late_init(void) return 0; }#endif + +#if IS_ENABLED (CONFIG_SPL_BOARD_INIT ) +void spl_board_init (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 ); +} +#endif
Signature · 1 line
2.34.1
PATCH 3/6 board: ti: am62px: Add basic initialization for 32k crystal
In reply to Vishal MahaveerDo the basic configuration required for enabling the 32k crystal. If external 32k source is not used, 32k rc-osc comes into play, which is accurate to +-20%.
--- board/ti/am62px/evm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
board/ti/am62px/evm.c +13 -0
@@ -43,11 +43,24 @@ struct efi_capsule_update_info update_info = { };#if IS_ENABLED (CONFIG_SPL_BUILD ) +#if IS_ENABLED (CONFIG_SPL_BOARD_INIT )void spl_board_init (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 ); +enable_caches (); }#endif +#endif #if defined(CONFIG_XPL_BUILD )void spl_perform_board_fixups (struct spl_image_info *spl_image)
Signature · 1 line
2.34.1
PATCH 4/6 configs: am62x_evm_a53_defconfig: Enable SPL_BOARD_INIT
In reply to Vishal MahaveerEnable the SPL_BOARD_INIT config option to make use of the spl_board_init function.
--- configs/am62x_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/am62x_evm_a53_defconfig +1 -0
@@ -39,6 +39,7 @@ CONFIG_BOOTCOMMAND="run findfdt; run envboot; bootflow scan -lb" CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_SYS_REPORT_STACK_F_USAGE=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MMCSD_RAW_MODE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
Signature · 1 line
2.34.1
PATCH 5/6 configs: am62ax_evm_a53_defconfig: Enable SPL_BOARD_INIT
In reply to Vishal MahaveerEnable the SPL_BOARD_INIT config option to make use of the spl_board_init function.
--- configs/am62ax_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/am62ax_evm_a53_defconfig +1 -0
@@ -30,6 +30,7 @@ CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_PAD_TO=0x0 +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MMCSD_RAW_MODE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1400
Signature · 1 line
2.34.1
PATCH 6/6 configs: am62px_evm_a53_defconfig: Enable SPL_BOARD_INIT
In reply to Vishal MahaveerEnable the SPL_BOARD_INIT config option to make use of the spl_board_init function.
--- configs/am62px_evm_a53_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/am62px_evm_a53_defconfig +1 -0
@@ -36,6 +36,7 @@ CONFIG_BOOTCOMMAND="run envboot; bootflow scan -lb" CONFIG_BOARD_LATE_INIT=y CONFIG_SPL_MAX_SIZE=0x58000 CONFIG_SPL_PAD_TO=0x0 +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL_SYS_MMCSD_RAW_MODE=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
Signature · 1 line
2.34.1
Quoted 7 lines · Vishal Mahaveer
Add 32k crystal initialization support for am62x, am62ax and am62px TI boards.
Vishal Mahaveer (6):
board: ti: am62x: Add basic initialization for 32k crystal
board: ti: am62ax: Add basic initialization for 32k crystal
board: ti: am62px: Add basic initialization for 32k crystal
These three functions look identical at first glance, and if so, we need to figure out a better abstraction.
Quoted 3 lines
configs:
am62x_evm_a53_defconfig: EnableSPL_BOARD_INIT
configs:am62ax_evm_a53_defconfig: EnableSPL_BOARD_INIT
configs:am62px_evm_a53_defconfig: EnableSPL_BOARD_INIT
And then, the config change should go with the code change. Thanks.
Signature · 1 line
Tom