MLK-13792-2 ARM: imx: remove the hardcoded vring buf
authorRichard Zhu <hongxing.zhu@nxp.com>
Fri, 6 Jan 2017 05:54:21 +0000 (13:54 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:58:19 +0000 (14:58 -0500)
input the vring buffer by device tree node, and
remove the hard-coded vring buffer in the driver

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
arch/arm/mach-imx/imx_rpmsg.c

index da58443..2e2f534 100644 (file)
@@ -316,10 +316,7 @@ static int set_vring_phy_buf(struct platform_device *pdev,
                        }
                }
        } else {
-               /* back compatible for the old single rpmsg instance */
-               rpdev->ivdev[0].vring[0] = 0x9FF00000;
-               rpdev->ivdev[0].vring[1] = 0x9FF08000;
-
+               return -ENOMEM;
        }
 
        return ret;
@@ -329,8 +326,6 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
 {
        int i, j, ret = 0;
        struct device_node *np = pdev->dev.of_node;
-       struct resource *res;
-       resource_size_t size;
 
        for (i = 0; i < ARRAY_SIZE(imx_rpmsg_vprocs); i++) {
                struct imx_rpmsg_vproc *rpdev = &imx_rpmsg_vprocs[i];
@@ -345,30 +340,15 @@ static int imx_rpmsg_probe(struct platform_device *pdev)
                }
 
                if (!strcmp(rpdev->rproc_name, "m4")) {
-                       ret = of_device_is_compatible(np, "fsl,imx7d-rpmsg");
-                       ret |= of_device_is_compatible(np, "fsl,imx6sx-rpmsg");
+                       ret = set_vring_phy_buf(pdev, rpdev,
+                                               rpdev->vdev_nums);
                        if (ret) {
-                               res = platform_get_resource(pdev,
-                                                           IORESOURCE_MEM, 0);
-
-                               if (res) {
-                                       size = resource_size(res);
-                                       rpdev->ivdev[0].vring[0] = res->start;
-                                       rpdev->ivdev[0].vring[1] = res->start
-                                                                       + size;
-                               } else {
-                                       /* hardcodes here now. */
-                                       rpdev->ivdev[0].vring[0] = 0xBFFF0000;
-                                       rpdev->ivdev[0].vring[1] = 0xBFFF8000;
-                               }
-                       } else {
-                               ret = set_vring_phy_buf(pdev, rpdev,
-                                                       rpdev->vdev_nums);
-                               if (ret)
-                                       break;
+                               pr_err("No vring buffer.\n");
+                               return -ENOMEM;
                        }
                } else {
-                       break;
+                       pr_err("No remote m4 processor.\n");
+                       return -ENODEV;
                }
 
                for (j = 0; j < rpdev->vdev_nums; j++) {