From 8c32a82e47f5d1a2871ec99b0c8b61eb789f9fcb Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 6 Aug 2024 09:48:47 -0400 Subject: [PATCH] arch: arc: replace ARC_EARLY_SOC_INIT with PLATFORM_RESET_HOOK Use generic hook infrastrucutre instead of custom Kconfig and hooks for ARC. Replace soc_early_asm_init_percpu() with platform_reset() Signed-off-by: Anas Nashif --- arch/arc/Kconfig | 4 +++- arch/arc/core/reset.S | 9 +++++---- soc/snps/hsdk4xd/CMakeLists.txt | 1 + soc/snps/hsdk4xd/Kconfig.defconfig | 2 +- soc/snps/hsdk4xd/soc_ctrl.S | 14 ++++++++++++++ soc/snps/hsdk4xd/soc_ctrl.h | 17 ----------------- 6 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 soc/snps/hsdk4xd/soc_ctrl.S delete mode 100644 soc/snps/hsdk4xd/soc_ctrl.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index bd1b30517d4eb5..a27b09659acf58 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -374,7 +374,9 @@ config ARC_EXCEPTION_STACK_SIZE endmenu config ARC_EARLY_SOC_INIT - bool "Make early stage SoC-specific initialization" + bool "Make early stage SoC-specific initialization [DEPRECATED]" + select SOC_RESET_HOOK + select DEPRECATED help Call SoC per-core setup code on early stage initialization (before C runtime initialization). Setup code is called in form of diff --git a/arch/arc/core/reset.S b/arch/arc/core/reset.S index a2b038d387ee20..63fa6438ce448c 100644 --- a/arch/arc/core/reset.S +++ b/arch/arc/core/reset.S @@ -16,8 +16,9 @@ #include #include #include -#ifdef CONFIG_ARC_EARLY_SOC_INIT - #include + +#if defined(CONFIG_SOC_RESET_HOOK) +GTEXT(soc_reset_hook) #endif GDATA(z_interrupt_stacks) @@ -112,8 +113,8 @@ done_icache_invalidate: done_dcache_invalidate: -#ifdef CONFIG_ARC_EARLY_SOC_INIT - soc_early_asm_init_percpu +#ifdef CONFIG_SOC_RESET_HOOK + bl soc_reset_hook #endif _dsp_extension_probe diff --git a/soc/snps/hsdk4xd/CMakeLists.txt b/soc/snps/hsdk4xd/CMakeLists.txt index e1765fe1136396..d29cb7e2e50ef4 100644 --- a/soc/snps/hsdk4xd/CMakeLists.txt +++ b/soc/snps/hsdk4xd/CMakeLists.txt @@ -16,5 +16,6 @@ else() endif() zephyr_include_directories(.) +zephyr_library_sources_ifdef(CONFIG_SOC_RESET_HOOK soc_ctrl.S) set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "") diff --git a/soc/snps/hsdk4xd/Kconfig.defconfig b/soc/snps/hsdk4xd/Kconfig.defconfig index a47f25d09d0196..4adafa9b043317 100644 --- a/soc/snps/hsdk4xd/Kconfig.defconfig +++ b/soc/snps/hsdk4xd/Kconfig.defconfig @@ -44,7 +44,7 @@ config UART_NS16550_ACCESS_WORD_ONLY config ARC_HAS_ACCL_REGS default y -config ARC_EARLY_SOC_INIT +config SOC_RESET_HOOK default y config ARC_HAS_STACK_CHECKING diff --git a/soc/snps/hsdk4xd/soc_ctrl.S b/soc/snps/hsdk4xd/soc_ctrl.S new file mode 100644 index 00000000000000..0973b16656482e --- /dev/null +++ b/soc/snps/hsdk4xd/soc_ctrl.S @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Synopsys, Inc. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +GTEXT(soc_reset_hook) +SECTION_FUNC(TEXT, soc_reset_hook) + mov r0, 1 /* disable LPB for HS4XD */ + sr r0, [_ARC_V2_LPB_CTRL] diff --git a/soc/snps/hsdk4xd/soc_ctrl.h b/soc/snps/hsdk4xd/soc_ctrl.h deleted file mode 100644 index 93d50d3eb2073f..00000000000000 --- a/soc/snps/hsdk4xd/soc_ctrl.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2023 Synopsys, Inc. All rights reserved. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#ifndef _ARC_HSDK4XD_SOC_CTRL_H_ -#define _ARC_HSDK4XD_SOC_CTRL_H_ - -#ifdef _ASMLANGUAGE -.macro soc_early_asm_init_percpu - mov r0, 1 /* disable LPB for HS4XD */ - sr r0, [_ARC_V2_LPB_CTRL] -.endm -#endif /* _ASMLANGUAGE */ - -#endif /* _ARC_HSDK4XD_SOC_CTRL_H_ */