From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70FDFC4332F for ; Fri, 6 May 2022 09:06:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B654C8331B; Fri, 6 May 2022 11:05:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="SDvlkTxi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A4AAE83C2B; Fri, 6 May 2022 11:05:41 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 87C9182094 for ; Fri, 6 May 2022 11:05:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38944B83470; Fri, 6 May 2022 09:05:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEC67C385AE; Fri, 6 May 2022 09:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651827933; bh=gB3BI0Ii9kxnGJmkeTMwURJofzfV/w6UnbNrb3poMeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDvlkTxigHCHPBKtDK8p4PZOCoDibid2u961UOwtx4Lyy55qU5mm+AAQ5GT5bQzoY sxnJL/01YVFK2iayKfue+rIug4ESap5SSFf7c6EX4PX/UYr+4+euxqKOvcYWsFokYF LYUBmPWuthkP6/TZGNcG3zhwEVTjk75V7IpvFVDxHiOp2jgaeXeMqOPPO6+60e52nT M8cBv46rfE70qNKmnXker3/j6nIK7PjQsNQ5rBoTk5hp5vDBaSw0PIq9PnvfwBpAzT wYvwM5kb4J4sNQmwHVt9bpC4CivIQq46ADJO31anW+4wbBMJHdk6zV0cyRoSU7F0UZ RVOLtju8pW7UQ== Received: by pali.im (Postfix) id 46BB711FA; Fri, 6 May 2022 11:05:30 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese , Marek Behun Cc: u-boot@lists.denx.de Subject: [PATCH 1/5] arm: Add new config option ARCH_VERY_EARLY_INIT Date: Fri, 6 May 2022 11:05:13 +0200 Message-Id: <20220506090517.5935-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220506090517.5935-1-pali@kernel.org> References: <20220506090517.5935-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean When this option is set then ARM _main() function would call arch_very_early_init() function at the beginning. It would be before calling any other functions like debug_uart_init() and also before initializing C runtime environment. Signed-off-by: Pali Rohár --- arch/arm/Kconfig | 6 ++++++ arch/arm/lib/crt0.S | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0afec5155b1b..9898c7d68e1b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -401,6 +401,12 @@ config SYS_ARM_CACHE_WRITEALLOC write is performed. endchoice +config ARCH_VERY_EARLY_INIT + bool + +config SPL_ARCH_VERY_EARLY_INIT + bool + config ARCH_CPU_INIT bool "Enable ARCH_CPU_INIT" help diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index ba312901f331..612a2d5b698e 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -90,6 +90,11 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ ENTRY(_main) +/* Call arch_very_early_init before initializing C runtime environment. */ +#if CONFIG_IS_ENABLED(ARCH_VERY_EARLY_INIT) + bl arch_very_early_init +#endif + /* * Set up initial C runtime environment and call board_init_f(0). */ -- 2.20.1