1e149ca29SPierre-Louis Bossart // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) 2d16046ffSLiam Girdwood // 3d16046ffSLiam Girdwood // This file is provided under a dual BSD/GPLv2 license. When using or 4d16046ffSLiam Girdwood // redistributing this file, you may do so under either license. 5d16046ffSLiam Girdwood // 6d16046ffSLiam Girdwood // Copyright(c) 2018 Intel Corporation. All rights reserved. 7d16046ffSLiam Girdwood // 8d16046ffSLiam Girdwood // Authors: Liam Girdwood <liam.r.girdwood@linux.intel.com> 9d16046ffSLiam Girdwood // Ranjani Sridharan <ranjani.sridharan@linux.intel.com> 10d16046ffSLiam Girdwood // Rander Wang <rander.wang@intel.com> 11d16046ffSLiam Girdwood // Keyon Jie <yang.jie@linux.intel.com> 12d16046ffSLiam Girdwood // 13d16046ffSLiam Girdwood 14d16046ffSLiam Girdwood /* 15d16046ffSLiam Girdwood * Hardware interface for HDA DSP code loader 16d16046ffSLiam Girdwood */ 17d16046ffSLiam Girdwood 18d16046ffSLiam Girdwood #include <linux/firmware.h> 19d16046ffSLiam Girdwood #include <sound/hdaudio_ext.h> 20acf705a4SRanjani Sridharan #include <sound/hda_register.h> 21d16046ffSLiam Girdwood #include <sound/sof.h> 223ab2c21eSPeter Ujfalusi #include <sound/sof/ipc4/header.h> 23edbaaadaSFred Oh #include "ext_manifest.h" 243ab2c21eSPeter Ujfalusi #include "../ipc4-priv.h" 25d16046ffSLiam Girdwood #include "../ops.h" 26d7a8fbd1SKeyon Jie #include "../sof-priv.h" 27d16046ffSLiam Girdwood #include "hda.h" 28d16046ffSLiam Girdwood 29a749d744SKeyon Jie static void hda_ssp_set_cbp_cfp(struct snd_sof_dev *sdev) 30a749d744SKeyon Jie { 31a749d744SKeyon Jie struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 32a749d744SKeyon Jie const struct sof_intel_dsp_desc *chip = hda->desc; 33a749d744SKeyon Jie int i; 34a749d744SKeyon Jie 35a749d744SKeyon Jie /* DSP is powered up, set all SSPs to clock consumer/codec provider mode */ 36a749d744SKeyon Jie for (i = 0; i < chip->ssp_count; i++) { 37a749d744SKeyon Jie snd_sof_dsp_update_bits_unlocked(sdev, HDA_DSP_BAR, 38a749d744SKeyon Jie chip->ssp_base_offset 39a749d744SKeyon Jie + i * SSP_DEV_MEM_SIZE 40a749d744SKeyon Jie + SSP_SSC1_OFFSET, 41a749d744SKeyon Jie SSP_SET_CBP_CFP, 42a749d744SKeyon Jie SSP_SET_CBP_CFP); 43a749d744SKeyon Jie } 44a749d744SKeyon Jie } 45a749d744SKeyon Jie 46b4e4c0b9SRanjani Sridharan struct hdac_ext_stream *hda_cl_stream_prepare(struct snd_sof_dev *sdev, unsigned int format, 47d16046ffSLiam Girdwood unsigned int size, struct snd_dma_buffer *dmab, 48d16046ffSLiam Girdwood int direction) 49d16046ffSLiam Girdwood { 507d88b960SPierre-Louis Bossart struct hdac_ext_stream *hext_stream; 51d16046ffSLiam Girdwood struct hdac_stream *hstream; 52d16046ffSLiam Girdwood struct pci_dev *pci = to_pci_dev(sdev->dev); 53d16046ffSLiam Girdwood int ret; 54d16046ffSLiam Girdwood 557d88b960SPierre-Louis Bossart hext_stream = hda_dsp_stream_get(sdev, direction, 0); 56d16046ffSLiam Girdwood 577d88b960SPierre-Louis Bossart if (!hext_stream) { 58d16046ffSLiam Girdwood dev_err(sdev->dev, "error: no stream available\n"); 5901d42d5aSRanjani Sridharan return ERR_PTR(-ENODEV); 60d16046ffSLiam Girdwood } 617d88b960SPierre-Louis Bossart hstream = &hext_stream->hstream; 624ff5f643SKai Vehmanen hstream->substream = NULL; 63d16046ffSLiam Girdwood 64d16046ffSLiam Girdwood /* allocate DMA buffer */ 65d16046ffSLiam Girdwood ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV_SG, &pci->dev, size, dmab); 66d16046ffSLiam Girdwood if (ret < 0) { 67ce1f55baSCurtis Malainey dev_err(sdev->dev, "error: memory alloc failed: %d\n", ret); 68b7fb0ae0SAmmar Faizi goto out_put; 69d16046ffSLiam Girdwood } 70d16046ffSLiam Girdwood 71d16046ffSLiam Girdwood hstream->period_bytes = 0;/* initialize period_bytes */ 72d16046ffSLiam Girdwood hstream->format_val = format; 73d16046ffSLiam Girdwood hstream->bufsize = size; 74d16046ffSLiam Girdwood 75acf705a4SRanjani Sridharan if (direction == SNDRV_PCM_STREAM_CAPTURE) { 767d88b960SPierre-Louis Bossart ret = hda_dsp_iccmax_stream_hw_params(sdev, hext_stream, dmab, NULL); 77acf705a4SRanjani Sridharan if (ret < 0) { 78ce1f55baSCurtis Malainey dev_err(sdev->dev, "error: iccmax stream prepare failed: %d\n", ret); 79b7fb0ae0SAmmar Faizi goto out_free; 80acf705a4SRanjani Sridharan } 81acf705a4SRanjani Sridharan } else { 827d88b960SPierre-Louis Bossart ret = hda_dsp_stream_hw_params(sdev, hext_stream, dmab, NULL); 83d16046ffSLiam Girdwood if (ret < 0) { 84ce1f55baSCurtis Malainey dev_err(sdev->dev, "error: hdac prepare failed: %d\n", ret); 85b7fb0ae0SAmmar Faizi goto out_free; 86d16046ffSLiam Girdwood } 877d88b960SPierre-Louis Bossart hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_ENABLE, size); 88acf705a4SRanjani Sridharan } 89d16046ffSLiam Girdwood 907d88b960SPierre-Louis Bossart return hext_stream; 91d16046ffSLiam Girdwood 92b7fb0ae0SAmmar Faizi out_free: 93d16046ffSLiam Girdwood snd_dma_free_pages(dmab); 94b7fb0ae0SAmmar Faizi out_put: 95b7fb0ae0SAmmar Faizi hda_dsp_stream_put(sdev, direction, hstream->stream_tag); 9601d42d5aSRanjani Sridharan return ERR_PTR(ret); 97d16046ffSLiam Girdwood } 98d16046ffSLiam Girdwood 99d16046ffSLiam Girdwood /* 1004643e10aSPeter Ujfalusi * first boot sequence has some extra steps. 1014643e10aSPeter Ujfalusi * power on all host managed cores and only unstall/run the boot core to boot the 1024643e10aSPeter Ujfalusi * DSP then turn off all non boot cores (if any) is powered on. 103d16046ffSLiam Girdwood */ 104ab222a4aSBard Liao int cl_dsp_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot) 105d16046ffSLiam Girdwood { 106d16046ffSLiam Girdwood struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 107d16046ffSLiam Girdwood const struct sof_intel_dsp_desc *chip = hda->desc; 1082a68ff84SPeter Ujfalusi unsigned int status, target_status; 1092a68ff84SPeter Ujfalusi u32 flags, ipc_hdr, j; 110d4165199SRanjani Sridharan unsigned long mask; 1112f148430SPeter Ujfalusi char *dump_msg; 112d16046ffSLiam Girdwood int ret; 113d16046ffSLiam Girdwood 114d16046ffSLiam Girdwood /* step 1: power up corex */ 115fcb3c775SPeter Ujfalusi ret = hda_dsp_core_power_up(sdev, chip->host_managed_cores_mask); 116d16046ffSLiam Girdwood if (ret < 0) { 117776100a4SPierre-Louis Bossart if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) 118d16046ffSLiam Girdwood dev_err(sdev->dev, "error: dsp core 0/1 power up failed\n"); 119d16046ffSLiam Girdwood goto err; 120d16046ffSLiam Girdwood } 121d16046ffSLiam Girdwood 122a749d744SKeyon Jie hda_ssp_set_cbp_cfp(sdev); 12374ed4097SZhu Yingjiang 1242a68ff84SPeter Ujfalusi /* step 2: Send ROM_CONTROL command (stream_tag is ignored for IMR boot) */ 1252a68ff84SPeter Ujfalusi ipc_hdr = chip->ipc_req_mask | HDA_DSP_ROM_IPC_CONTROL; 1262a68ff84SPeter Ujfalusi if (!imr_boot) 1272a68ff84SPeter Ujfalusi ipc_hdr |= HDA_DSP_ROM_IPC_PURGE_FW | ((stream_tag - 1) << 9); 1282a68ff84SPeter Ujfalusi 1292a68ff84SPeter Ujfalusi snd_sof_dsp_write(sdev, HDA_DSP_BAR, chip->ipc_req, ipc_hdr); 130d16046ffSLiam Girdwood 131d16046ffSLiam Girdwood /* step 3: unset core 0 reset state & unstall/run core 0 */ 1324643e10aSPeter Ujfalusi ret = hda_dsp_core_run(sdev, chip->init_core_mask); 133d16046ffSLiam Girdwood if (ret < 0) { 134776100a4SPierre-Louis Bossart if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) 13553ec7531SRanjani Sridharan dev_err(sdev->dev, 13653ec7531SRanjani Sridharan "error: dsp core start failed %d\n", ret); 137d16046ffSLiam Girdwood ret = -EIO; 138d16046ffSLiam Girdwood goto err; 139d16046ffSLiam Girdwood } 140d16046ffSLiam Girdwood 141d16046ffSLiam Girdwood /* step 4: wait for IPC DONE bit from ROM */ 142d16046ffSLiam Girdwood ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, 143d16046ffSLiam Girdwood chip->ipc_ack, status, 144d16046ffSLiam Girdwood ((status & chip->ipc_ack_mask) 145d16046ffSLiam Girdwood == chip->ipc_ack_mask), 146d16046ffSLiam Girdwood HDA_DSP_REG_POLL_INTERVAL_US, 147d16046ffSLiam Girdwood HDA_DSP_INIT_TIMEOUT_US); 148d16046ffSLiam Girdwood 149d16046ffSLiam Girdwood if (ret < 0) { 150776100a4SPierre-Louis Bossart if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) 15153ec7531SRanjani Sridharan dev_err(sdev->dev, 15253ec7531SRanjani Sridharan "error: %s: timeout for HIPCIE done\n", 1536a414489SPierre-Louis Bossart __func__); 154d16046ffSLiam Girdwood goto err; 155d16046ffSLiam Girdwood } 156d16046ffSLiam Girdwood 1578354d9b4SKeyon Jie /* set DONE bit to clear the reply IPC message */ 1588354d9b4SKeyon Jie snd_sof_dsp_update_bits_forced(sdev, HDA_DSP_BAR, 1598354d9b4SKeyon Jie chip->ipc_ack, 1608354d9b4SKeyon Jie chip->ipc_ack_mask, 1618354d9b4SKeyon Jie chip->ipc_ack_mask); 1628354d9b4SKeyon Jie 163cedd502dSBard Liao /* step 5: power down cores that are no longer needed */ 164d4165199SRanjani Sridharan ret = hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask & 165cedd502dSBard Liao ~(chip->init_core_mask)); 166d16046ffSLiam Girdwood if (ret < 0) { 167776100a4SPierre-Louis Bossart if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) 16853ec7531SRanjani Sridharan dev_err(sdev->dev, 16953ec7531SRanjani Sridharan "error: dsp core x power down failed\n"); 170d16046ffSLiam Girdwood goto err; 171d16046ffSLiam Girdwood } 172d16046ffSLiam Girdwood 173d16046ffSLiam Girdwood /* step 6: enable IPC interrupts */ 174d16046ffSLiam Girdwood hda_dsp_ipc_int_enable(sdev); 175d16046ffSLiam Girdwood 1762a68ff84SPeter Ujfalusi /* 1772a68ff84SPeter Ujfalusi * step 7: 1782a68ff84SPeter Ujfalusi * - Cold/Full boot: wait for ROM init to proceed to download the firmware 1792a68ff84SPeter Ujfalusi * - IMR boot: wait for ROM firmware entered (firmware booted up from IMR) 1802a68ff84SPeter Ujfalusi */ 1812a68ff84SPeter Ujfalusi if (imr_boot) 18243a03d24SPeter Ujfalusi target_status = FSR_STATE_FW_ENTERED; 1832a68ff84SPeter Ujfalusi else 18443a03d24SPeter Ujfalusi target_status = FSR_STATE_INIT_DONE; 1852a68ff84SPeter Ujfalusi 186d16046ffSLiam Girdwood ret = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, 18771778f79SRanjani Sridharan chip->rom_status_reg, status, 18843a03d24SPeter Ujfalusi (FSR_TO_STATE_CODE(status) == target_status), 189d16046ffSLiam Girdwood HDA_DSP_REG_POLL_INTERVAL_US, 190d16046ffSLiam Girdwood chip->rom_init_timeout * 191d16046ffSLiam Girdwood USEC_PER_MSEC); 192d4165199SRanjani Sridharan if (!ret) { 193d4165199SRanjani Sridharan /* set enabled cores mask and increment ref count for cores in init_core_mask */ 194d4165199SRanjani Sridharan sdev->enabled_cores_mask |= chip->init_core_mask; 195d4165199SRanjani Sridharan mask = sdev->enabled_cores_mask; 196d4165199SRanjani Sridharan for_each_set_bit(j, &mask, SOF_MAX_DSP_NUM_CORES) 197d4165199SRanjani Sridharan sdev->dsp_core_ref_count[j]++; 198d16046ffSLiam Girdwood return 0; 199d4165199SRanjani Sridharan } 200d16046ffSLiam Girdwood 201776100a4SPierre-Louis Bossart if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) 2026a414489SPierre-Louis Bossart dev_err(sdev->dev, 20371778f79SRanjani Sridharan "%s: timeout with rom_status_reg (%#x) read\n", 20471778f79SRanjani Sridharan __func__, chip->rom_status_reg); 2056a414489SPierre-Louis Bossart 206d16046ffSLiam Girdwood err: 2077511b0edSPeter Ujfalusi flags = SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX | SOF_DBG_DUMP_OPTIONAL; 2088f7ef6fcSRanjani Sridharan 20923013335SPeter Ujfalusi /* after max boot attempts make sure that the dump is printed */ 21023013335SPeter Ujfalusi if (hda->boot_iteration == HDA_FW_BOOT_ATTEMPTS) 2110ecaa2ffSPeter Ujfalusi flags &= ~SOF_DBG_DUMP_OPTIONAL; 2128f7ef6fcSRanjani Sridharan 2132f148430SPeter Ujfalusi dump_msg = kasprintf(GFP_KERNEL, "Boot iteration failed: %d/%d", 2142f148430SPeter Ujfalusi hda->boot_iteration, HDA_FW_BOOT_ATTEMPTS); 2152f148430SPeter Ujfalusi snd_sof_dsp_dbg_dump(sdev, dump_msg, flags); 216d4165199SRanjani Sridharan hda_dsp_core_reset_power_down(sdev, chip->host_managed_cores_mask); 217d16046ffSLiam Girdwood 2182f148430SPeter Ujfalusi kfree(dump_msg); 219d16046ffSLiam Girdwood return ret; 220d16046ffSLiam Girdwood } 221d16046ffSLiam Girdwood 222d16046ffSLiam Girdwood static int cl_trigger(struct snd_sof_dev *sdev, 2237d88b960SPierre-Louis Bossart struct hdac_ext_stream *hext_stream, int cmd) 224d16046ffSLiam Girdwood { 2257d88b960SPierre-Louis Bossart struct hdac_stream *hstream = &hext_stream->hstream; 226d16046ffSLiam Girdwood int sd_offset = SOF_STREAM_SD_OFFSET(hstream); 227d16046ffSLiam Girdwood 228d16046ffSLiam Girdwood /* code loader is special case that reuses stream ops */ 229d16046ffSLiam Girdwood switch (cmd) { 230d16046ffSLiam Girdwood case SNDRV_PCM_TRIGGER_START: 231d16046ffSLiam Girdwood snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, SOF_HDA_INTCTL, 232d16046ffSLiam Girdwood 1 << hstream->index, 233d16046ffSLiam Girdwood 1 << hstream->index); 234d16046ffSLiam Girdwood 235d16046ffSLiam Girdwood snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, 236d16046ffSLiam Girdwood sd_offset, 237d16046ffSLiam Girdwood SOF_HDA_SD_CTL_DMA_START | 238d16046ffSLiam Girdwood SOF_HDA_CL_DMA_SD_INT_MASK, 239d16046ffSLiam Girdwood SOF_HDA_SD_CTL_DMA_START | 240d16046ffSLiam Girdwood SOF_HDA_CL_DMA_SD_INT_MASK); 241d16046ffSLiam Girdwood 242d16046ffSLiam Girdwood hstream->running = true; 243d16046ffSLiam Girdwood return 0; 244d16046ffSLiam Girdwood default: 2457d88b960SPierre-Louis Bossart return hda_dsp_stream_trigger(sdev, hext_stream, cmd); 246d16046ffSLiam Girdwood } 247d16046ffSLiam Girdwood } 248d16046ffSLiam Girdwood 249b4e4c0b9SRanjani Sridharan int hda_cl_cleanup(struct snd_sof_dev *sdev, struct snd_dma_buffer *dmab, 2507d88b960SPierre-Louis Bossart struct hdac_ext_stream *hext_stream) 251d16046ffSLiam Girdwood { 2527d88b960SPierre-Louis Bossart struct hdac_stream *hstream = &hext_stream->hstream; 253d16046ffSLiam Girdwood int sd_offset = SOF_STREAM_SD_OFFSET(hstream); 254acf705a4SRanjani Sridharan int ret = 0; 255d16046ffSLiam Girdwood 256acf705a4SRanjani Sridharan if (hstream->direction == SNDRV_PCM_STREAM_PLAYBACK) 2577d88b960SPierre-Louis Bossart ret = hda_dsp_stream_spib_config(sdev, hext_stream, HDA_DSP_SPIB_DISABLE, 0); 258acf705a4SRanjani Sridharan else 259acf705a4SRanjani Sridharan snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR, sd_offset, 260acf705a4SRanjani Sridharan SOF_HDA_SD_CTL_DMA_START, 0); 261d16046ffSLiam Girdwood 262acf705a4SRanjani Sridharan hda_dsp_stream_put(sdev, hstream->direction, hstream->stream_tag); 263d16046ffSLiam Girdwood hstream->running = 0; 264d16046ffSLiam Girdwood hstream->substream = NULL; 265d16046ffSLiam Girdwood 266d16046ffSLiam Girdwood /* reset BDL address */ 267d16046ffSLiam Girdwood snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, 26838bf0780SPierre-Louis Bossart sd_offset + SOF_HDA_ADSP_REG_SD_BDLPL, 0); 269d16046ffSLiam Girdwood snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, 27038bf0780SPierre-Louis Bossart sd_offset + SOF_HDA_ADSP_REG_SD_BDLPU, 0); 271d16046ffSLiam Girdwood 272d16046ffSLiam Girdwood snd_sof_dsp_write(sdev, HDA_DSP_HDA_BAR, sd_offset, 0); 273d16046ffSLiam Girdwood snd_dma_free_pages(dmab); 274d16046ffSLiam Girdwood dmab->area = NULL; 275d16046ffSLiam Girdwood hstream->bufsize = 0; 276d16046ffSLiam Girdwood hstream->format_val = 0; 277d16046ffSLiam Girdwood 278d16046ffSLiam Girdwood return ret; 279d16046ffSLiam Girdwood } 280d16046ffSLiam Girdwood 281b4e4c0b9SRanjani Sridharan int hda_cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream) 282d16046ffSLiam Girdwood { 28371778f79SRanjani Sridharan struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 28471778f79SRanjani Sridharan const struct sof_intel_dsp_desc *chip = hda->desc; 285d16046ffSLiam Girdwood unsigned int reg; 286d16046ffSLiam Girdwood int ret, status; 287d16046ffSLiam Girdwood 2887d88b960SPierre-Louis Bossart ret = cl_trigger(sdev, hext_stream, SNDRV_PCM_TRIGGER_START); 289d16046ffSLiam Girdwood if (ret < 0) { 290d16046ffSLiam Girdwood dev_err(sdev->dev, "error: DMA trigger start failed\n"); 291d16046ffSLiam Girdwood return ret; 292d16046ffSLiam Girdwood } 293d16046ffSLiam Girdwood 294d16046ffSLiam Girdwood status = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR, 29571778f79SRanjani Sridharan chip->rom_status_reg, reg, 29643a03d24SPeter Ujfalusi (FSR_TO_STATE_CODE(reg) == FSR_STATE_FW_ENTERED), 297d16046ffSLiam Girdwood HDA_DSP_REG_POLL_INTERVAL_US, 298d16046ffSLiam Girdwood HDA_DSP_BASEFW_TIMEOUT_US); 299d16046ffSLiam Girdwood 30076dc6a2bSPierre-Louis Bossart /* 30176dc6a2bSPierre-Louis Bossart * even in case of errors we still need to stop the DMAs, 30276dc6a2bSPierre-Louis Bossart * but we return the initial error should the DMA stop also fail 30376dc6a2bSPierre-Louis Bossart */ 30476dc6a2bSPierre-Louis Bossart 3056a414489SPierre-Louis Bossart if (status < 0) { 3066a414489SPierre-Louis Bossart dev_err(sdev->dev, 30771778f79SRanjani Sridharan "%s: timeout with rom_status_reg (%#x) read\n", 30871778f79SRanjani Sridharan __func__, chip->rom_status_reg); 3096a414489SPierre-Louis Bossart } 3106a414489SPierre-Louis Bossart 3117d88b960SPierre-Louis Bossart ret = cl_trigger(sdev, hext_stream, SNDRV_PCM_TRIGGER_STOP); 312d16046ffSLiam Girdwood if (ret < 0) { 313d16046ffSLiam Girdwood dev_err(sdev->dev, "error: DMA trigger stop failed\n"); 31476dc6a2bSPierre-Louis Bossart if (!status) 31576dc6a2bSPierre-Louis Bossart status = ret; 316d16046ffSLiam Girdwood } 317d16046ffSLiam Girdwood 318d16046ffSLiam Girdwood return status; 319d16046ffSLiam Girdwood } 320d16046ffSLiam Girdwood 321acf705a4SRanjani Sridharan int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) 322acf705a4SRanjani Sridharan { 323acf705a4SRanjani Sridharan struct hdac_ext_stream *iccmax_stream; 324ea5ffef0SPeter Ujfalusi struct snd_dma_buffer dmab_bdl; 325acf705a4SRanjani Sridharan int ret, ret1; 326acf705a4SRanjani Sridharan u8 original_gb; 327acf705a4SRanjani Sridharan 328acf705a4SRanjani Sridharan /* save the original LTRP guardband value */ 329*1d045d77SPierre-Louis Bossart original_gb = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, HDA_VS_INTEL_LTRP) & 330*1d045d77SPierre-Louis Bossart HDA_VS_INTEL_LTRP_GB_MASK; 331acf705a4SRanjani Sridharan 33236c6cdc0SKai Vehmanen /* 33336c6cdc0SKai Vehmanen * Prepare capture stream for ICCMAX. We do not need to store 33436c6cdc0SKai Vehmanen * the data, so use a buffer of PAGE_SIZE for receiving. 33536c6cdc0SKai Vehmanen */ 33636c6cdc0SKai Vehmanen iccmax_stream = hda_cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, PAGE_SIZE, 337ea5ffef0SPeter Ujfalusi &dmab_bdl, SNDRV_PCM_STREAM_CAPTURE); 33801d42d5aSRanjani Sridharan if (IS_ERR(iccmax_stream)) { 33901d42d5aSRanjani Sridharan dev_err(sdev->dev, "error: dma prepare for ICCMAX stream failed\n"); 34001d42d5aSRanjani Sridharan return PTR_ERR(iccmax_stream); 341acf705a4SRanjani Sridharan } 342acf705a4SRanjani Sridharan 343acf705a4SRanjani Sridharan ret = hda_dsp_cl_boot_firmware(sdev); 344acf705a4SRanjani Sridharan 345acf705a4SRanjani Sridharan /* 346acf705a4SRanjani Sridharan * Perform iccmax stream cleanup. This should be done even if firmware loading fails. 347acf705a4SRanjani Sridharan * If the cleanup also fails, we return the initial error 348acf705a4SRanjani Sridharan */ 349b4e4c0b9SRanjani Sridharan ret1 = hda_cl_cleanup(sdev, &dmab_bdl, iccmax_stream); 350acf705a4SRanjani Sridharan if (ret1 < 0) { 351acf705a4SRanjani Sridharan dev_err(sdev->dev, "error: ICCMAX stream cleanup failed\n"); 352acf705a4SRanjani Sridharan 353acf705a4SRanjani Sridharan /* set return value to indicate cleanup failure */ 354acf705a4SRanjani Sridharan if (!ret) 355acf705a4SRanjani Sridharan ret = ret1; 356acf705a4SRanjani Sridharan } 357acf705a4SRanjani Sridharan 358acf705a4SRanjani Sridharan /* restore the original guardband value after FW boot */ 359*1d045d77SPierre-Louis Bossart snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, HDA_VS_INTEL_LTRP, 360*1d045d77SPierre-Louis Bossart HDA_VS_INTEL_LTRP_GB_MASK, original_gb); 361acf705a4SRanjani Sridharan 362acf705a4SRanjani Sridharan return ret; 363acf705a4SRanjani Sridharan } 364acf705a4SRanjani Sridharan 3655fb5f511SKeyon Jie static int hda_dsp_boot_imr(struct snd_sof_dev *sdev) 3665fb5f511SKeyon Jie { 367ab222a4aSBard Liao const struct sof_intel_dsp_desc *chip_info; 3685fb5f511SKeyon Jie int ret; 3695fb5f511SKeyon Jie 370ab222a4aSBard Liao chip_info = get_chip_info(sdev->pdata); 371ab222a4aSBard Liao if (chip_info->cl_init) 372ab222a4aSBard Liao ret = chip_info->cl_init(sdev, 0, true); 373ab222a4aSBard Liao else 374ab222a4aSBard Liao ret = -EINVAL; 375ab222a4aSBard Liao 376fd2cea16SPeter Ujfalusi if (!ret) 3775fb5f511SKeyon Jie hda_sdw_process_wakeen(sdev); 3785fb5f511SKeyon Jie 3795fb5f511SKeyon Jie return ret; 3805fb5f511SKeyon Jie } 3815fb5f511SKeyon Jie 382d16046ffSLiam Girdwood int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) 383d16046ffSLiam Girdwood { 384776100a4SPierre-Louis Bossart struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 385d16046ffSLiam Girdwood struct snd_sof_pdata *plat_data = sdev->pdata; 386d16046ffSLiam Girdwood const struct sof_dev_desc *desc = plat_data->desc; 387d16046ffSLiam Girdwood const struct sof_intel_dsp_desc *chip_info; 3887d88b960SPierre-Louis Bossart struct hdac_ext_stream *hext_stream; 389d16046ffSLiam Girdwood struct firmware stripped_firmware; 390ea5ffef0SPeter Ujfalusi struct snd_dma_buffer dmab; 39101d42d5aSRanjani Sridharan int ret, ret1, i; 392d16046ffSLiam Girdwood 39357724db1SPeter Ujfalusi if (hda->imrboot_supported && !sdev->first_boot && !hda->skip_imr_boot) { 3945fb5f511SKeyon Jie dev_dbg(sdev->dev, "IMR restore supported, booting from IMR directly\n"); 3952a68ff84SPeter Ujfalusi hda->boot_iteration = 0; 3962a68ff84SPeter Ujfalusi ret = hda_dsp_boot_imr(sdev); 3975d5d915bSPeter Ujfalusi if (!ret) { 3985d5d915bSPeter Ujfalusi hda->booted_from_imr = true; 399fd2cea16SPeter Ujfalusi return 0; 4005d5d915bSPeter Ujfalusi } 4012a68ff84SPeter Ujfalusi 4022a68ff84SPeter Ujfalusi dev_warn(sdev->dev, "IMR restore failed, trying to cold boot\n"); 4035fb5f511SKeyon Jie } 4045fb5f511SKeyon Jie 4055d5d915bSPeter Ujfalusi hda->booted_from_imr = false; 4065d5d915bSPeter Ujfalusi 407d16046ffSLiam Girdwood chip_info = desc->chip_info; 408d16046ffSLiam Girdwood 409410a321cSPeter Ujfalusi if (sdev->basefw.fw->size <= sdev->basefw.payload_offset) { 41092be17a5SKarol Trzcinski dev_err(sdev->dev, "error: firmware size must be greater than firmware offset\n"); 41192be17a5SKarol Trzcinski return -EINVAL; 41292be17a5SKarol Trzcinski } 41392be17a5SKarol Trzcinski 414410a321cSPeter Ujfalusi stripped_firmware.data = sdev->basefw.fw->data + sdev->basefw.payload_offset; 415410a321cSPeter Ujfalusi stripped_firmware.size = sdev->basefw.fw->size - sdev->basefw.payload_offset; 416d16046ffSLiam Girdwood 417d16046ffSLiam Girdwood /* init for booting wait */ 418d16046ffSLiam Girdwood init_waitqueue_head(&sdev->boot_wait); 419d16046ffSLiam Girdwood 420d16046ffSLiam Girdwood /* prepare DMA for code loader stream */ 421b4e4c0b9SRanjani Sridharan hext_stream = hda_cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, 422b4e4c0b9SRanjani Sridharan stripped_firmware.size, 423ea5ffef0SPeter Ujfalusi &dmab, SNDRV_PCM_STREAM_PLAYBACK); 4247d88b960SPierre-Louis Bossart if (IS_ERR(hext_stream)) { 42501d42d5aSRanjani Sridharan dev_err(sdev->dev, "error: dma prepare for fw loading failed\n"); 4267d88b960SPierre-Louis Bossart return PTR_ERR(hext_stream); 427d16046ffSLiam Girdwood } 428d16046ffSLiam Girdwood 429ea5ffef0SPeter Ujfalusi memcpy(dmab.area, stripped_firmware.data, 430d16046ffSLiam Girdwood stripped_firmware.size); 431d16046ffSLiam Girdwood 432d16046ffSLiam Girdwood /* try ROM init a few times before giving up */ 433d16046ffSLiam Girdwood for (i = 0; i < HDA_FW_BOOT_ATTEMPTS; i++) { 43453ec7531SRanjani Sridharan dev_dbg(sdev->dev, 43553ec7531SRanjani Sridharan "Attempting iteration %d of Core En/ROM load...\n", i); 43653ec7531SRanjani Sridharan 437776100a4SPierre-Louis Bossart hda->boot_iteration = i + 1; 438ab222a4aSBard Liao if (chip_info->cl_init) 439ab222a4aSBard Liao ret = chip_info->cl_init(sdev, hext_stream->hstream.stream_tag, false); 440ab222a4aSBard Liao else 441ab222a4aSBard Liao ret = -EINVAL; 442d16046ffSLiam Girdwood 443d16046ffSLiam Girdwood /* don't retry anymore if successful */ 444d16046ffSLiam Girdwood if (!ret) 445d16046ffSLiam Girdwood break; 446d16046ffSLiam Girdwood } 447d16046ffSLiam Girdwood 448d16046ffSLiam Girdwood if (i == HDA_FW_BOOT_ATTEMPTS) { 449d16046ffSLiam Girdwood dev_err(sdev->dev, "error: dsp init failed after %d attempts with err: %d\n", 450d16046ffSLiam Girdwood i, ret); 451d16046ffSLiam Girdwood goto cleanup; 452d16046ffSLiam Girdwood } 453d16046ffSLiam Girdwood 454d16046ffSLiam Girdwood /* 455bbd19cdcSRander Wang * When a SoundWire link is in clock stop state, a Slave 456bbd19cdcSRander Wang * device may trigger in-band wakes for events such as jack 457bbd19cdcSRander Wang * insertion or acoustic event detection. This event will lead 458bbd19cdcSRander Wang * to a WAKEEN interrupt, handled by the PCI device and routed 459bbd19cdcSRander Wang * to PME if the PCI device is in D3. The resume function in 460bbd19cdcSRander Wang * audio PCI driver will be invoked by ACPI for PME event and 461bbd19cdcSRander Wang * initialize the device and process WAKEEN interrupt. 462bbd19cdcSRander Wang * 463bbd19cdcSRander Wang * The WAKEEN interrupt should be processed ASAP to prevent an 464bbd19cdcSRander Wang * interrupt flood, otherwise other interrupts, such IPC, 465bbd19cdcSRander Wang * cannot work normally. The WAKEEN is handled after the ROM 466bbd19cdcSRander Wang * is initialized successfully, which ensures power rails are 467bbd19cdcSRander Wang * enabled before accessing the SoundWire SHIM registers 468bbd19cdcSRander Wang */ 469bbd19cdcSRander Wang if (!sdev->first_boot) 470bbd19cdcSRander Wang hda_sdw_process_wakeen(sdev); 471bbd19cdcSRander Wang 472bbd19cdcSRander Wang /* 473b2b10aa7SPeter Ujfalusi * Set the boot_iteration to the last attempt, indicating that the 474b2b10aa7SPeter Ujfalusi * DSP ROM has been initialized and from this point there will be no 475b2b10aa7SPeter Ujfalusi * retry done to boot. 476b2b10aa7SPeter Ujfalusi * 477b2b10aa7SPeter Ujfalusi * Continue with code loading and firmware boot 478d16046ffSLiam Girdwood */ 479b2b10aa7SPeter Ujfalusi hda->boot_iteration = HDA_FW_BOOT_ATTEMPTS; 480b4e4c0b9SRanjani Sridharan ret = hda_cl_copy_fw(sdev, hext_stream); 48157724db1SPeter Ujfalusi if (!ret) { 482d16046ffSLiam Girdwood dev_dbg(sdev->dev, "Firmware download successful, booting...\n"); 48357724db1SPeter Ujfalusi hda->skip_imr_boot = false; 48457724db1SPeter Ujfalusi } else { 4852f148430SPeter Ujfalusi snd_sof_dsp_dbg_dump(sdev, "Firmware download failed", 4862f148430SPeter Ujfalusi SOF_DBG_DUMP_PCI | SOF_DBG_DUMP_MBOX); 48757724db1SPeter Ujfalusi hda->skip_imr_boot = true; 48857724db1SPeter Ujfalusi } 489d16046ffSLiam Girdwood 490d16046ffSLiam Girdwood cleanup: 491d16046ffSLiam Girdwood /* 492d16046ffSLiam Girdwood * Perform codeloader stream cleanup. 493d16046ffSLiam Girdwood * This should be done even if firmware loading fails. 49476dc6a2bSPierre-Louis Bossart * If the cleanup also fails, we return the initial error 495d16046ffSLiam Girdwood */ 496b4e4c0b9SRanjani Sridharan ret1 = hda_cl_cleanup(sdev, &dmab, hext_stream); 497d16046ffSLiam Girdwood if (ret1 < 0) { 498d16046ffSLiam Girdwood dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); 499d16046ffSLiam Girdwood 500d16046ffSLiam Girdwood /* set return value to indicate cleanup failure */ 50176dc6a2bSPierre-Louis Bossart if (!ret) 502d16046ffSLiam Girdwood ret = ret1; 503d16046ffSLiam Girdwood } 504d16046ffSLiam Girdwood 505d16046ffSLiam Girdwood /* 50652e4d0aeSPierre-Louis Bossart * return primary core id if both fw copy 507d16046ffSLiam Girdwood * and stream clean up are successful 508d16046ffSLiam Girdwood */ 509d16046ffSLiam Girdwood if (!ret) 510d16046ffSLiam Girdwood return chip_info->init_core_mask; 511d16046ffSLiam Girdwood 512d16046ffSLiam Girdwood /* disable DSP */ 513d16046ffSLiam Girdwood snd_sof_dsp_update_bits(sdev, HDA_DSP_PP_BAR, 514d16046ffSLiam Girdwood SOF_HDA_REG_PP_PPCTL, 515d16046ffSLiam Girdwood SOF_HDA_PPCTL_GPROCEN, 0); 516d16046ffSLiam Girdwood return ret; 517d16046ffSLiam Girdwood } 518d16046ffSLiam Girdwood 5193ab2c21eSPeter Ujfalusi int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev, 5203ab2c21eSPeter Ujfalusi struct sof_ipc4_fw_library *fw_lib, bool reload) 5213ab2c21eSPeter Ujfalusi { 5223ab2c21eSPeter Ujfalusi struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 5233ab2c21eSPeter Ujfalusi struct hdac_ext_stream *hext_stream; 5243ab2c21eSPeter Ujfalusi struct firmware stripped_firmware; 5253ab2c21eSPeter Ujfalusi struct sof_ipc4_msg msg = {}; 5263ab2c21eSPeter Ujfalusi struct snd_dma_buffer dmab; 5273ab2c21eSPeter Ujfalusi int ret, ret1; 5283ab2c21eSPeter Ujfalusi 5293ab2c21eSPeter Ujfalusi /* IMR booting will restore the libraries as well, skip the loading */ 5303ab2c21eSPeter Ujfalusi if (reload && hda->booted_from_imr) 5313ab2c21eSPeter Ujfalusi return 0; 5323ab2c21eSPeter Ujfalusi 5333ab2c21eSPeter Ujfalusi /* the fw_lib has been verified during loading, we can trust the validity here */ 5343ab2c21eSPeter Ujfalusi stripped_firmware.data = fw_lib->sof_fw.fw->data + fw_lib->sof_fw.payload_offset; 5353ab2c21eSPeter Ujfalusi stripped_firmware.size = fw_lib->sof_fw.fw->size - fw_lib->sof_fw.payload_offset; 5363ab2c21eSPeter Ujfalusi 5373ab2c21eSPeter Ujfalusi /* prepare DMA for code loader stream */ 5383ab2c21eSPeter Ujfalusi hext_stream = hda_cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, 5393ab2c21eSPeter Ujfalusi stripped_firmware.size, 5403ab2c21eSPeter Ujfalusi &dmab, SNDRV_PCM_STREAM_PLAYBACK); 5413ab2c21eSPeter Ujfalusi if (IS_ERR(hext_stream)) { 5423ab2c21eSPeter Ujfalusi dev_err(sdev->dev, "%s: DMA prepare failed\n", __func__); 5433ab2c21eSPeter Ujfalusi return PTR_ERR(hext_stream); 5443ab2c21eSPeter Ujfalusi } 5453ab2c21eSPeter Ujfalusi 5463ab2c21eSPeter Ujfalusi memcpy(dmab.area, stripped_firmware.data, stripped_firmware.size); 5473ab2c21eSPeter Ujfalusi 5483ab2c21eSPeter Ujfalusi msg.primary = hext_stream->hstream.stream_tag - 1; 5493ab2c21eSPeter Ujfalusi msg.primary |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_LOAD_LIBRARY); 5503ab2c21eSPeter Ujfalusi msg.primary |= SOF_IPC4_MSG_DIR(SOF_IPC4_MSG_REQUEST); 5513ab2c21eSPeter Ujfalusi msg.primary |= SOF_IPC4_MSG_TARGET(SOF_IPC4_FW_GEN_MSG); 5523ab2c21eSPeter Ujfalusi msg.primary |= SOF_IPC4_GLB_LOAD_LIBRARY_LIB_ID(fw_lib->id); 5533ab2c21eSPeter Ujfalusi 5543ab2c21eSPeter Ujfalusi ret = cl_trigger(sdev, hext_stream, SNDRV_PCM_TRIGGER_START); 5553ab2c21eSPeter Ujfalusi if (ret < 0) { 5563ab2c21eSPeter Ujfalusi dev_err(sdev->dev, "%s: DMA trigger start failed\n", __func__); 5573ab2c21eSPeter Ujfalusi goto cleanup; 5583ab2c21eSPeter Ujfalusi } 5593ab2c21eSPeter Ujfalusi 5603ab2c21eSPeter Ujfalusi ret = sof_ipc_tx_message(sdev->ipc, &msg, 0, NULL, 0); 5613ab2c21eSPeter Ujfalusi 5623ab2c21eSPeter Ujfalusi ret1 = cl_trigger(sdev, hext_stream, SNDRV_PCM_TRIGGER_STOP); 5633ab2c21eSPeter Ujfalusi if (ret1 < 0) { 5643ab2c21eSPeter Ujfalusi dev_err(sdev->dev, "%s: DMA trigger stop failed\n", __func__); 5653ab2c21eSPeter Ujfalusi if (!ret) 5663ab2c21eSPeter Ujfalusi ret = ret1; 5673ab2c21eSPeter Ujfalusi } 5683ab2c21eSPeter Ujfalusi 5693ab2c21eSPeter Ujfalusi cleanup: 5703ab2c21eSPeter Ujfalusi /* clean up even in case of error and return the first error */ 5713ab2c21eSPeter Ujfalusi ret1 = hda_cl_cleanup(sdev, &dmab, hext_stream); 5723ab2c21eSPeter Ujfalusi if (ret1 < 0) { 5733ab2c21eSPeter Ujfalusi dev_err(sdev->dev, "%s: Code loader DSP cleanup failed\n", __func__); 5743ab2c21eSPeter Ujfalusi 5753ab2c21eSPeter Ujfalusi /* set return value to indicate cleanup failure */ 5763ab2c21eSPeter Ujfalusi if (!ret) 5773ab2c21eSPeter Ujfalusi ret = ret1; 5783ab2c21eSPeter Ujfalusi } 5793ab2c21eSPeter Ujfalusi 5803ab2c21eSPeter Ujfalusi return ret; 5813ab2c21eSPeter Ujfalusi } 5823ab2c21eSPeter Ujfalusi 583d16046ffSLiam Girdwood /* pre fw run operations */ 584d16046ffSLiam Girdwood int hda_dsp_pre_fw_run(struct snd_sof_dev *sdev) 585d16046ffSLiam Girdwood { 586d16046ffSLiam Girdwood /* disable clock gating and power gating */ 587d16046ffSLiam Girdwood return hda_dsp_ctrl_clock_power_gating(sdev, false); 588d16046ffSLiam Girdwood } 589d16046ffSLiam Girdwood 590d16046ffSLiam Girdwood /* post fw run operations */ 591d16046ffSLiam Girdwood int hda_dsp_post_fw_run(struct snd_sof_dev *sdev) 592d16046ffSLiam Girdwood { 59351dfed1eSPierre-Louis Bossart int ret; 59451dfed1eSPierre-Louis Bossart 59551dfed1eSPierre-Louis Bossart if (sdev->first_boot) { 5962a68ff84SPeter Ujfalusi struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata; 5972a68ff84SPeter Ujfalusi 59851dfed1eSPierre-Louis Bossart ret = hda_sdw_startup(sdev); 59951dfed1eSPierre-Louis Bossart if (ret < 0) { 60051dfed1eSPierre-Louis Bossart dev_err(sdev->dev, 60151dfed1eSPierre-Louis Bossart "error: could not startup SoundWire links\n"); 60251dfed1eSPierre-Louis Bossart return ret; 60351dfed1eSPierre-Louis Bossart } 6042a68ff84SPeter Ujfalusi 6052a68ff84SPeter Ujfalusi /* Check if IMR boot is usable */ 6062a68ff84SPeter Ujfalusi if (!sof_debug_check_flag(SOF_DBG_IGNORE_D3_PERSISTENT) && 6072964e31cSPeter Ujfalusi (sdev->fw_ready.flags & SOF_IPC_INFO_D3_PERSISTENT || 6082964e31cSPeter Ujfalusi sdev->pdata->ipc_type == SOF_INTEL_IPC4)) 6092a68ff84SPeter Ujfalusi hdev->imrboot_supported = true; 61051dfed1eSPierre-Louis Bossart } 61151dfed1eSPierre-Louis Bossart 61251dfed1eSPierre-Louis Bossart hda_sdw_int_enable(sdev, true); 61351dfed1eSPierre-Louis Bossart 614d16046ffSLiam Girdwood /* re-enable clock gating and power gating */ 615d16046ffSLiam Girdwood return hda_dsp_ctrl_clock_power_gating(sdev, true); 616d16046ffSLiam Girdwood } 617edbaaadaSFred Oh 618edbaaadaSFred Oh int hda_dsp_ext_man_get_cavs_config_data(struct snd_sof_dev *sdev, 619edbaaadaSFred Oh const struct sof_ext_man_elem_header *hdr) 620edbaaadaSFred Oh { 621edbaaadaSFred Oh const struct sof_ext_man_cavs_config_data *config_data = 622edbaaadaSFred Oh container_of(hdr, struct sof_ext_man_cavs_config_data, hdr); 623edbaaadaSFred Oh struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata; 624edbaaadaSFred Oh int i, elem_num; 625edbaaadaSFred Oh 626edbaaadaSFred Oh /* calculate total number of config data elements */ 627edbaaadaSFred Oh elem_num = (hdr->size - sizeof(struct sof_ext_man_elem_header)) 628edbaaadaSFred Oh / sizeof(struct sof_config_elem); 629edbaaadaSFred Oh if (elem_num <= 0) { 630edbaaadaSFred Oh dev_err(sdev->dev, "cavs config data is inconsistent: %d\n", elem_num); 631edbaaadaSFred Oh return -EINVAL; 632edbaaadaSFred Oh } 633edbaaadaSFred Oh 634edbaaadaSFred Oh for (i = 0; i < elem_num; i++) 635edbaaadaSFred Oh switch (config_data->elems[i].token) { 636edbaaadaSFred Oh case SOF_EXT_MAN_CAVS_CONFIG_EMPTY: 637edbaaadaSFred Oh /* skip empty token */ 638edbaaadaSFred Oh break; 639edbaaadaSFred Oh case SOF_EXT_MAN_CAVS_CONFIG_CAVS_LPRO: 640edbaaadaSFred Oh hda->clk_config_lpro = config_data->elems[i].value; 641edbaaadaSFred Oh dev_dbg(sdev->dev, "FW clock config: %s\n", 642edbaaadaSFred Oh hda->clk_config_lpro ? "LPRO" : "HPRO"); 643edbaaadaSFred Oh break; 644e3a85dbeSFred Oh case SOF_EXT_MAN_CAVS_CONFIG_OUTBOX_SIZE: 645e3a85dbeSFred Oh case SOF_EXT_MAN_CAVS_CONFIG_INBOX_SIZE: 646e3a85dbeSFred Oh /* These elements are defined but not being used yet. No warn is required */ 647e3a85dbeSFred Oh break; 648edbaaadaSFred Oh default: 649e3a85dbeSFred Oh dev_info(sdev->dev, "unsupported token type: %d\n", 650edbaaadaSFred Oh config_data->elems[i].token); 651edbaaadaSFred Oh } 652edbaaadaSFred Oh 653edbaaadaSFred Oh return 0; 654edbaaadaSFred Oh } 655