Skip to content

Commit 0184b4f

Browse files
dbalutamathieupoirier
authored andcommitted
imx_dsp_rproc: Use reset controller API to control the DSP
DSP on i.MX8MP doesn't have a direct reset line so according to hardware design team in order to handle assert/deassert/reset functionality we need to use a combination of control bits from two modules. Audio block control module for Run/Stall control of the DSP and DAP module in order to do software reset. In a first step, for i.MX8MP we are switching on using the reset controller API to handle the DSP Run/Stall bits i.MX8MP. This comes with the advantage of offering a better probe ordering and a more natural way of abstracting the Audio block control bits. Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/20250311085812.1296243-9-daniel.baluta@nxp.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent c133ec1 commit 0184b4f

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

drivers/remoteproc/imx_dsp_rproc.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/pm_runtime.h>
2020
#include <linux/regmap.h>
2121
#include <linux/remoteproc.h>
22+
#include <linux/reset.h>
2223
#include <linux/slab.h>
2324

2425
#include "imx_rproc.h"
@@ -111,6 +112,7 @@ enum imx_dsp_rp_mbox_messages {
111112
*/
112113
struct imx_dsp_rproc {
113114
struct regmap *regmap;
115+
struct reset_control *run_stall;
114116
struct rproc *rproc;
115117
const struct imx_dsp_rproc_dcfg *dsp_dcfg;
116118
struct clk_bulk_data clks[DSP_RPROC_CLK_MAX];
@@ -192,9 +194,7 @@ static int imx8mp_dsp_reset(struct imx_dsp_rproc *priv)
192194
/* Keep reset asserted for 10 cycles */
193195
usleep_range(1, 2);
194196

195-
regmap_update_bits(priv->regmap, IMX8M_AudioDSP_REG2,
196-
IMX8M_AudioDSP_REG2_RUNSTALL,
197-
IMX8M_AudioDSP_REG2_RUNSTALL);
197+
reset_control_assert(priv->run_stall);
198198

199199
/* Take the DSP out of reset and keep stalled for FW loading */
200200
pwrctl = readl(dap + IMX8M_DAP_PWRCTL);
@@ -231,13 +231,9 @@ static int imx8ulp_dsp_reset(struct imx_dsp_rproc *priv)
231231

232232
/* Specific configuration for i.MX8MP */
233233
static const struct imx_rproc_dcfg dsp_rproc_cfg_imx8mp = {
234-
.src_reg = IMX8M_AudioDSP_REG2,
235-
.src_mask = IMX8M_AudioDSP_REG2_RUNSTALL,
236-
.src_start = 0,
237-
.src_stop = IMX8M_AudioDSP_REG2_RUNSTALL,
238234
.att = imx_dsp_rproc_att_imx8mp,
239235
.att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8mp),
240-
.method = IMX_RPROC_MMIO,
236+
.method = IMX_RPROC_RESET_CONTROLLER,
241237
};
242238

243239
static const struct imx_dsp_rproc_dcfg imx_dsp_rproc_cfg_imx8mp = {
@@ -329,6 +325,9 @@ static int imx_dsp_rproc_start(struct rproc *rproc)
329325
true,
330326
rproc->bootaddr);
331327
break;
328+
case IMX_RPROC_RESET_CONTROLLER:
329+
ret = reset_control_deassert(priv->run_stall);
330+
break;
332331
default:
333332
return -EOPNOTSUPP;
334333
}
@@ -369,6 +368,9 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
369368
false,
370369
rproc->bootaddr);
371370
break;
371+
case IMX_RPROC_RESET_CONTROLLER:
372+
ret = reset_control_assert(priv->run_stall);
373+
break;
372374
default:
373375
return -EOPNOTSUPP;
374376
}
@@ -995,6 +997,13 @@ static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
995997

996998
priv->regmap = regmap;
997999
break;
1000+
case IMX_RPROC_RESET_CONTROLLER:
1001+
priv->run_stall = devm_reset_control_get_exclusive(dev, "runstall");
1002+
if (IS_ERR(priv->run_stall)) {
1003+
dev_err(dev, "Failed to get DSP runstall reset control\n");
1004+
return PTR_ERR(priv->run_stall);
1005+
}
1006+
break;
9981007
default:
9991008
ret = -EOPNOTSUPP;
10001009
break;

drivers/remoteproc/imx_rproc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ enum imx_rproc_method {
2424
IMX_RPROC_SMC,
2525
/* Through System Control Unit API */
2626
IMX_RPROC_SCU_API,
27+
/* Through Reset Controller API */
28+
IMX_RPROC_RESET_CONTROLLER,
2729
};
2830

2931
/* dcfg flags */

0 commit comments

Comments
 (0)