[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201204074036.23870-3-peng.fan@oss.nxp.com>
Date: Fri, 4 Dec 2020 15:40:31 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: ohad@...ery.com, bjorn.andersson@...aro.org,
mathieu.poirier@...aro.org, o.rempel@...gutronix.de
Cc: shawnguo@...nel.org, s.hauer@...gutronix.de, kernel@...gutronix.de,
festevam@...il.com, linux-imx@....com,
linux-remoteproc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Peng Fan <peng.fan@....com>, Richard Zhu <hongxing.zhu@....com>
Subject: [PATCH V3 2/7] remoteproc: imx_rproc: add elf memory hooks
From: Peng Fan <peng.fan@....com>
Add elf memory hooks according to elf_mem_hook setting in the platform
configuration dcfg.
Acked-by: Richard Zhu <hongxing.zhu@....com>
Signed-off-by: Peng Fan <peng.fan@....com>
---
drivers/remoteproc/imx_rproc.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 8957ed271d20..d1abb253b499 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -6,6 +6,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/interrupt.h>
+#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
@@ -76,6 +77,7 @@ struct imx_rproc_dcfg {
u32 src_stop;
const struct imx_rproc_att *att;
size_t att_size;
+ bool elf_mem_hook;
};
struct imx_rproc {
@@ -310,6 +312,16 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
return 0;
}
+static void imx_rproc_memcpy(struct rproc *rproc, void *dest, const void *src, size_t count)
+{
+ memcpy_toio((void * __iomem)dest, src, count);
+}
+
+static void imx_rproc_memset(struct rproc *rproc, void *s, int c, size_t count)
+{
+ memset_io((void * __iomem)s, c, count);
+}
+
static int imx_rproc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -340,6 +352,11 @@ static int imx_rproc_probe(struct platform_device *pdev)
goto err_put_rproc;
}
+ if (dcfg->elf_mem_hook) {
+ rproc->ops->elf_memcpy = imx_rproc_memcpy;
+ rproc->ops->elf_memset = imx_rproc_memset;
+ }
+
priv = rproc->priv;
priv->rproc = rproc;
priv->regmap = regmap;
--
2.28.0
Powered by blists - more mailing lists