• Home
  • Raw
  • Download

Lines Matching refs:cdev

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