From: Andre Przywara <andre.przywara@arm.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Chen-Yu Tsai <wens@csie.org>, Icenowy Zheng <icenowy@aosc.io>,
Jesse Taube <mr.bossman075@gmail.com>,
u-boot@lists.denx.de, linux-sunxi@lists.linux.dev
Subject: [PATCH v2 1/5] sunxi: move non-essential code out of s_init()
Date: Tue, 1 Feb 2022 01:41:12 +0000 [thread overview]
Message-ID: <20220201014116.25864-2-andre.przywara@arm.com> (raw)
In-Reply-To: <20220201014116.25864-1-andre.przywara@arm.com>
So far all Allwinner based boards were doing some not-so-lowlevel-setup
in lowlevel's s_init() routine.
This includes the initial clock, timer and pinmux setup, among other
things. This is clearly out of the "absolute bare minimum to get started"
scope that lowlevel_init.S suggests for this function.
Since we have an SPL, which is called right after s_init(), move those
calls to our board_init_f() function. As we overwrite this only for
the SPL, this has the added benefit of not doing this setup *again*
shortly afterwards, when running U-Boot proper.
This makes gpio_init() to be called from the SPL only, so pull this code
into a CONFIG_SPL_BUILD protected part to avoid build warnings.
Reviewed-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/mach-sunxi/board.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 3ef179742c5..c932a293317 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -75,6 +75,7 @@ ulong board_get_usable_ram_top(ulong total_size)
}
#endif
+#ifdef CONFIG_SPL_BUILD
static int gpio_init(void)
{
__maybe_unused uint val;
@@ -172,7 +173,6 @@ static int gpio_init(void)
return 0;
}
-#if defined(CONFIG_SPL_BOARD_LOAD_IMAGE) && defined(CONFIG_SPL_BUILD)
static int spl_board_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
@@ -227,18 +227,6 @@ void s_init(void)
"mcr p15, 0, r0, c1, c0, 1\n"
::: "r0");
#endif
-#if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_H3
- /* Enable non-secure access to some peripherals */
- tzpc_init();
-#endif
-
- clock_init();
- timer_init();
- gpio_init();
-#if !CONFIG_IS_ENABLED(DM_I2C)
- i2c_init_board();
-#endif
- eth_init_board();
}
#define SUNXI_INVALID_BOOT_SOURCE -1
@@ -335,11 +323,22 @@ u32 spl_boot_device(void)
void board_init_f(ulong dummy)
{
+#if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_H3
+ /* Enable non-secure access to some peripherals */
+ tzpc_init();
+#endif
+
+ clock_init();
+ timer_init();
+ gpio_init();
+ eth_init_board();
+
spl_init();
preloader_console_init();
#if CONFIG_IS_ENABLED(I2C) && CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
/* Needed early by sunxi_board_init if PMU is enabled */
+ i2c_init_board();
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif
sunxi_board_init();
--
2.17.6
next prev parent reply other threads:[~2022-02-01 1:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-01 1:41 [PATCH v2 0/5] sunxi: remove lowlevel_init Andre Przywara
2022-02-01 1:41 ` Andre Przywara [this message]
2022-03-20 22:10 ` A20-OLinuXino-LIME2 network regression [Was: [PATCH v2 1/5] sunxi: move non-essential code out of s_init()] Petr Štetiar
2022-03-21 11:39 ` Andre Przywara
2022-02-01 1:41 ` [PATCH v2 2/5] sunxi: move Cortex SMPEN setting into start.S Andre Przywara
2022-02-03 1:06 ` Samuel Holland
2022-02-03 1:21 ` Fabio Estevam
2022-02-03 14:28 ` Andre Przywara
2022-02-01 1:41 ` [PATCH v2 3/5] sunxi: move early "SRAM setup" into separate file Andre Przywara
2022-02-01 1:41 ` [PATCH v2 4/5] armv8: remove no longer needed lowlevel_init.S Andre Przywara
2022-02-01 1:41 ` [PATCH v2 5/5] sunxi-common.h: remove pointless #ifdefs Andre Przywara
2022-02-03 1:07 ` Samuel Holland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220201014116.25864-2-andre.przywara@arm.com \
--to=andre.przywara@arm.com \
--cc=icenowy@aosc.io \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=mr.bossman075@gmail.com \
--cc=samuel@sholland.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox