mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] arm: socfpga: mailbox_s10: add more wrappers for commands
@ 2026-09-28 12:45 Michael Tretter
  2026-09-28 12:45 ` [PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status Michael Tretter
  2026-09-28 12:45 ` [PATCH 2/2] arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS Michael Tretter
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Tretter @ 2026-09-28 12:45 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter

The mailbox interface of the SDM firmware on Agilex 5 provides various
commands that enable the software in the HPS to request information
about the system configuration and status.

Add wrappers for the mailbox commands to add some convenience in barebox
when requesting information from the SDM firmware.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Michael Tretter (2):
      arm: socfpga: mailbox_s10: add wrapper for RSU status
      arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS

 arch/arm/mach-socfpga/mailbox_s10.c | 63 +++++++++++++++++++++++++++++++++++++
 include/mach/socfpga/mailbox_s10.h  | 34 ++++++++++++++++++++
 2 files changed, 97 insertions(+)
---
base-commit: 4a752d2303440195e12ed1a4e642b0be5b450b8e
change-id: 20260928-socfpga-agilex5-mbox-e95545bb353a

Best regards,
-- 
Michael Tretter <m.tretter@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status
  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
  2026-09-28 12:45 ` [PATCH 2/2] arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS Michael Tretter
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tretter @ 2026-09-28 12:45 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter

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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS
  2026-09-28 12:45 [PATCH 0/2] arm: socfpga: mailbox_s10: add more wrappers for commands Michael Tretter
  2026-09-28 12:45 ` [PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status Michael Tretter
@ 2026-09-28 12:45 ` Michael Tretter
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tretter @ 2026-09-28 12:45 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter

The CONFIG_STATUS command allows barebox to request the current
bitstream configuration from the SDM firmware. This includes potential
errors, the boot configuration and the Quartus Version that was used to
create the image and the SDM firmware.

Add a wrapper 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 | 21 +++++++++++++++++++++
 include/mach/socfpga/mailbox_s10.h  | 11 +++++++++++
 2 files changed, 32 insertions(+)

diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
index a3e208a2aa17..1cf92813b5a7 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -369,6 +369,27 @@ int mbox_rsu_get_spt(struct rsu_spt_offset *rsu_spt_offset)
 	return 0;
 }
 
+int mbox_config_status(struct config_status *config_status)
+{
+	int ret;
+	u32 *resp_buf = (u32 *)config_status;
+	u32 resp_buf_len = sizeof(*config_status)/sizeof(*resp_buf);
+
+	ret = mbox_send_cmd(MBOX_ID_BAREBOX,
+			    MBOX_CONFIG_STATUS,
+			    MBOX_CMD_DIRECT,
+			    0, NULL, 0, &resp_buf_len, resp_buf);
+	switch (ret) {
+	case MBOX_RESP_STATOK:
+		break;
+	default:
+		pr_err("MBOX_CONFIG_STATUS failed: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 int mbox_rsu_status(struct rsu_status_info *status_info)
 {
 	int ret;
diff --git a/include/mach/socfpga/mailbox_s10.h b/include/mach/socfpga/mailbox_s10.h
index b006fb18ff09..bc0fd97ff0fc 100644
--- a/include/mach/socfpga/mailbox_s10.h
+++ b/include/mach/socfpga/mailbox_s10.h
@@ -190,6 +190,17 @@ 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 config_status {
+	u32 state;
+	u32 version;
+	u32 pin_status;
+	u32 soft_function_status;
+	u32 error_location;
+	u32 error_details;
+};
+
+int mbox_config_status(struct config_status *config_status);
+
 struct rsu_spt_offset {
 	u32 spt0_hi;
 	u32 spt0_lo;

-- 
2.47.3




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-28 12:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-28 12:45 [PATCH 0/2] arm: socfpga: mailbox_s10: add more wrappers for commands Michael Tretter
2026-09-28 12:45 ` [PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status Michael Tretter
2026-09-28 12:45 ` [PATCH 2/2] arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS Michael Tretter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox