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 Baytrail, Braswell and Cherrytrail.
20 #include "../sof-audio.h"
21 #include "../../intel/common/soc-intel-quirks.h"
23 /* DSP memories */
36 /* DSP peripherals */
98 u32 offset = sdev->dsp_oops_offset; in byt_get_registers()
106 if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) { in byt_get_registers()
107 dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n", in byt_get_registers()
108 xoops->arch_hdr.totalsize); in byt_get_registers()
111 offset += xoops->arch_hdr.totalsize; in byt_get_registers()
137 dev_err(sdev->dev, in byt_dump()
138 "error: ipc host -> DSP: pending %s complete %s raw 0x%llx\n", in byt_dump()
141 dev_err(sdev->dev, in byt_dump()
145 dev_err(sdev->dev, in byt_dump()
146 "error: ipc DSP -> host: pending %s complete %s raw 0x%llx\n", in byt_dump()
149 dev_err(sdev->dev, in byt_dump()
150 "error: mask DSP: pending %s complete %s raw 0x%llx\n", in byt_dump()
171 /* reply message from DSP, Mask Done interrupt first */ in byt_irq_handler()
181 /* new message from DSP, Mask Busy interrupt first */ in byt_irq_handler()
200 /* reply message from DSP */ in byt_irq_thread()
203 spin_lock_irq(&sdev->ipc_lock); in byt_irq_thread()
206 * handle immediate reply from DSP core. If the msg is in byt_irq_thread()
217 spin_unlock_irq(&sdev->ipc_lock); in byt_irq_thread()
220 /* new message from DSP */ in byt_irq_thread()
223 /* Handle messages from DSP Core */ in byt_irq_thread()
244 sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data, in byt_send_msg()
245 msg->msg_size); in byt_send_msg()
253 struct snd_sof_ipc_msg *msg = sdev->msg; in byt_get_reply()
263 dev_warn(sdev->dev, "unexpected ipc interrupt raised!\n"); in byt_get_reply()
268 sof_mailbox_read(sdev, sdev->host_box.offset, &reply, sizeof(reply)); in byt_get_reply()
271 memcpy(msg->reply_data, &reply, sizeof(reply)); in byt_get_reply()
275 if (reply.hdr.size != msg->reply_size) { in byt_get_reply()
276 dev_err(sdev->dev, "error: reply expected %zu got %u bytes\n", in byt_get_reply()
277 msg->reply_size, reply.hdr.size); in byt_get_reply()
278 ret = -EINVAL; in byt_get_reply()
282 if (msg->reply_size > 0) in byt_get_reply()
283 sof_mailbox_read(sdev, sdev->host_box.offset, in byt_get_reply()
284 msg->reply_data, msg->reply_size); in byt_get_reply()
287 msg->reply_error = ret; in byt_get_reply()
302 /* clear BUSY bit and set DONE bit - accept new messages */ in byt_host_done()
315 /* clear DONE bit - tell DSP we have completed */ in byt_dsp_done()
321 * DSP control.
331 while (tries--) { in byt_run()
338 dev_err(sdev->dev, "error: unable to run DSP firmware\n"); in byt_run()
340 return -ENODEV; in byt_run()
349 /* put DSP into reset, set reset vector and stall */ in byt_reset()
358 /* take DSP out of reset and keep stalled for FW loading */ in byt_reset()
373 filename = devm_kstrdup(sdev->dev, sof_tplg_filename, GFP_KERNEL); in fixup_tplg_name()
380 tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, in fixup_tplg_name()
381 "%s-%s.tplg", in fixup_tplg_name()
391 struct snd_sof_pdata *sof_pdata = sdev->pdata; in byt_machine_select()
392 const struct sof_dev_desc *desc = sof_pdata->desc; in byt_machine_select()
397 mach = snd_soc_acpi_find_machine(desc->machines); in byt_machine_select()
399 dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n"); in byt_machine_select()
403 pdev = to_platform_device(sdev->dev); in byt_machine_select()
405 dev_dbg(sdev->dev, in byt_machine_select()
406 "BYT-CR detected, SSP0 used instead of SSP2\n"); in byt_machine_select()
409 mach->sof_tplg_filename, in byt_machine_select()
412 tplg_filename = mach->sof_tplg_filename; in byt_machine_select()
416 dev_dbg(sdev->dev, in byt_machine_select()
421 sof_pdata->tplg_filename = tplg_filename; in byt_machine_select()
422 mach->mach_params.acpi_ipc_irq_index = desc->irqindex_host_ipc; in byt_machine_select()
423 sof_pdata->machine = mach; in byt_machine_select()
431 mach_params = (struct snd_soc_acpi_mach_params *)&mach->mach_params; in byt_set_mach_params()
432 mach_params->platform = dev_name(dev); in byt_set_mach_params()
438 .name = "ssp0-port",
449 .name = "ssp1-port",
460 .name = "ssp2-port",
471 .name = "ssp3-port",
482 .name = "ssp4-port",
493 .name = "ssp5-port",
513 struct snd_sof_pdata *pdata = sdev->pdata; in tangier_pci_probe()
514 const struct sof_dev_desc *desc = pdata->desc; in tangier_pci_probe()
515 struct pci_dev *pci = to_pci_dev(sdev->dev); in tangier_pci_probe()
519 /* DSP DMA can only access low 31 bits of host memory */ in tangier_pci_probe()
520 ret = dma_coerce_mask_and_coherent(&pci->dev, DMA_BIT_MASK(31)); in tangier_pci_probe()
522 dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret); in tangier_pci_probe()
527 base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET; in tangier_pci_probe()
530 dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); in tangier_pci_probe()
531 sdev->bar[BYT_DSP_BAR] = devm_ioremap(sdev->dev, base, size); in tangier_pci_probe()
532 if (!sdev->bar[BYT_DSP_BAR]) { in tangier_pci_probe()
533 dev_err(sdev->dev, "error: failed to ioremap LPE base 0x%x size 0x%x\n", in tangier_pci_probe()
535 return -ENODEV; in tangier_pci_probe()
537 dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BYT_DSP_BAR]); in tangier_pci_probe()
539 /* IMR base - optional */ in tangier_pci_probe()
540 if (desc->resindex_imr_base == -1) in tangier_pci_probe()
543 base = pci_resource_start(pci, desc->resindex_imr_base); in tangier_pci_probe()
544 size = pci_resource_len(pci, desc->resindex_imr_base); in tangier_pci_probe()
548 dev_info(sdev->dev, "IMR not set by BIOS. Ignoring\n"); in tangier_pci_probe()
552 dev_dbg(sdev->dev, "IMR base at 0x%x size 0x%x", base, size); in tangier_pci_probe()
553 sdev->bar[BYT_IMR_BAR] = devm_ioremap(sdev->dev, base, size); in tangier_pci_probe()
554 if (!sdev->bar[BYT_IMR_BAR]) { in tangier_pci_probe()
555 dev_err(sdev->dev, "error: failed to ioremap IMR base 0x%x size 0x%x\n", in tangier_pci_probe()
557 return -ENODEV; in tangier_pci_probe()
559 dev_dbg(sdev->dev, "IMR VADDR %p\n", sdev->bar[BYT_IMR_BAR]); in tangier_pci_probe()
563 sdev->ipc_irq = pci->irq; in tangier_pci_probe()
564 dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq); in tangier_pci_probe()
565 ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq, in tangier_pci_probe()
569 dev_err(sdev->dev, "error: failed to register IRQ %d\n", in tangier_pci_probe()
570 sdev->ipc_irq); in tangier_pci_probe()
580 sdev->dsp_box.offset = MBOX_OFFSET; in tangier_pci_probe()
589 /* DSP core boot / reset */
591 .reset = byt_reset,
668 /* Put DSP into reset, set reset vector */ in byt_reset_dsp_disable_int()
727 struct snd_sof_pdata *pdata = sdev->pdata; in byt_acpi_probe()
728 const struct sof_dev_desc *desc = pdata->desc; in byt_acpi_probe()
730 container_of(sdev->dev, struct platform_device, dev); in byt_acpi_probe()
735 /* DSP DMA can only access low 31 bits of host memory */ in byt_acpi_probe()
736 ret = dma_coerce_mask_and_coherent(sdev->dev, DMA_BIT_MASK(31)); in byt_acpi_probe()
738 dev_err(sdev->dev, "error: failed to set DMA mask %d\n", ret); in byt_acpi_probe()
744 desc->resindex_lpe_base); in byt_acpi_probe()
746 base = mmio->start; in byt_acpi_probe()
749 dev_err(sdev->dev, "error: failed to get LPE base at idx %d\n", in byt_acpi_probe()
750 desc->resindex_lpe_base); in byt_acpi_probe()
751 return -EINVAL; in byt_acpi_probe()
754 dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); in byt_acpi_probe()
755 sdev->bar[BYT_DSP_BAR] = devm_ioremap(sdev->dev, base, size); in byt_acpi_probe()
756 if (!sdev->bar[BYT_DSP_BAR]) { in byt_acpi_probe()
757 dev_err(sdev->dev, "error: failed to ioremap LPE base 0x%x size 0x%x\n", in byt_acpi_probe()
759 return -ENODEV; in byt_acpi_probe()
761 dev_dbg(sdev->dev, "LPE VADDR %p\n", sdev->bar[BYT_DSP_BAR]); in byt_acpi_probe()
764 sdev->mmio_bar = BYT_DSP_BAR; in byt_acpi_probe()
765 sdev->mailbox_bar = BYT_DSP_BAR; in byt_acpi_probe()
767 /* IMR base - optional */ in byt_acpi_probe()
768 if (desc->resindex_imr_base == -1) in byt_acpi_probe()
772 desc->resindex_imr_base); in byt_acpi_probe()
774 base = mmio->start; in byt_acpi_probe()
777 dev_err(sdev->dev, "error: failed to get IMR base at idx %d\n", in byt_acpi_probe()
778 desc->resindex_imr_base); in byt_acpi_probe()
779 return -ENODEV; in byt_acpi_probe()
784 dev_info(sdev->dev, "IMR not set by BIOS. Ignoring\n"); in byt_acpi_probe()
788 dev_dbg(sdev->dev, "IMR base at 0x%x size 0x%x", base, size); in byt_acpi_probe()
789 sdev->bar[BYT_IMR_BAR] = devm_ioremap(sdev->dev, base, size); in byt_acpi_probe()
790 if (!sdev->bar[BYT_IMR_BAR]) { in byt_acpi_probe()
791 dev_err(sdev->dev, "error: failed to ioremap IMR base 0x%x size 0x%x\n", in byt_acpi_probe()
793 return -ENODEV; in byt_acpi_probe()
795 dev_dbg(sdev->dev, "IMR VADDR %p\n", sdev->bar[BYT_IMR_BAR]); in byt_acpi_probe()
799 sdev->ipc_irq = platform_get_irq(pdev, desc->irqindex_host_ipc); in byt_acpi_probe()
800 if (sdev->ipc_irq < 0) in byt_acpi_probe()
801 return sdev->ipc_irq; in byt_acpi_probe()
803 dev_dbg(sdev->dev, "using IRQ %d\n", sdev->ipc_irq); in byt_acpi_probe()
804 ret = devm_request_threaded_irq(sdev->dev, sdev->ipc_irq, in byt_acpi_probe()
808 dev_err(sdev->dev, "error: failed to register IRQ %d\n", in byt_acpi_probe()
809 sdev->ipc_irq); in byt_acpi_probe()
819 sdev->dsp_box.offset = MBOX_OFFSET; in byt_acpi_probe()
830 /* DSP core boot / reset */
832 .reset = byt_reset,
909 /* DSP core boot / reset */
911 .reset = byt_reset,