// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) // // This file is provided under a dual BSD/GPLv2 license. When using or // redistributing this file, you may do so under either license. // // Copyright(c) 2018-2022 Intel Corporation //
/* * This code is simplified by using one fragment of physical memory and assuming * all the code fits. This could be improved with scatter-gather but the firmware * size is limited by DSP memory anyways
*/
bdl[0] = cpu_to_le32(lower_32_bits(addr));
bdl[1] = cpu_to_le32(upper_32_bits(addr));
bdl[2] = cpu_to_le32(size);
bdl[3] = (!with_ioc) ? 0 : cpu_to_le32(0x01);
return1; /* one fragment */
}
staticvoid cl_skl_cldma_stream_run(struct snd_sof_dev *sdev, bool enable)
{ int sd_offset = SOF_HDA_ADSP_LOADER_BASE; unsignedchar val; int retries;
u32 run = enable ? 0x1 : 0;
/* waiting for hardware to report the stream Run bit set */
val = snd_sof_dsp_read(sdev, HDA_DSP_BAR,
sd_offset + SOF_HDA_ADSP_REG_SD_CTL);
val &= HDA_CL_SD_CTL_RUN(1); if (enable && val) break; elseif (!enable && !val) break;
} while (--retries);
if (retries == 0)
dev_err(sdev->dev, "%s: failed to set Run bit=%d enable=%d\n",
__func__, val, enable);
}
staticvoid cl_skl_cldma_stream_clear(struct snd_sof_dev *sdev)
{ int sd_offset = SOF_HDA_ADSP_LOADER_BASE;
/* make sure Run bit is cleared before setting stream register */
cl_skl_cldma_stream_run(sdev, 0);
/* Disable the Interrupt On Completion, FIFO Error Interrupt, * Descriptor Error Interrupt and set the cldma stream number to 0.
*/
snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR,
sd_offset + SOF_HDA_ADSP_REG_SD_CTL,
HDA_CL_SD_CTL_INT_MASK, HDA_CL_SD_CTL_INT(0));
snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR,
sd_offset + SOF_HDA_ADSP_REG_SD_CTL,
HDA_CL_SD_CTL_STRM(0xf), HDA_CL_SD_CTL_STRM(0));
/* Set the Cyclic Buffer Length to 0. */
snd_sof_dsp_write(sdev, HDA_DSP_BAR,
sd_offset + SOF_HDA_ADSP_REG_SD_CBL, 0); /* Set the Last Valid Index. */
snd_sof_dsp_write(sdev, HDA_DSP_BAR,
sd_offset + SOF_HDA_ADSP_REG_SD_LVI, 0);
}
/* check if the init_core is already enabled, if yes, reset and make it run, * if not, powerdown and enable it again.
*/ if (hda_dsp_core_is_enabled(sdev, chip->init_core_mask)) { /* if enabled, reset it, and run the init_core. */
ret = hda_dsp_core_stall_reset(sdev, chip->init_core_mask); if (ret < 0) goto err;
ret = hda_dsp_core_run(sdev, chip->init_core_mask); if (ret < 0) {
dev_err(sdev->dev, "%s: dsp core start failed %d\n", __func__, ret); goto err;
}
} else { /* if not enabled, power down it first and then powerup and run * the init_core.
*/
ret = hda_dsp_core_reset_power_down(sdev, chip->init_core_mask); if (ret < 0) {
dev_err(sdev->dev, "%s: dsp core0 disable fail: %d\n", __func__, ret); goto err;
}
ret = hda_dsp_enable_core(sdev, chip->init_core_mask); if (ret < 0) {
dev_err(sdev->dev, "%s: dsp core0 enable fail: %d\n", __func__, ret); goto err;
}
}
/* retry enabling core and ROM load. seemed to help */ if (ret < 0) {
ret = cl_dsp_init_skl(sdev, &dmab, &dmab_bdl); if (ret < 0) {
dev_err(sdev->dev, "Error code=%#x: FW status=%#x\n",
snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_ROM_ERROR),
snd_sof_dsp_read(sdev, HDA_DSP_BAR, chip->rom_status_reg));
dev_err(sdev->dev, "Core En/ROM load fail:%d\n", ret); return ret;
}
}
dev_dbg(sdev->dev, "ROM init successful\n");
/* at this point DSP ROM has been initialized and should be ready for * code loading and firmware boot
*/
ret = cl_copy_fw_skl(sdev, &dmab); if (ret < 0) {
dev_err(sdev->dev, "%s: load firmware failed : %d\n", __func__, ret); goto err;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.33Bemerkung:
(vorverarbeitet am 2026-06-07)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.