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 2/2] arm: socfpga: mailbox_s10: add wrapper for CONFIG_STATUS
Date: Mon, 28 Sep 2026 14:45:58 +0200	[thread overview]
Message-ID: <20260928-socfpga-agilex5-mbox-v1-2-9f6ec865e882@pengutronix.de> (raw)
In-Reply-To: <20260928-socfpga-agilex5-mbox-v1-0-9f6ec865e882@pengutronix.de>

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




      parent 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 ` [PATCH 1/2] arm: socfpga: mailbox_s10: add wrapper for RSU status Michael Tretter
2026-09-28 12:45 ` Michael Tretter [this message]

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-2-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