Commit 53ec7531 authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Mark Brown

ASoC: SOF: Intel: hda: report error only for the last ROM init iteration

The FW boot sequence includes multiple attempts for ROM init.
When it does take more than one attempt, we should not log the
errors encountered during the failed attempts and only log them
during the final iteration.
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200825235040.1586478-2-ranjani.sridharan@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9db6f432
...@@ -79,7 +79,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format, ...@@ -79,7 +79,7 @@ static int cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format,
* reset/stall and then turn it off * reset/stall and then turn it off
*/ */
static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
u32 fwsize, int stream_tag) u32 fwsize, int stream_tag, int iteration)
{ {
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
const struct sof_intel_dsp_desc *chip = hda->desc; const struct sof_intel_dsp_desc *chip = hda->desc;
...@@ -90,7 +90,8 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, ...@@ -90,7 +90,8 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
/* step 1: power up corex */ /* step 1: power up corex */
ret = hda_dsp_core_power_up(sdev, chip->cores_mask); ret = hda_dsp_core_power_up(sdev, chip->cores_mask);
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n"); if (iteration == HDA_FW_BOOT_ATTEMPTS)
dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n");
goto err; goto err;
} }
...@@ -112,7 +113,9 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, ...@@ -112,7 +113,9 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
/* step 3: unset core 0 reset state & unstall/run core 0 */ /* step 3: unset core 0 reset state & unstall/run core 0 */
ret = hda_dsp_core_run(sdev, HDA_DSP_CORE_MASK(0)); ret = hda_dsp_core_run(sdev, HDA_DSP_CORE_MASK(0));
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: dsp core start failed %d\n", ret); if (iteration == HDA_FW_BOOT_ATTEMPTS)
dev_err(sdev->dev,
"error: dsp core start failed %d\n", ret);
ret = -EIO; ret = -EIO;
goto err; goto err;
} }
...@@ -126,8 +129,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, ...@@ -126,8 +129,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
HDA_DSP_INIT_TIMEOUT_US); HDA_DSP_INIT_TIMEOUT_US);
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: %s: timeout for HIPCIE done\n", if (iteration == HDA_FW_BOOT_ATTEMPTS)
__func__); dev_err(sdev->dev,
"error: %s: timeout for HIPCIE done\n",
__func__);
goto err; goto err;
} }
...@@ -141,7 +146,9 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, ...@@ -141,7 +146,9 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
ret = hda_dsp_core_power_down(sdev, ret = hda_dsp_core_power_down(sdev,
chip->cores_mask & ~(HDA_DSP_CORE_MASK(0))); chip->cores_mask & ~(HDA_DSP_CORE_MASK(0)));
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: dsp core x power down failed\n"); if (iteration == HDA_FW_BOOT_ATTEMPTS)
dev_err(sdev->dev,
"error: dsp core x power down failed\n");
goto err; goto err;
} }
...@@ -159,9 +166,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata, ...@@ -159,9 +166,10 @@ static int cl_dsp_init(struct snd_sof_dev *sdev, const void *fwdata,
if (!ret) if (!ret)
return 0; return 0;
dev_err(sdev->dev, if (iteration == HDA_FW_BOOT_ATTEMPTS)
"error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n", dev_err(sdev->dev,
__func__); "error: %s: timeout HDA_DSP_SRAM_REG_ROM_STATUS read\n",
__func__);
err: err:
hda_dsp_dump(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX); hda_dsp_dump(sdev, SOF_DBG_REGS | SOF_DBG_PCI | SOF_DBG_MBOX);
...@@ -329,25 +337,25 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) ...@@ -329,25 +337,25 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
/* try ROM init a few times before giving up */ /* try ROM init a few times before giving up */
for (i = 0; i < HDA_FW_BOOT_ATTEMPTS; i++) { for (i = 0; i < HDA_FW_BOOT_ATTEMPTS; i++) {
dev_dbg(sdev->dev,
"Attempting iteration %d of Core En/ROM load...\n", i);
ret = cl_dsp_init(sdev, stripped_firmware.data, ret = cl_dsp_init(sdev, stripped_firmware.data,
stripped_firmware.size, tag); stripped_firmware.size, tag, i + 1);
/* don't retry anymore if successful */ /* don't retry anymore if successful */
if (!ret) if (!ret)
break; break;
}
dev_dbg(sdev->dev, "iteration %d of Core En/ROM load failed: %d\n", if (i == HDA_FW_BOOT_ATTEMPTS) {
dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n",
i, ret); i, ret);
dev_dbg(sdev->dev, "Error code=0x%x: FW status=0x%x\n", dev_err(sdev->dev, "ROM error=0x%x: FW status=0x%x\n",
snd_sof_dsp_read(sdev, HDA_DSP_BAR, snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_DSP_SRAM_REG_ROM_ERROR), HDA_DSP_SRAM_REG_ROM_ERROR),
snd_sof_dsp_read(sdev, HDA_DSP_BAR, snd_sof_dsp_read(sdev, HDA_DSP_BAR,
HDA_DSP_SRAM_REG_ROM_STATUS)); HDA_DSP_SRAM_REG_ROM_STATUS));
}
if (i == HDA_FW_BOOT_ATTEMPTS) {
dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n",
i, ret);
goto cleanup; goto cleanup;
} }
......
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