|
19 | 19 | #include <linux/pm_runtime.h>
|
20 | 20 | #include <linux/regmap.h>
|
21 | 21 | #include <linux/remoteproc.h>
|
| 22 | +#include <linux/reset.h> |
22 | 23 | #include <linux/slab.h>
|
23 | 24 |
|
24 | 25 | #include "imx_rproc.h"
|
@@ -111,6 +112,7 @@ enum imx_dsp_rp_mbox_messages {
|
111 | 112 | */
|
112 | 113 | struct imx_dsp_rproc {
|
113 | 114 | struct regmap *regmap;
|
| 115 | + struct reset_control *run_stall; |
114 | 116 | struct rproc *rproc;
|
115 | 117 | const struct imx_dsp_rproc_dcfg *dsp_dcfg;
|
116 | 118 | struct clk_bulk_data clks[DSP_RPROC_CLK_MAX];
|
@@ -192,9 +194,7 @@ static int imx8mp_dsp_reset(struct imx_dsp_rproc *priv)
|
192 | 194 | /* Keep reset asserted for 10 cycles */
|
193 | 195 | usleep_range(1, 2);
|
194 | 196 |
|
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); |
198 | 198 |
|
199 | 199 | /* Take the DSP out of reset and keep stalled for FW loading */
|
200 | 200 | pwrctl = readl(dap + IMX8M_DAP_PWRCTL);
|
@@ -231,13 +231,9 @@ static int imx8ulp_dsp_reset(struct imx_dsp_rproc *priv)
|
231 | 231 |
|
232 | 232 | /* Specific configuration for i.MX8MP */
|
233 | 233 | 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, |
238 | 234 | .att = imx_dsp_rproc_att_imx8mp,
|
239 | 235 | .att_size = ARRAY_SIZE(imx_dsp_rproc_att_imx8mp),
|
240 |
| - .method = IMX_RPROC_MMIO, |
| 236 | + .method = IMX_RPROC_RESET_CONTROLLER, |
241 | 237 | };
|
242 | 238 |
|
243 | 239 | 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)
|
329 | 325 | true,
|
330 | 326 | rproc->bootaddr);
|
331 | 327 | break;
|
| 328 | + case IMX_RPROC_RESET_CONTROLLER: |
| 329 | + ret = reset_control_deassert(priv->run_stall); |
| 330 | + break; |
332 | 331 | default:
|
333 | 332 | return -EOPNOTSUPP;
|
334 | 333 | }
|
@@ -369,6 +368,9 @@ static int imx_dsp_rproc_stop(struct rproc *rproc)
|
369 | 368 | false,
|
370 | 369 | rproc->bootaddr);
|
371 | 370 | break;
|
| 371 | + case IMX_RPROC_RESET_CONTROLLER: |
| 372 | + ret = reset_control_assert(priv->run_stall); |
| 373 | + break; |
372 | 374 | default:
|
373 | 375 | return -EOPNOTSUPP;
|
374 | 376 | }
|
@@ -995,6 +997,13 @@ static int imx_dsp_rproc_detect_mode(struct imx_dsp_rproc *priv)
|
995 | 997 |
|
996 | 998 | priv->regmap = regmap;
|
997 | 999 | 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; |
998 | 1007 | default:
|
999 | 1008 | ret = -EOPNOTSUPP;
|
1000 | 1009 | break;
|
|
0 commit comments