Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Tested-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://patch.msgid.link/20250505114251.57018-1-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Daniel Baluta and committed by
Mark Brown
a71b261c 02ca7898

+8 -16
+8 -16
sound/soc/sof/imx/imx8.c
··· 11 11 #include <linux/arm-smccc.h> 12 12 #include <linux/firmware/imx/svc/misc.h> 13 13 #include <linux/mfd/syscon.h> 14 + #include <linux/reset.h> 14 15 15 16 #include "imx-common.h" 16 17 ··· 23 22 #define IMX8M_DAP_DEBUG_SIZE (64 * 1024) 24 23 #define IMX8M_DAP_PWRCTL (0x4000 + 0x3020) 25 24 #define IMX8M_PWRCTL_CORERESET BIT(16) 26 - 27 - #define AudioDSP_REG0 0x100 28 - #define AudioDSP_REG1 0x104 29 - #define AudioDSP_REG2 0x108 30 - #define AudioDSP_REG3 0x10c 31 - 32 - #define AudioDSP_REG2_RUNSTALL BIT(5) 33 25 34 26 /* imx8ulp macros */ 35 27 #define FSL_SIP_HIFI_XRDC 0xc200000e ··· 37 43 struct imx8m_chip_data { 38 44 void __iomem *dap; 39 45 struct regmap *regmap; 46 + struct reset_control *run_stall; 40 47 }; 41 48 42 49 /* ··· 132 137 /* keep reset asserted for 10 cycles */ 133 138 usleep_range(1, 2); 134 139 135 - regmap_update_bits(chip->regmap, AudioDSP_REG2, 136 - AudioDSP_REG2_RUNSTALL, AudioDSP_REG2_RUNSTALL); 140 + reset_control_assert(chip->run_stall); 137 141 138 142 /* take the DSP out of reset and keep stalled for FW loading */ 139 143 pwrctl = readl(chip->dap + IMX8M_DAP_PWRCTL); ··· 146 152 { 147 153 struct imx8m_chip_data *chip = get_chip_pdata(sdev); 148 154 149 - regmap_update_bits(chip->regmap, AudioDSP_REG2, AudioDSP_REG2_RUNSTALL, 0); 150 - 151 - return 0; 155 + return reset_control_deassert(chip->run_stall); 152 156 } 153 157 154 158 static int imx8m_probe(struct snd_sof_dev *sdev) ··· 166 174 return dev_err_probe(sdev->dev, -ENODEV, 167 175 "failed to ioremap DAP\n"); 168 176 169 - chip->regmap = syscon_regmap_lookup_by_phandle(sdev->dev->of_node, "fsl,dsp-ctrl"); 170 - if (IS_ERR(chip->regmap)) 171 - return dev_err_probe(sdev->dev, PTR_ERR(chip->regmap), 172 - "failed to fetch dsp ctrl regmap\n"); 177 + chip->run_stall = devm_reset_control_get_exclusive(sdev->dev, "runstall"); 178 + if (IS_ERR(chip->run_stall)) 179 + return dev_err_probe(sdev->dev, PTR_ERR(chip->run_stall), 180 + "failed to get dsp runstall reset control\n"); 173 181 174 182 common->chip_pdata = chip; 175 183