mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status
Date: Mon, 28 Sep 2026 14:45:57 +0200	[thread overview]
Message-ID: <20260928-socfpga-agilex5-mbox-v1-1-9f6ec865e882@pengutronix.de> (raw)
In-Reply-To: <20260928-socfpga-agilex5-mbox-v1-0-9f6ec865e882@pengutronix.de>

SoCFPGA RSU (Remote System Update) on Agilex 5 is implemented in the SDM
firmware.

The RSU_STATUS command allows barebox to ask the SDM firmware, which
image was booted and why booting other images failed.

Furthermore, RSU uses a custom partition table (SPT, sub-partition
table) for the partition layout in the flash, which is used by the
BootROM firmware to find the boot images. The GET_SUBPARTITION_TABLE
command allows barebox to ask the SDM firmware for the location of this
partition table to be able to inspect the SPT itself.

Add wrapper functions for RSU_STATUS and GET_SUBPARTITION_TABLE to have
a more convenient interface to the SDM firmware.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/mach-socfpga/mailbox_s10.c | 42 +++++++++++++++++++++++++++++++++++++
 include/mach/socfpga/mailbox_s10.h  | 23 ++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
index fdbd7f272866..a3e208a2aa17 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -347,3 +347,45 @@ int socfpga_mailbox_s10_qspi_open(unsigned long *master_ref_clk)
 
 	return ret;
 }
+
+int mbox_rsu_get_spt(struct rsu_spt_offset *rsu_spt_offset)
+{
+	int ret;
+	u32 *resp_buf = (u32 *)rsu_spt_offset;
+	u32 resp_buf_len = sizeof(*rsu_spt_offset)/sizeof(*resp_buf);
+
+	ret = mbox_send_cmd(MBOX_ID_BAREBOX,
+			    MBOX_GET_SUBPARTITION_TABLE,
+			    MBOX_CMD_DIRECT,
+			    0, NULL, 0, &resp_buf_len, resp_buf);
+	switch (ret) {
+	case MBOX_RESP_STATOK:
+		break;
+	default:
+		pr_err("MBOX_GET_SUBPARTITION_TABLE failed: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+int mbox_rsu_status(struct rsu_status_info *status_info)
+{
+	int ret;
+	u32 *resp_buf = (u32 *)status_info;
+	u32 resp_buf_len = sizeof(*status_info)/sizeof(*resp_buf);
+
+	ret = mbox_send_cmd(MBOX_ID_BAREBOX,
+			    MBOX_RSU_STATUS,
+			    MBOX_CMD_DIRECT,
+			    0, NULL, 0, &resp_buf_len, resp_buf);
+	switch (ret) {
+	case MBOX_RESP_STATOK:
+		break;
+	default:
+		pr_err("MBOX_RSU_STATUS failed: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
diff --git a/include/mach/socfpga/mailbox_s10.h b/include/mach/socfpga/mailbox_s10.h
index 0033bf40d45b..b006fb18ff09 100644
--- a/include/mach/socfpga/mailbox_s10.h
+++ b/include/mach/socfpga/mailbox_s10.h
@@ -7,6 +7,8 @@
 #ifndef _MAILBOX_S10_H_
 #define _MAILBOX_S10_H_
 
+#include <linux/types.h>
+
 /* user define barebox ID */
 #include <linux/bitops.h>
 #define MBOX_CLIENT_ID_BAREBOX	0x2
@@ -188,4 +190,25 @@ int socfpga_mailbox_s10_qspi_close(void);
 int socfpga_mailbox_s10_qspi_open(unsigned long *master_ref_clk);
 int socfpga_mailbox_s10_qspi_get_device_info(u32 *resp_buf, u32 resp_buf_len);
 
+struct rsu_spt_offset {
+	u32 spt0_hi;
+	u32 spt0_lo;
+	u32 spt1_hi;
+	u32 spt1_lo;
+};
+
+int mbox_rsu_get_spt(struct rsu_spt_offset *rsu_spt_offset);
+
+struct rsu_status_info {
+	u64 current_image;
+	u64 fail_image;
+	u32 state;
+	u32 version;
+	u32 error_location;
+	u32 error_details;
+	u32 retry_counter;
+};
+
+int mbox_rsu_status(struct rsu_status_info *status_info);
+
 #endif /* _MAILBOX_S10_H_ */

-- 
2.47.3




  reply	other threads:[~2026-09-28 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 12:45 [PATCH 0/2] arm: socfpga: mailbox_s10: add more wrappers for commands Michael Tretter
2026-09-28 12:45 ` Michael Tretter [this message]
2026-09-28 12:45 ` [PATCH 2/2] arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS Michael Tretter

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=20260928-socfpga-agilex5-mbox-v1-1-9f6ec865e882@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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