mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
remoteproc: Add common wc-ioremap carveout callbacks
Several remoteproc drivers open-code the same ioremap_wc() and iounmap() callbacks for carveout mappings. Add subsystem-private helpers in remoteproc_internal.h so those drivers can share the same implementation. Keep this change behavior-neutral. The helper now emits a common error message on ioremap_wc() failure, but leaves mem->is_iomem handling to a follow-on patch so that the behavioral change can be justified separately. Signed-off-by: Ben Levinsky <ben.levinsky@amd.com> Tested-by: Peng Fan <peng.fan@nxp.com> #i.MX8MP-EVK Link: https://lore.kernel.org/r/20260529021637.2077602-2-ben.levinsky@amd.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
parent
dc59e4fea9
commit
50227acbf4
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <linux/irqreturn.h>
|
#include <linux/irqreturn.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
|
#include <linux/io.h>
|
||||||
|
|
||||||
struct rproc;
|
struct rproc;
|
||||||
|
|
||||||
|
|
@ -122,6 +123,31 @@ rproc_find_carveout_by_name(struct rproc *rproc, const char *name, ...);
|
||||||
void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev);
|
void rproc_add_rvdev(struct rproc *rproc, struct rproc_vdev *rvdev);
|
||||||
void rproc_remove_rvdev(struct rproc_vdev *rvdev);
|
void rproc_remove_rvdev(struct rproc_vdev *rvdev);
|
||||||
|
|
||||||
|
static inline int rproc_mem_entry_ioremap_wc(struct rproc *rproc,
|
||||||
|
struct rproc_mem_entry *mem)
|
||||||
|
{
|
||||||
|
void __iomem *va;
|
||||||
|
|
||||||
|
va = ioremap_wc(mem->dma, mem->len);
|
||||||
|
if (!va) {
|
||||||
|
dev_err(&rproc->dev, "Unable to map memory region: %pa+%zx\n",
|
||||||
|
&mem->dma, mem->len);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
mem->va = (__force void *)va;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int rproc_mem_entry_iounmap(struct rproc *rproc,
|
||||||
|
struct rproc_mem_entry *mem)
|
||||||
|
{
|
||||||
|
iounmap((__force __iomem void *)mem->va);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int rproc_prepare_device(struct rproc *rproc)
|
static inline int rproc_prepare_device(struct rproc *rproc)
|
||||||
{
|
{
|
||||||
if (rproc->ops->prepare)
|
if (rproc->ops->prepare)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user