Revert "arch: arc: replace ARC_EARLY_SOC_INIT with PLATFORM_RESET_HOOK"

The commit introduced regression for hsdk4xd platform.
The hsdk4xd SoC setup from soc_early_asm_init_percpu need to be done
in early code before any C code execution.

The current approach has multiple issues
 - we call function (which can be easily implemented in C for
   this or other SoC) from the place where we haven't setup stack
   pointer (so we can't use stack) - which is very error-prone
 - we never return back from soc_reset_hook on hsdk4xd platform

So let's just revert it for now. If any other ARC SoC need to use
soc_reset_hook - than it can be implemented properly.

This reverts commit 8c32a82e47.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
Evgeniy Paltsev 2024-10-18 17:44:18 +01:00 committed by Anas Nashif
commit 6d083cac7e
6 changed files with 23 additions and 24 deletions

View file

@ -383,9 +383,7 @@ config ARC_EXCEPTION_STACK_SIZE
endmenu
config ARC_EARLY_SOC_INIT
bool "Make early stage SoC-specific initialization [DEPRECATED]"
select SOC_RESET_HOOK
select DEPRECATED
bool "Make early stage SoC-specific initialization"
help
Call SoC per-core setup code on early stage initialization
(before C runtime initialization). Setup code is called in form of

View file

@ -16,9 +16,8 @@
#include <zephyr/arch/cpu.h>
#include <swap_macros.h>
#include <zephyr/arch/arc/asm-compat/assembler.h>
#if defined(CONFIG_SOC_RESET_HOOK)
GTEXT(soc_reset_hook)
#ifdef CONFIG_ARC_EARLY_SOC_INIT
#include <soc_ctrl.h>
#endif
GDATA(z_interrupt_stacks)
@ -113,8 +112,8 @@ done_icache_invalidate:
done_dcache_invalidate:
#ifdef CONFIG_SOC_RESET_HOOK
bl soc_reset_hook
#ifdef CONFIG_ARC_EARLY_SOC_INIT
soc_early_asm_init_percpu
#endif
_dsp_extension_probe

View file

@ -16,6 +16,5 @@ 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 "")

View file

@ -44,7 +44,7 @@ config UART_NS16550_ACCESS_WORD_ONLY
config ARC_HAS_ACCL_REGS
default y
config SOC_RESET_HOOK
config ARC_EARLY_SOC_INIT
default y
config ARC_HAS_STACK_CHECKING

View file

@ -1,14 +0,0 @@
/*
* Copyright (c) 2023 Synopsys, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/toolchain.h>
#include <zephyr/linker/sections.h>
#include <zephyr/arch/cpu.h>
GTEXT(soc_reset_hook)
SECTION_FUNC(TEXT, soc_reset_hook)
mov r0, 1 /* disable LPB for HS4XD */
sr r0, [_ARC_V2_LPB_CTRL]

View file

@ -0,0 +1,17 @@
/*
* 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_ */