[PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status
Michael Tretter
m.tretter at pengutronix.de
Mon Sep 28 05:45:57 PDT 2026
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 at 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
More information about the barebox
mailing list