diff options
author | Richard Zhu <hongxing.zhu@nxp.com> | 2018-11-22 14:11:05 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:35:26 +0800 |
commit | 909bb6ec27501447da9641a94024998dccf5cf1a (patch) | |
tree | 7a1d07c70c3200b94710fdc55989267280bccade | |
parent | d0f5f20e7b802d9fdc21956510201d36c91a7b8a (diff) |
MLK-20446 rpmsg: imx: only use the timeout by the first notify
To make sure that the message wound't be discarded when
M4 is running normally or in the suspend mode. Only use
the timeout mechanism by the first notify when the vdev
is registered.
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
-rw-r--r-- | drivers/rpmsg/imx_rpmsg.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/rpmsg/imx_rpmsg.c b/drivers/rpmsg/imx_rpmsg.c index 4fed5b07f2bc..30cc8b8194ce 100644 --- a/drivers/rpmsg/imx_rpmsg.c +++ b/drivers/rpmsg/imx_rpmsg.c @@ -55,6 +55,7 @@ struct imx_rpmsg_vproc { struct clk *mu_clk; enum imx_rpmsg_variants variant; int vdev_nums; + int first_notify; #define MAX_VDEV_NUMS 8 struct imx_virdev ivdev[MAX_VDEV_NUMS]; void __iomem *mu_base; @@ -126,8 +127,17 @@ static bool imx_rpmsg_notify(struct virtqueue *vq) * Use the timeout MU send message here. * Since that M4 core may not be loaded, and the first MSG may * not be handled by M4 when multi-vdev is enabled. + * To make sure that the message wound't be discarded when M4 + * is running normally or in the suspend mode. Only use + * the timeout mechanism by the first notify when the vdev is + * registered. */ - MU_SendMessageTimeout(rpvq->rpdev->mu_base, 1, mu_rpmsg, 200); + if (unlikely(rpvq->rpdev->first_notify > 0)) { + rpvq->rpdev->first_notify--; + MU_SendMessageTimeout(rpvq->rpdev->mu_base, 1, mu_rpmsg, 200); + } else { + MU_SendMessage(rpvq->rpdev->mu_base, 1, mu_rpmsg); + } mutex_unlock(&rpvq->rpdev->lock); return true; @@ -531,6 +541,7 @@ static int imx_rpmsg_probe(struct platform_device *pdev) pr_err("vdev-nums exceed the max %d\n", MAX_VDEV_NUMS); return -EINVAL; } + rpdev->first_notify = rpdev->vdev_nums; if (!strcmp(rpdev->rproc_name, "m4")) { ret = set_vring_phy_buf(pdev, rpdev, |