MLK-14241-4 ARM: imx: pm-rpmsg: fix 'rpmsg_send timeout' during bootup
authorRobin Gong <yibin.gong@nxp.com>
Wed, 22 Feb 2017 09:34:42 +0000 (17:34 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:10:47 +0000 (15:10 -0500)
The rpmsg driver probe function such as pm_rpmsg_probe is called by rpmsg
rx callback, so we can't wait in pm_rpmsg_probe for any completion which
issued by callback itself, otherwise, timeout triggered definitily, because
your last callback no chance to reurn to handle the next callback unless
timeout happened. This patch move the rpmsg send code from pm_rpmsg_probe
to delay work.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
arch/arm/mach-imx/pm-rpmsg.c

index 450687a..9708b0c 100644 (file)
@@ -54,6 +54,7 @@ struct pm_rpmsg_info {
        struct pm_qos_request pm_qos_req;
        struct notifier_block restart_handler;
        struct completion cmd_complete;
+       bool first_flag;
        struct mutex lock;
 };
 
@@ -165,6 +166,12 @@ static void pm_heart_beat_work_handler(struct work_struct *work)
 {
        struct pm_rpmsg_data msg;
 
+       /* Notify M4 side A7 in RUN mode at boot time */
+       if (pm_rpmsg.first_flag) {
+               pm_vlls_notify_m4(false);
+               pm_rpmsg.first_flag = false;
+       }
+
        msg.header.cate = IMX_RMPSG_LIFECYCLE;
        msg.header.major = IMX_RMPSG_MAJOR;
        msg.header.minor = IMX_RMPSG_MINOR;
@@ -200,10 +207,9 @@ static int pm_rpmsg_probe(struct rpmsg_device *rpdev)
        INIT_DELAYED_WORK(&heart_beat_work,
                pm_heart_beat_work_handler);
 
+       pm_rpmsg.first_flag = true;
        schedule_delayed_work(&heart_beat_work,
-                       msecs_to_jiffies(10000));
-
-       pm_vlls_notify_m4(false);
+                       msecs_to_jiffies(100));
 
        pm_rpmsg.restart_handler.notifier_call = pm_restart_handler;
        pm_rpmsg.restart_handler.priority = 128;