Commit 024aa45f authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

ASoC: Intel: Allow for ROM init retry on CNL platforms

Due to unconditional initial timeouts, firmware may fail to load during
its initialization. This issue cannot be resolved on driver side as it
is caused by external sources such as CSME but has to be accounted for
nonetheless.

Fixes: cb6a5528 ("ASoC: Intel: cnl: Add sst library functions for cnl platform")
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-7-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9e6c382f
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
/* Delay before scheduling D0i3 entry */ /* Delay before scheduling D0i3 entry */
#define BXT_D0I3_DELAY 5000 #define BXT_D0I3_DELAY 5000
#define BXT_FW_ROM_INIT_RETRY 3
static unsigned int bxt_get_errorcode(struct sst_dsp *ctx) static unsigned int bxt_get_errorcode(struct sst_dsp *ctx)
{ {
return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE); return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE);
......
...@@ -109,7 +109,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) ...@@ -109,7 +109,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
{ {
struct firmware stripped_fw; struct firmware stripped_fw;
struct skl_dev *cnl = ctx->thread_context; struct skl_dev *cnl = ctx->thread_context;
int ret; int ret, i;
if (!ctx->fw) { if (!ctx->fw) {
ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev); ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev);
...@@ -131,12 +131,16 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) ...@@ -131,12 +131,16 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
stripped_fw.size = ctx->fw->size; stripped_fw.size = ctx->fw->size;
skl_dsp_strip_extended_manifest(&stripped_fw); skl_dsp_strip_extended_manifest(&stripped_fw);
ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size); for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) {
if (ret < 0) { ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
dev_err(ctx->dev, "prepare firmware failed: %d\n", ret); if (!ret)
goto cnl_load_base_firmware_failed; break;
dev_dbg(ctx->dev, "prepare firmware failed: %d\n", ret);
} }
if (ret < 0)
goto cnl_load_base_firmware_failed;
ret = sst_transfer_fw_host_dma(ctx); ret = sst_transfer_fw_host_dma(ctx);
if (ret < 0) { if (ret < 0) {
dev_err(ctx->dev, "transfer firmware failed: %d\n", ret); dev_err(ctx->dev, "transfer firmware failed: %d\n", ret);
...@@ -158,6 +162,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx) ...@@ -158,6 +162,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
return 0; return 0;
cnl_load_base_firmware_failed: cnl_load_base_firmware_failed:
dev_err(ctx->dev, "firmware load failed: %d\n", ret);
release_firmware(ctx->fw); release_firmware(ctx->fw);
ctx->fw = NULL; ctx->fw = NULL;
......
...@@ -67,6 +67,7 @@ struct skl_dev; ...@@ -67,6 +67,7 @@ struct skl_dev;
#define SKL_FW_INIT 0x1 #define SKL_FW_INIT 0x1
#define SKL_FW_RFW_START 0xf #define SKL_FW_RFW_START 0xf
#define BXT_FW_ROM_INIT_RETRY 3
#define SKL_ADSPIC_IPC 1 #define SKL_ADSPIC_IPC 1
#define SKL_ADSPIS_IPC 1 #define SKL_ADSPIS_IPC 1
......
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