rpmsg: remote_device: notify remote it's resetted in ready().
authorWendy Liang <jliang@xilinx.com>
Sat, 28 Jan 2017 01:17:01 +0000 (17:17 -0800)
committerWendy Liang <jliang@xilinx.com>
Fri, 3 Feb 2017 21:41:24 +0000 (13:41 -0800)
If the firmware has been requested to reset, in _ready() funciton,
notify the remote and set the vdev status to 0.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/rpmsg/remote_device.c

index ebb170f262190c80fc1e082eecfef24b450369c2..930c9e61a20c8a64f905b1a62ef61457dc115f57 100644 (file)
@@ -366,10 +366,14 @@ int rpmsg_rdev_remote_ready(struct remote_device *rdev)
        uint8_t status;
        if (rdev->role == RPMSG_MASTER) {
                while (1) {
        uint8_t status;
        if (rdev->role == RPMSG_MASTER) {
                while (1) {
-                       /* Busy wait until the remote is ready */
                        status = vdev->func->get_status(vdev);
                        status = vdev->func->get_status(vdev);
-                       if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK)
+                       /* Busy wait until the remote is ready */
+                       if (status & VIRTIO_CONFIG_STATUS_NEEDS_RESET) {
+                               rpmsg_rdev_set_status(vdev, 0);
+                               hil_vdev_notify(vdev);
+                       } else if (status & VIRTIO_CONFIG_STATUS_DRIVER_OK) {
                                return true;
                                return true;
+                       }
                        metal_cpu_yield();
                }
        } else {
                        metal_cpu_yield();
                }
        } else {
@@ -556,3 +560,4 @@ void rpmsg_rdev_reset(struct virtio_device *dev)
 
        return;
 }
 
        return;
 }
+