Lines Matching +full:dsp +full:- +full:reset
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
12 * Hardware interface for audio DSP on Broadwell
18 #include <sound/soc-acpi.h>
19 #include <sound/soc-acpi-intel-match.h>
20 #include <sound/intel-dsp-config.h>
23 #include "../sof-acpi-dev.h"
24 #include "../sof-audio.h"
34 /* DSP memories for BDW */
47 /* DSP peripherals */
80 * DSP Control.
90 /* set DSP to RUN */ in bdw_run()
100 /* put DSP into reset and stall */ in bdw_reset()
105 /* keep in reset for 10ms */ in bdw_reset()
108 /* take DSP out of reset and keep stalled for FW loading */ in bdw_reset()
135 while (tries--) { in bdw_set_dsp_D0()
136 reg = readl(sdev->bar[BDW_PCI_BAR] + PCI_PMCS) in bdw_set_dsp_D0()
144 return -ENODEV; in bdw_set_dsp_D0()
155 /* stall DSP core, set clk to 192/96Mhz */ in bdw_set_dsp_D0()
171 /* Stall and reset core, set CSR */ in bdw_set_dsp_D0()
200 /* set on-demond mode on engine 0,1 for all channels */ in bdw_set_dsp_D0()
228 u32 offset = sdev->dsp_oops_offset; in bdw_get_registers()
236 if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { in bdw_get_registers()
237 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in bdw_get_registers()
238 xoops->arch_hdr.totalsize); in bdw_get_registers()
241 offset += xoops->arch_hdr.totalsize; in bdw_get_registers()
267 dev_err(sdev->dev, in bdw_dump()
268 "error: ipc host -> DSP: pending %s complete %s raw 0x%8.8x\n", in bdw_dump()
271 dev_err(sdev->dev, in bdw_dump()
275 dev_err(sdev->dev, in bdw_dump()
276 "error: ipc DSP -> host: pending %s complete %s raw 0x%8.8x\n", in bdw_dump()
279 dev_err(sdev->dev, in bdw_dump()
280 "error: mask DSP: pending %s complete %s raw 0x%8.8x\n", in bdw_dump()
311 /* reply message from DSP */ in bdw_irq_thread()
319 spin_lock_irq(&sdev->ipc_lock); in bdw_irq_thread()
322 * handle immediate reply from DSP core. If the msg is in bdw_irq_thread()
332 spin_unlock_irq(&sdev->ipc_lock); in bdw_irq_thread()
337 /* new message from DSP */ in bdw_irq_thread()
345 /* Handle messages from DSP Core */ in bdw_irq_thread()
366 sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, in bdw_send_msg()
367 msg->msg_size); in bdw_send_msg()
385 /* clear BUSY bit and set DONE bit - accept new messages */ in bdw_host_done()
397 /* clear DONE bit - tell DSP we have completed */ in bdw_dsp_done()
411 struct snd_sof_pdata *pdata = sdev->pdata; in bdw_probe()
412 const struct sof_dev_desc *desc = pdata->desc; in bdw_probe()
414 container_of(sdev->dev, struct platform_device, dev); in bdw_probe()
420 chip = get_chip_info(sdev->pdata); in bdw_probe()
422 dev_err(sdev->dev, "error: no such device supported\n"); in bdw_probe()
423 return -EIO; in bdw_probe()
426 sdev->num_cores = chip->cores_num; in bdw_probe()
430 desc->resindex_lpe_base); in bdw_probe()
432 base = mmio->start; in bdw_probe()
435 dev_err(sdev->dev, "error: failed to get LPE base at idx %d\n", in bdw_probe()
436 desc->resindex_lpe_base); in bdw_probe()
437 return -EINVAL; in bdw_probe()
440 dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); in bdw_probe()
441 sdev->bar[BDW_DSP_BAR] = devm_ioremap(sdev->dev, base, size); in bdw_probe()
442 if (!sdev->bar[BDW_DSP_BAR]) { in bdw_probe()
443 dev_err(sdev->dev, in bdw_probe()
446 return -ENODEV; in bdw_probe()
448 dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BDW_DSP_BAR]); in bdw_probe()
451 sdev->mmio_bar = BDW_DSP_BAR; in bdw_probe()
452 sdev->mailbox_bar = BDW_DSP_BAR; in bdw_probe()
453 sdev->dsp_oops_offset = MBOX_OFFSET; in bdw_probe()
457 desc->resindex_pcicfg_base); in bdw_probe()
459 base = mmio->start; in bdw_probe()
462 dev_err(sdev->dev, "error: failed to get PCI base at idx %d\n", in bdw_probe()
463 desc->resindex_pcicfg_base); in bdw_probe()
464 return -ENODEV; in bdw_probe()
467 dev_dbg(sdev->dev, "PCI base at 0x%x size 0x%x", base, size); in bdw_probe()
468 sdev->bar[BDW_PCI_BAR] = devm_ioremap(sdev->dev, base, size); in bdw_probe()
469 if (!sdev->bar[BDW_PCI_BAR]) { in bdw_probe()
470 dev_err(sdev->dev, in bdw_probe()
473 return -ENODEV; in bdw_probe()
475 dev_dbg(sdev->dev, "PCI VADDR %p\n", sdev->bar[BDW_PCI_BAR]); in bdw_probe()
478 sdev->ipc_irq = platform_get_irq(pdev, desc->irqindex_host_ipc); in bdw_probe()
479 if (sdev->ipc_irq < 0) in bdw_probe()
480 return sdev->ipc_irq; in bdw_probe()
482 dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq); in bdw_probe()
483 ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq, in bdw_probe()
487 dev_err(sdev->dev, "error: failed to register IRQ %d\n", in bdw_probe()
488 sdev->ipc_irq); in bdw_probe()
492 /* enable the DSP SHIM */ in bdw_probe()
495 dev_err(sdev->dev, "error: failed to set DSP D0\n"); in bdw_probe()
499 /* DSP DMA can only access low 31 bits of host memory */ in bdw_probe()
500 ret = dma_coerce_mask_and_coherent(sdev->dev, DMA_BIT_MASK(31)); in bdw_probe()
502 dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret); in bdw_probe()
507 sdev->dsp_box.offset = MBOX_OFFSET; in bdw_probe()
514 struct snd_sof_pdata *sof_pdata = sdev->pdata; in bdw_machine_select()
515 const struct sof_dev_desc *desc = sof_pdata->desc; in bdw_machine_select()
518 mach = snd_soc_acpi_find_machine(desc->machines); in bdw_machine_select()
520 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in bdw_machine_select()
524 sof_pdata->tplg_filename = mach->sof_tplg_filename; in bdw_machine_select()
525 mach->mach_params.acpi_ipc_irq_index = desc->irqindex_host_ipc; in bdw_machine_select()
533 struct snd_sof_pdata *pdata = sdev->pdata; in bdw_set_mach_params()
534 const struct sof_dev_desc *desc = pdata->desc; in bdw_set_mach_params()
537 mach_params = &mach->mach_params; in bdw_set_mach_params()
538 mach_params->platform = dev_name(sdev->dev); in bdw_set_mach_params()
539 mach_params->num_dai_drivers = desc->ops->num_drv; in bdw_set_mach_params()
540 mach_params->dai_drivers = desc->ops->drv; in bdw_set_mach_params()
546 .name = "ssp0-port",
557 .name = "ssp1-port",
574 /* DSP Core Control */
576 .reset = bdw_reset,
639 .resindex_imr_base = -1,
648 [SOF_IPC_TYPE_3] = "intel/sof-tplg",
651 [SOF_IPC_TYPE_3] = "sof-bdw.ri",
653 .nocodec_tplg_filename = "sof-bdw-nocodec.tplg",
665 struct device *dev = &pdev->dev; in sof_broadwell_probe()
670 id = acpi_match_device(dev->driver->acpi_match_table, dev); in sof_broadwell_probe()
672 return -ENODEV; in sof_broadwell_probe()
674 ret = snd_intel_acpi_dsp_driver_probe(dev, id->id); in sof_broadwell_probe()
677 return -ENODEV; in sof_broadwell_probe()
680 desc = (const struct sof_dev_desc *)id->driver_data; in sof_broadwell_probe()
689 .name = "sof-audio-acpi-intel-bdw",