Commit c8a1a56d authored by Peng Fan's avatar Peng Fan Committed by Bjorn Andersson

remoteproc: imx_rproc: support i.MX7ULP

i.MX7ULP A7 core runs under control of M4 core, M4 core starts by ROM
and powers most services used by A7 core, so A7 core has no power to
start and stop M4 core. And the M4 core's state is default RPROC_DETACHED
and remoteproc framework not able to stop the M4 core.
Reviewed-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1620274123-1461-8-git-send-email-peng.fan@oss.nxp.comSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent cc0316c1
...@@ -136,6 +136,14 @@ static const struct imx_rproc_att imx_rproc_att_imx8mq[] = { ...@@ -136,6 +136,14 @@ static const struct imx_rproc_att imx_rproc_att_imx8mq[] = {
{ 0x40000000, 0x40000000, 0x80000000, 0 }, { 0x40000000, 0x40000000, 0x80000000, 0 },
}; };
static const struct imx_rproc_att imx_rproc_att_imx7ulp[] = {
{0x1FFD0000, 0x1FFD0000, 0x30000, ATT_OWN},
{0x20000000, 0x20000000, 0x10000, ATT_OWN},
{0x2F000000, 0x2F000000, 0x20000, ATT_OWN},
{0x2F020000, 0x2F020000, 0x20000, ATT_OWN},
{0x60000000, 0x60000000, 0x40000000, 0}
};
static const struct imx_rproc_att imx_rproc_att_imx7d[] = { static const struct imx_rproc_att imx_rproc_att_imx7d[] = {
/* dev addr , sys addr , size , flags */ /* dev addr , sys addr , size , flags */
/* OCRAM_S (M4 Boot code) - alias */ /* OCRAM_S (M4 Boot code) - alias */
...@@ -196,6 +204,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = { ...@@ -196,6 +204,12 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx8mq = {
.method = IMX_RPROC_MMIO, .method = IMX_RPROC_MMIO,
}; };
static const struct imx_rproc_dcfg imx_rproc_cfg_imx7ulp = {
.att = imx_rproc_att_imx7ulp,
.att_size = ARRAY_SIZE(imx_rproc_att_imx7ulp),
.method = IMX_RPROC_NONE,
};
static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = { static const struct imx_rproc_dcfg imx_rproc_cfg_imx7d = {
.src_reg = IMX7D_SRC_SCR, .src_reg = IMX7D_SRC_SCR,
.src_mask = IMX7D_M4_RST_MASK, .src_mask = IMX7D_M4_RST_MASK,
...@@ -238,6 +252,9 @@ static int imx_rproc_stop(struct rproc *rproc) ...@@ -238,6 +252,9 @@ static int imx_rproc_stop(struct rproc *rproc)
struct device *dev = priv->dev; struct device *dev = priv->dev;
int ret; int ret;
if (dcfg->method == IMX_RPROC_NONE)
return -EOPNOTSUPP;
ret = regmap_update_bits(priv->regmap, dcfg->src_reg, ret = regmap_update_bits(priv->regmap, dcfg->src_reg,
dcfg->src_mask, dcfg->src_stop); dcfg->src_mask, dcfg->src_stop);
if (ret) if (ret)
...@@ -573,12 +590,31 @@ static void imx_rproc_free_mbox(struct rproc *rproc) ...@@ -573,12 +590,31 @@ static void imx_rproc_free_mbox(struct rproc *rproc)
static int imx_rproc_detect_mode(struct imx_rproc *priv) static int imx_rproc_detect_mode(struct imx_rproc *priv)
{ {
struct regmap_config config = { .name = "imx-rproc" };
const struct imx_rproc_dcfg *dcfg = priv->dcfg; const struct imx_rproc_dcfg *dcfg = priv->dcfg;
struct device *dev = priv->dev; struct device *dev = priv->dev;
struct regmap *regmap;
int ret; int ret;
u32 val; u32 val;
ret = regmap_read(priv->regmap, dcfg->src_reg, &val); switch (dcfg->method) {
case IMX_RPROC_NONE:
priv->rproc->state = RPROC_DETACHED;
return 0;
default:
break;
}
regmap = syscon_regmap_lookup_by_phandle(dev->of_node, "syscon");
if (IS_ERR(regmap)) {
dev_err(dev, "failed to find syscon\n");
return PTR_ERR(regmap);
}
priv->regmap = regmap;
regmap_attach_dev(dev, regmap, &config);
ret = regmap_read(regmap, dcfg->src_reg, &val);
if (ret) { if (ret) {
dev_err(dev, "Failed to read src\n"); dev_err(dev, "Failed to read src\n");
return ret; return ret;
...@@ -625,18 +661,9 @@ static int imx_rproc_probe(struct platform_device *pdev) ...@@ -625,18 +661,9 @@ static int imx_rproc_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct imx_rproc *priv; struct imx_rproc *priv;
struct rproc *rproc; struct rproc *rproc;
struct regmap_config config = { .name = "imx-rproc" };
const struct imx_rproc_dcfg *dcfg; const struct imx_rproc_dcfg *dcfg;
struct regmap *regmap;
int ret; int ret;
regmap = syscon_regmap_lookup_by_phandle(np, "syscon");
if (IS_ERR(regmap)) {
dev_err(dev, "failed to find syscon\n");
return PTR_ERR(regmap);
}
regmap_attach_dev(dev, regmap, &config);
/* set some other name then imx */ /* set some other name then imx */
rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops, rproc = rproc_alloc(dev, "imx-rproc", &imx_rproc_ops,
NULL, sizeof(*priv)); NULL, sizeof(*priv));
...@@ -651,7 +678,6 @@ static int imx_rproc_probe(struct platform_device *pdev) ...@@ -651,7 +678,6 @@ static int imx_rproc_probe(struct platform_device *pdev)
priv = rproc->priv; priv = rproc->priv;
priv->rproc = rproc; priv->rproc = rproc;
priv->regmap = regmap;
priv->dcfg = dcfg; priv->dcfg = dcfg;
priv->dev = dev; priv->dev = dev;
...@@ -720,6 +746,7 @@ static int imx_rproc_remove(struct platform_device *pdev) ...@@ -720,6 +746,7 @@ static int imx_rproc_remove(struct platform_device *pdev)
} }
static const struct of_device_id imx_rproc_of_match[] = { static const struct of_device_id imx_rproc_of_match[] = {
{ .compatible = "fsl,imx7ulp-cm4", .data = &imx_rproc_cfg_imx7ulp },
{ .compatible = "fsl,imx7d-cm4", .data = &imx_rproc_cfg_imx7d }, { .compatible = "fsl,imx7d-cm4", .data = &imx_rproc_cfg_imx7d },
{ .compatible = "fsl,imx6sx-cm4", .data = &imx_rproc_cfg_imx6sx }, { .compatible = "fsl,imx6sx-cm4", .data = &imx_rproc_cfg_imx6sx },
{ .compatible = "fsl,imx8mq-cm4", .data = &imx_rproc_cfg_imx8mq }, { .compatible = "fsl,imx8mq-cm4", .data = &imx_rproc_cfg_imx8mq },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment