[PATCH 4/6] arm: socfpga: iossm: remove multiple read of status_addr

Michael Tretter m.tretter at pengutronix.de
Thu Apr 16 08:25:49 PDT 2026


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




More information about the barebox mailing list