Lines Matching defs:cdev

89 int catpt_store_streams_context(struct catpt_dev *cdev, struct dma_chan *chan)
93 list_for_each_entry(stream, &cdev->stream_list, node) {
99 dev_dbg(cdev->dev, "storing stream %d ctx: off 0x%08x size %d\n",
102 ret = catpt_dma_memcpy_fromdsp(cdev, chan,
103 cdev->dxbuf_paddr + off,
104 cdev->lpe_base + off,
107 dev_err(cdev->dev, "memcpy fromdsp failed: %d\n", ret);
115 int catpt_store_module_states(struct catpt_dev *cdev, struct dma_chan *chan)
119 for (i = 0; i < ARRAY_SIZE(cdev->modules); i++) {
124 type = &cdev->modules[i];
129 dev_dbg(cdev->dev, "storing mod %d state: off 0x%08x size %d\n",
132 ret = catpt_dma_memcpy_fromdsp(cdev, chan,
133 cdev->dxbuf_paddr + off,
134 cdev->lpe_base + off,
137 dev_err(cdev->dev, "memcpy fromdsp failed: %d\n", ret);
145 int catpt_store_memdumps(struct catpt_dev *cdev, struct dma_chan *chan)
149 for (i = 0; i < cdev->dx_ctx.num_meminfo; i++) {
154 info = &cdev->dx_ctx.meminfo[i];
159 if (off < cdev->dram.start || off > cdev->dram.end)
162 dev_dbg(cdev->dev, "storing memdump: off 0x%08x size %d\n",
165 ret = catpt_dma_memcpy_fromdsp(cdev, chan,
166 cdev->dxbuf_paddr + off,
167 cdev->lpe_base + off,
170 dev_err(cdev->dev, "memcpy fromdsp failed: %d\n", ret);
179 catpt_restore_streams_context(struct catpt_dev *cdev, struct dma_chan *chan)
183 list_for_each_entry(stream, &cdev->stream_list, node) {
189 dev_dbg(cdev->dev, "restoring stream %d ctx: off 0x%08x size %d\n",
192 ret = catpt_dma_memcpy_todsp(cdev, chan,
193 cdev->lpe_base + off,
194 cdev->dxbuf_paddr + off,
197 dev_err(cdev->dev, "memcpy fromdsp failed: %d\n", ret);
205 static int catpt_restore_memdumps(struct catpt_dev *cdev, struct dma_chan *chan)
209 for (i = 0; i < cdev->dx_ctx.num_meminfo; i++) {
214 info = &cdev->dx_ctx.meminfo[i];
219 if (off < cdev->dram.start || off > cdev->dram.end)
222 dev_dbg(cdev->dev, "restoring memdump: off 0x%08x size %d\n",
225 ret = catpt_dma_memcpy_todsp(cdev, chan,
226 cdev->lpe_base + off,
227 cdev->dxbuf_paddr + off,
230 dev_err(cdev->dev, "restore block failed: %d\n", ret);
238 static int catpt_restore_fwimage(struct catpt_dev *cdev,
248 r1.start = cdev->dram.start + blk->ram_offset;
253 for (i = 0; i < cdev->dx_ctx.num_meminfo; i++) {
258 info = &cdev->dx_ctx.meminfo[i];
264 if (off < cdev->dram.start || off > cdev->dram.end)
275 dev_dbg(cdev->dev, "restoring fwimage: %pr\n", &common);
277 ret = catpt_dma_memcpy_todsp(cdev, chan, common.start,
281 dev_err(cdev->dev, "memcpy todsp failed: %d\n", ret);
289 static int catpt_load_block(struct catpt_dev *cdev,
302 sram = &cdev->iram;
305 sram = &cdev->dram;
319 ret = catpt_dma_memcpy_todsp(cdev, chan, dst_addr, paddr, blk->size);
321 dev_err(cdev->dev, "memcpy error: %d\n", ret);
328 static int catpt_restore_basefw(struct catpt_dev *cdev,
346 ret = catpt_load_block(cdev, chan, paddr + offset,
350 ret = catpt_restore_fwimage(cdev, chan, paddr + offset,
356 dev_err(cdev->dev, "restore block failed: %d\n", ret);
364 ret = catpt_restore_memdumps(cdev, chan);
366 dev_err(cdev->dev, "restore memdumps failed: %d\n", ret);
371 static int catpt_restore_module(struct catpt_dev *cdev,
390 ret = catpt_dma_memcpy_todsp(cdev, chan,
391 cdev->lpe_base + blk->ram_offset,
392 cdev->dxbuf_paddr + blk->ram_offset,
396 ret = catpt_load_block(cdev, chan, paddr + offset,
402 dev_err(cdev->dev, "restore block failed: %d\n", ret);
412 static int catpt_load_module(struct catpt_dev *cdev,
423 type = &cdev->modules[mod->module_id];
431 ret = catpt_load_block(cdev, chan, paddr + offset, blk, true);
433 dev_err(cdev->dev, "load block failed: %d\n", ret);
459 static int catpt_restore_firmware(struct catpt_dev *cdev,
476 dev_err(cdev->dev, "module signature mismatch\n");
485 ret = catpt_restore_basefw(cdev, chan, paddr + offset,
489 ret = catpt_restore_module(cdev, chan, paddr + offset,
495 dev_err(cdev->dev, "restore module failed: %d\n", ret);
505 static int catpt_load_firmware(struct catpt_dev *cdev,
522 dev_err(cdev->dev, "module signature mismatch\n");
529 ret = catpt_load_module(cdev, chan, paddr + offset, mod);
531 dev_err(cdev->dev, "load module failed: %d\n", ret);
541 static int catpt_load_image(struct catpt_dev *cdev, struct dma_chan *chan,
551 ret = request_firmware((const struct firmware **)&img, name, cdev->dev);
557 dev_err(cdev->dev, "firmware signature mismatch\n");
562 vaddr = dma_alloc_coherent(cdev->dev, img->size, &paddr, GFP_KERNEL);
571 ret = catpt_restore_firmware(cdev, chan, paddr, fw);
573 ret = catpt_load_firmware(cdev, chan, paddr, fw);
575 dma_free_coherent(cdev->dev, img->size, vaddr, paddr);
581 static int catpt_load_images(struct catpt_dev *cdev, bool restore)
590 chan = catpt_dma_request_config_chan(cdev);
594 ret = catpt_load_image(cdev, chan, names[cdev->spec->core_id - 1],
601 ret = catpt_restore_streams_context(cdev, chan);
603 dev_err(cdev->dev, "restore streams ctx failed: %d\n", ret);
609 int catpt_boot_firmware(struct catpt_dev *cdev, bool restore)
613 catpt_dsp_stall(cdev, true);
615 ret = catpt_load_images(cdev, restore);
617 dev_err(cdev->dev, "load binaries failed: %d\n", ret);
621 reinit_completion(&cdev->fw_ready);
622 catpt_dsp_stall(cdev, false);
624 ret = wait_for_completion_timeout(&cdev->fw_ready,
627 dev_err(cdev->dev, "firmware ready timeout\n");
632 catpt_dsp_update_srampge(cdev, &cdev->dram, cdev->spec->dram_mask);
633 catpt_dsp_update_srampge(cdev, &cdev->iram, cdev->spec->iram_mask);
635 return catpt_dsp_update_lpclock(cdev);
638 int catpt_first_boot_firmware(struct catpt_dev *cdev)
643 ret = catpt_boot_firmware(cdev, false);
645 dev_err(cdev->dev, "basefw boot failed: %d\n", ret);
650 __request_region(&cdev->dram, 0, 0x200, NULL, 0);
652 for (res = cdev->dram.child; res->sibling; res = res->sibling)
654 __request_region(&cdev->dram, res->end + 1,
655 cdev->dram.end - res->end, NULL, 0);
657 ret = catpt_ipc_get_mixer_stream_info(cdev, &cdev->mixer);
661 ret = catpt_arm_stream_templates(cdev);
663 dev_err(cdev->dev, "arm templates failed: %d\n", ret);
668 catpt_dsp_update_srampge(cdev, &cdev->dram, cdev->spec->dram_mask);