From: Michael Tretter <m.tretter@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
BAREBOX <barebox@lists.infradead.org>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 4/6] arm: socfpga: iossm: remove multiple read of status_addr
Date: Thu, 16 Apr 2026 17:25:49 +0200 [thread overview]
Message-ID: <20260416-socfpga-agilex5-iossm-cleanup-v1-4-ca9aae003c84@pengutronix.de> (raw)
In-Reply-To: <20260416-socfpga-agilex5-iossm-cleanup-v1-0-ca9aae003c84@pengutronix.de>
The value of status_addr is already stored in cal_status. Reading the
register again is useless.
Remove the additional reads and use cal_status directly.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
arch/arm/mach-socfpga/iossm_mailbox.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-socfpga/iossm_mailbox.c b/arch/arm/mach-socfpga/iossm_mailbox.c
index 24d1404be1a1..fbf46a08d273 100644
--- a/arch/arm/mach-socfpga/iossm_mailbox.c
+++ b/arch/arm/mach-socfpga/iossm_mailbox.c
@@ -237,26 +237,21 @@ void io96b_mb_init(struct io96b_info *io96b_ctrl)
static int io96b_cal_status(phys_addr_t addr)
{
int ret;
- u32 cal_success, cal_fail;
u32 cal_status;
- phys_addr_t status_addr = addr + IOSSM_STATUS_OFFSET;
/* Ensure calibration completed */
- ret = readl_poll_timeout(IOMEM(status_addr),
+ ret = readl_poll_timeout(IOMEM(addr) + IOSSM_STATUS_OFFSET,
cal_status,
!(cal_status & IOSSM_STATUS_CAL_BUSY),
10 * USEC_PER_SEC);
if (ret) {
pr_err("%s: SDRAM calibration IO96b instance 0x%llx timeout\n",
- __func__, status_addr);
+ __func__, addr);
hang();
}
- /* Calibration status */
- cal_success = readl(status_addr) & IOSSM_STATUS_CAL_SUCCESS;
- cal_fail = readl(status_addr) & IOSSM_STATUS_CAL_FAIL;
-
- if (cal_success && !cal_fail)
+ if ((cal_status & IOSSM_STATUS_CAL_SUCCESS) &&
+ !(cal_status & IOSSM_STATUS_CAL_FAIL))
return 0;
else
return -EPERM;
--
2.47.3
next prev parent reply other threads:[~2026-04-16 15:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 15:25 [PATCH 0/6] arm: socfpga: iossm: code cleanup Michael Tretter
2026-04-16 15:25 ` [PATCH 1/6] arm: socfpga: iossm: make io96b_cal_status static Michael Tretter
2026-04-16 15:25 ` [PATCH 2/6] arm: socfpga: iossm: use readl_poll_timeout Michael Tretter
2026-04-16 15:25 ` [PATCH 3/6] arm: socfpga: iossm: remove duplicate read of response status Michael Tretter
2026-04-16 15:25 ` Michael Tretter [this message]
2026-04-16 15:25 ` [PATCH 5/6] arm: socfpga: iossm: change io96b_csr_addr to void * Michael Tretter
2026-04-16 15:25 ` [PATCH 6/6] arm: socfpga: iossm: extract io96b_mb_init_instance Michael Tretter
2026-04-17 8:14 ` [PATCH 0/6] arm: socfpga: iossm: code cleanup Sascha Hauer
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=20260416-socfpga-agilex5-iossm-cleanup-v1-4-ca9aae003c84@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
--cc=s.trumtrar@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