From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] ARM: rockchip: bbu: Fix getting active boot slot
Date: Tue, 9 May 2023 06:50:55 +0200 [thread overview]
Message-ID: <20230509045055.601772-1-s.hauer@pengutronix.de> (raw)
With some TF-A versions the IRAM where the boot information is stored
cannot be accessed in normal mode. We therefore copy the information
to another place before starting the TF-A. This copy is used for the
boot source detection logic, but not yet for the barebox update code
which still uses the original information from IRAM.
Use the already existing rockchip_bootsource_get_active_slot() to
avoid data aborts when trying to detect the active boot slot.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-rockchip/bbu.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-rockchip/bbu.c b/arch/arm/mach-rockchip/bbu.c
index 435ef45ccd..3ab6c1e685 100644
--- a/arch/arm/mach-rockchip/bbu.c
+++ b/arch/arm/mach-rockchip/bbu.c
@@ -14,6 +14,7 @@
#include <libfile.h>
#include <linux/bitfield.h>
#include <mach/rockchip/rk3568-regs.h>
+#include <mach/rockchip/bootrom.h>
/* The MaskROM looks for images on these locations: */
#define IMG_OFFSET_0 (0 * SZ_1K + SZ_32K)
@@ -22,14 +23,6 @@
#define IMG_OFFSET_3 (1536 * SZ_1K + SZ_32K)
#define IMG_OFFSET_4 (2048 * SZ_1K + SZ_32K)
-#define RK3568_IRAM_ACTIVE_BOOT_SLOT GENMASK(12, 10)
-
-static int rk3568_get_active_slot(void)
-{
- return FIELD_GET(RK3568_IRAM_ACTIVE_BOOT_SLOT,
- readl(RK3568_IRAM_BASE + 0x14));
-}
-
/*
* The strategy here is:
* The MaskROM iterates over the above five locations until it finds a valid
@@ -80,7 +73,7 @@ static int rk3568_bbu_mmc_handler(struct bbu_handler *handler,
return fd;
if (space >= IMG_OFFSET_4 + data->len) {
- int slot = rk3568_get_active_slot();
+ int slot = rockchip_bootsource_get_active_slot();
pr_info("Unallocated space is enough for two copies, doing failsafe update\n");
--
2.39.2
reply other threads:[~2023-05-09 4:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230509045055.601772-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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