[PATCH] mailbox: arm_mhuv2: time out if the receiver never comes up

From: Linkai Gong

Date: Wed Sep 02 2026 - 05:26:43 EST


mhuv2_tx_init() waits forever for access_ready. Fail probe
after 1s instead of hanging boot.

Fixes: 5a6338cce9f4 ("mailbox: arm_mhuv2: Add driver")
Signed-off-by: Linkai Gong <gonglinkai@xxxxxxxxxx>
---
drivers/mailbox/arm_mhuv2.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c
index f035284944c0..1cf4282e1583 100644
--- a/drivers/mailbox/arm_mhuv2.c
+++ b/drivers/mailbox/arm_mhuv2.c
@@ -27,6 +27,7 @@

#include <linux/amba/bus.h>
#include <linux/interrupt.h>
+#include <linux/iopoll.h>
#include <linux/mailbox_controller.h>
#include <linux/mailbox/arm_mhuv2_message.h>
#include <linux/module.h>
@@ -968,6 +969,7 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
{
struct device *dev = mhu->mbox.dev;
int ret, i;
+ u32 val;

mhu->frame = SENDER_FRAME;
mhu->mbox.ops = &mhuv2_sender_ops;
@@ -1011,8 +1013,11 @@ static int mhuv2_tx_init(struct amba_device *adev, struct mhuv2 *mhu,
out:
/* Wait for receiver to be ready */
writel_relaxed(0x1, &mhu->send->access_request);
- while (!readl_relaxed(&mhu->send->access_ready))
- continue;
+ if (readl_relaxed_poll_timeout(&mhu->send->access_ready, val, val,
+ 100, 1000000)) {
+ dev_err(dev, "receiver not ready\n");
+ return -ETIMEDOUT;
+ }

return 0;
}
--
2.25.1