From 258dac35c7078959db4ed0002a113cbd78636251 Mon Sep 17 00:00:00 2001 From: Juan Gutierrez Date: Mon, 26 Sep 2016 16:44:45 -0500 Subject: [PATCH] MLK-13279 rpmsg: imx: make vring address configurable by dts vring memory address was hardcoded at the top of the 1GB RAM. For systems with a memory map with less or different than 1GB, the hardcoded value might be not correct and cause issues. This patch add the support to pass the vring address from device tree configuration on the reg platform argument in the following format: reg = For example, for a 512MB system, with the rpmgs vring placed at top of the memory the configuration will look like below: &rpmsg{ reg = <0x9FFF0000 0x8000>; }; Signed-off-by: Juan Gutierrez --- arch/arm/mach-imx/imx_rpmsg.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/imx_rpmsg.c b/arch/arm/mach-imx/imx_rpmsg.c index 3fc15471b0c8..f58f85657b15 100644 --- a/arch/arm/mach-imx/imx_rpmsg.c +++ b/arch/arm/mach-imx/imx_rpmsg.c @@ -282,6 +282,8 @@ static int imx_rpmsg_probe(struct platform_device *pdev) { int i, 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]; @@ -290,9 +292,18 @@ static int imx_rpmsg_probe(struct platform_device *pdev) ret = of_device_is_compatible(np, "fsl,imx7d-rpmsg"); ret |= of_device_is_compatible(np, "fsl,imx6sx-rpmsg"); if (ret) { - /* hardcodes here now. */ - rpdev->vring[0] = 0xBFFF0000; - rpdev->vring[1] = 0xBFFF8000; + res = platform_get_resource(pdev, + IORESOURCE_MEM, 0); + + if (res) { + size = resource_size(res); + rpdev->vring[0] = res->start; + rpdev->vring[1] = res->start + size; + } else { + /* hardcodes here now. */ + rpdev->vring[0] = 0xBFFF0000; + rpdev->vring[1] = 0xBFFF8000; + } } } else { break; -- 2.17.1