Skip to content

Commit

Permalink
remoteproc/omap: Initialize and assign reserved memory node
Browse files Browse the repository at this point in the history
The reserved memory nodes are not assigned to platform devices by
default in the driver core to avoid the lookup for every platform
device and incur a penalty as the real users are expected to be
only a few devices.

OMAP remoteproc devices fall into the above category and the OMAP
remoteproc driver _requires_ specific CMA pools to be assigned
for each device at the moment to align on the location of the
vrings and vring buffers in the RTOS-side firmware images. So,
use the of_reserved_mem_device_init/release() API appropriately
to assign the corresponding reserved memory region to the OMAP
remoteproc device. Note that only one region per device is
allowed by the framework.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Andrew F. Davis <afd@ti.com>
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200324110035.29907-7-t-kristo@ti.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
Suman Anna authored and Bjorn Andersson committed Mar 26, 2020
1 parent 530a1b5 commit f4af5bd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/remoteproc/omap_remoteproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/err.h>
#include <linux/of_device.h>
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/remoteproc.h>
Expand Down Expand Up @@ -486,14 +487,23 @@ static int omap_rproc_probe(struct platform_device *pdev)
if (ret)
goto free_rproc;

ret = of_reserved_mem_device_init(&pdev->dev);
if (ret) {
dev_warn(&pdev->dev, "device does not have specific CMA pool.\n");
dev_warn(&pdev->dev, "Typically this should be provided,\n");
dev_warn(&pdev->dev, "only omit if you know what you are doing.\n");
}

platform_set_drvdata(pdev, rproc);

ret = rproc_add(rproc);
if (ret)
goto free_rproc;
goto release_mem;

return 0;

release_mem:
of_reserved_mem_device_release(&pdev->dev);
free_rproc:
rproc_free(rproc);
return ret;
Expand All @@ -505,6 +515,7 @@ static int omap_rproc_remove(struct platform_device *pdev)

rproc_del(rproc);
rproc_free(rproc);
of_reserved_mem_device_release(&pdev->dev);

return 0;
}
Expand Down

0 comments on commit f4af5bd

Please sign in to comment.