Skip to content

Commit 1c2af39

Browse files
committed
ASoC: SOF: imx8m: 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. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
1 parent 15b3016 commit 1c2af39

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

sound/soc/sof/imx/imx8.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/arm-smccc.h>
1212
#include <linux/firmware/imx/svc/misc.h>
1313
#include <linux/mfd/syscon.h>
14+
#include <linux/reset.h>
1415

1516
#include "imx-common.h"
1617

@@ -23,13 +24,6 @@
2324
#define IMX8M_DAP_PWRCTL (0x4000 + 0x3020)
2425
#define IMX8M_PWRCTL_CORERESET BIT(16)
2526

26-
#define AudioDSP_REG0 0x100
27-
#define AudioDSP_REG1 0x104
28-
#define AudioDSP_REG2 0x108
29-
#define AudioDSP_REG3 0x10c
30-
31-
#define AudioDSP_REG2_RUNSTALL BIT(5)
32-
3327
/* imx8ulp macros */
3428
#define FSL_SIP_HIFI_XRDC 0xc200000e
3529
#define SYSCTRL0 0x8
@@ -43,6 +37,7 @@
4337
struct imx8m_chip_data {
4438
void __iomem *dap;
4539
struct regmap *regmap;
40+
struct reset_control *run_stall;
4641
};
4742

4843
/*
@@ -137,8 +132,7 @@ static int imx8m_reset(struct snd_sof_dev *sdev)
137132
/* keep reset asserted for 10 cycles */
138133
usleep_range(1, 2);
139134

140-
regmap_update_bits(chip->regmap, AudioDSP_REG2,
141-
AudioDSP_REG2_RUNSTALL, AudioDSP_REG2_RUNSTALL);
135+
reset_control_assert(chip->run_stall);
142136

143137
/* take the DSP out of reset and keep stalled for FW loading */
144138
pwrctl = readl(chip->dap + IMX8M_DAP_PWRCTL);
@@ -152,9 +146,7 @@ static int imx8m_run(struct snd_sof_dev *sdev)
152146
{
153147
struct imx8m_chip_data *chip = get_chip_pdata(sdev);
154148

155-
regmap_update_bits(chip->regmap, AudioDSP_REG2, AudioDSP_REG2_RUNSTALL, 0);
156-
157-
return 0;
149+
return reset_control_deassert(chip->run_stall);
158150
}
159151

160152
static int imx8m_probe(struct snd_sof_dev *sdev)
@@ -174,10 +166,10 @@ static int imx8m_probe(struct snd_sof_dev *sdev)
174166
return dev_err_probe(sdev->dev, -ENODEV,
175167
"failed to ioremap DAP\n");
176168

177-
chip->regmap = syscon_regmap_lookup_by_phandle(sdev->dev->of_node, "fsl,dsp-ctrl");
178-
if (IS_ERR(chip->regmap))
179-
return dev_err_probe(sdev->dev, PTR_ERR(chip->regmap),
180-
"failed to fetch dsp ctrl regmap\n");
169+
chip->run_stall = devm_reset_control_get_exclusive(sdev->dev, "runstall");
170+
if (IS_ERR(chip->run_stall))
171+
return dev_err_probe(sdev->dev, PTR_ERR(chip->run_stall),
172+
"failed to get dsp runstall reset control\n");
181173

182174
common->chip_pdata = chip;
183175

0 commit comments

Comments
 (0)