Skip to content

Commit f4af5bd

Browse files
sumanannaandersson
authored andcommitted
remoteproc/omap: Initialize and assign reserved memory node
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 <[email protected]> Signed-off-by: Tero Kristo <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Reviewed-by: Andrew F. Davis <[email protected]> Acked-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 530a1b5 commit f4af5bd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/remoteproc/omap_remoteproc.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/module.h>
1818
#include <linux/err.h>
1919
#include <linux/of_device.h>
20+
#include <linux/of_reserved_mem.h>
2021
#include <linux/platform_device.h>
2122
#include <linux/dma-mapping.h>
2223
#include <linux/remoteproc.h>
@@ -486,14 +487,23 @@ static int omap_rproc_probe(struct platform_device *pdev)
486487
if (ret)
487488
goto free_rproc;
488489

490+
ret = of_reserved_mem_device_init(&pdev->dev);
491+
if (ret) {
492+
dev_warn(&pdev->dev, "device does not have specific CMA pool.\n");
493+
dev_warn(&pdev->dev, "Typically this should be provided,\n");
494+
dev_warn(&pdev->dev, "only omit if you know what you are doing.\n");
495+
}
496+
489497
platform_set_drvdata(pdev, rproc);
490498

491499
ret = rproc_add(rproc);
492500
if (ret)
493-
goto free_rproc;
501+
goto release_mem;
494502

495503
return 0;
496504

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

506516
rproc_del(rproc);
507517
rproc_free(rproc);
518+
of_reserved_mem_device_release(&pdev->dev);
508519

509520
return 0;
510521
}

0 commit comments

Comments
 (0)