diff --git a/drivers/mailbox/arm_mhuv2.c b/drivers/mailbox/arm_mhuv2.c index d4077cd49360..0520d4996634 100644 --- a/drivers/mailbox/arm_mhuv2.c +++ b/drivers/mailbox/arm_mhuv2.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -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; }