diff options
| author | Jamie Gibbons <[email protected]> | 2026-07-22 16:45:49 +0100 |
|---|---|---|
| committer | Leo Yu-Chi Liang <[email protected]> | 2026-08-05 10:16:07 -0700 |
| commit | d803fb548e5844306830702438381c27373ce6ba (patch) | |
| tree | 4467e727d0653337e0d99ef0533813699d05fe29 | |
| parent | 47cd1fd361e61be4c8293e02aa4b6c60c2d26d76 (diff) | |
mailbox: mpfs: add bounded wait for BUSY to clear before sending request
The MPFS mailbox driver currently checks the BUSY bit at the start of
mpfs_mbox_send() and immediately returns -EBUSY if the controller is
busy.
On MPFS, BUSY may be transiently asserted during early boot even though
no other U-Boot service is actively executing. In Linux, returning
-EBUSY here is retryable via the mailbox framework and scheduler, but in
U-Boot this results in a hard failure.
Replace the immediate BUSY check with a bounded wait using
regmap_read_poll_timeout(), waiting for the controller to become idle
before issuing a new request. This preserves the intent of the BUSY
check while avoiding spurious early-boot failures in U-Boot’s
synchronous, polled execution model.
The timeout is conservative and based on observed MPFS behaviour, where
BUSY clears within a few milliseconds.
Signed-off-by: Jamie Gibbons <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
| -rw-r--r-- | drivers/mailbox/mpfs-mbox.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mailbox/mpfs-mbox.c b/drivers/mailbox/mpfs-mbox.c index 165d9d89630..8b7a2719330 100644 --- a/drivers/mailbox/mpfs-mbox.c +++ b/drivers/mailbox/mpfs-mbox.c @@ -65,8 +65,11 @@ static int mpfs_mbox_send(struct mbox_chan *chan, const void *data) u32 *word_buf = (u32 *)msg->cmd_data; - if (mpfs_mbox_busy(chan)) - return -EBUSY; + ret = regmap_read_poll_timeout(mbox->control_scb, SERVICES_SR_OFFSET, + value, !(value & SERVICE_SR_BUSY_MASK), + 1, 20); + if (ret) + return ret; for (idx = 0; idx < (msg->cmd_data_size / BYTES_4); idx++) writel(word_buf[idx], mbox->mbox_base + msg->mbox_offset + idx * BYTES_4); |
