mailbox: arm_mhuv2: time out if the receiver never comes up

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

Fixes: 5a6338cce9 ("mailbox: arm_mhuv2: Add driver")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
This commit is contained in:
Linkai Gong 2026-09-02 17:25:45 +08:00 committed by Jassi Brar
parent 0cf10e6563
commit 86976f7cc3

View File

@ -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>
@ -967,6 +968,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;
@ -1007,8 +1009,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;
}