Lines Matching refs:fdev

35 	struct st_fdma_dev *fdev = fchan->fdev;  in st_fdma_dreq_get()  local
46 if (fdev->dreq_mask == ~0L) { in st_fdma_dreq_get()
47 dev_err(fdev->dev, "No req lines available\n"); in st_fdma_dreq_get()
52 dev_err(fdev->dev, "Invalid or used req line\n"); in st_fdma_dreq_get()
59 } while (test_and_set_bit(dreq_line, &fdev->dreq_mask)); in st_fdma_dreq_get()
61 dev_dbg(fdev->dev, "get dreq_line:%d mask:%#lx\n", in st_fdma_dreq_get()
62 dreq_line, fdev->dreq_mask); in st_fdma_dreq_get()
69 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_dreq_put() local
71 dev_dbg(fdev->dev, "put dreq_line:%#x\n", fchan->dreq_line); in st_fdma_dreq_put()
72 clear_bit(fchan->dreq_line, &fdev->dreq_mask); in st_fdma_dreq_put()
93 fchan->fdev->slim_rproc->peri + FDMA_CMD_SET_OFST); in st_fdma_xfer_desc()
95 dev_dbg(fchan->fdev->dev, "start chan:%d\n", fchan->vchan.chan.chan_id); in st_fdma_xfer_desc()
103 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_ch_sta_update() local
110 dev_warn(fdev->dev, "chan:%d, error:%ld\n", ch_id, ch_err); in st_fdma_ch_sta_update()
128 struct st_fdma_dev *fdev = dev_id; in st_fdma_irq_handler() local
130 struct st_fdma_chan *fchan = &fdev->chans[0]; in st_fdma_irq_handler()
133 int_sta = fdma_read(fdev, FDMA_INT_STA_OFST); in st_fdma_irq_handler()
162 fdma_write(fdev, clr, FDMA_INT_CLR_OFST); in st_fdma_irq_handler()
170 struct st_fdma_dev *fdev = ofdma->of_dma_data; in st_fdma_of_xlate() local
178 if (fdev->dma_device.dev->of_node != dma_spec->np) in st_fdma_of_xlate()
181 ret = rproc_boot(fdev->slim_rproc->rproc); in st_fdma_of_xlate()
187 chan = dma_get_any_slave_channel(&fdev->dma_device); in st_fdma_of_xlate()
215 dev_dbg(fdev->dev, "xlate req_line:%d type:%d req_ctrl:%#lx\n", in st_fdma_of_xlate()
221 rproc_shutdown(fdev->slim_rproc->rproc); in st_fdma_of_xlate()
272 fchan->fdev->dev, in st_fdma_alloc_chan_res()
278 dev_err(fchan->fdev->dev, "unable to allocate desc pool\n"); in st_fdma_alloc_chan_res()
282 dev_dbg(fchan->fdev->dev, "alloc ch_id:%d type:%d\n", in st_fdma_alloc_chan_res()
291 struct rproc *rproc = fchan->fdev->slim_rproc->rproc; in st_fdma_free_chan_res()
294 dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n", in st_fdma_free_chan_res()
327 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_dma_memcpy()
353 struct st_fdma_dev *fdev = fchan->fdev; in config_reqctrl() local
406 dev_dbg(fdev->dev, "chan:%d config_reqctrl:%#x req_ctrl:%#lx\n", in config_reqctrl()
441 dev_err(fchan->fdev->dev, "bad direction?\n"); in st_fdma_prep_common()
465 dev_err(fchan->fdev->dev, "bad width or direction\n"); in st_fdma_prep_dma_cyclic()
471 dev_err(fchan->fdev->dev, "len is not multiple of period\n"); in st_fdma_prep_dma_cyclic()
478 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_dma_cyclic()
527 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_slave_sg()
628 dev_dbg(fchan->fdev->dev, "pause chan:%d\n", ch_id); in st_fdma_pause()
632 fdma_write(fchan->fdev, cmd, FDMA_CMD_SET_OFST); in st_fdma_pause()
645 dev_dbg(fchan->fdev->dev, "resume chan:%d\n", ch_id); in st_fdma_resume()
666 dev_dbg(fchan->fdev->dev, "terminate chan:%d\n", ch_id); in st_fdma_terminate_all()
669 fdma_write(fchan->fdev, cmd, FDMA_CMD_SET_OFST); in st_fdma_terminate_all()
715 struct st_fdma_dev *fdev) in st_fdma_parse_dt() argument
717 snprintf(fdev->fw_name, FW_NAME_SIZE, "fdma_%s_%d.elf", in st_fdma_parse_dt()
721 &fdev->nr_channels); in st_fdma_parse_dt()
728 static void st_fdma_free(struct st_fdma_dev *fdev) in st_fdma_free() argument
733 for (i = 0; i < fdev->nr_channels; i++) { in st_fdma_free()
734 fchan = &fdev->chans[i]; in st_fdma_free()
742 struct st_fdma_dev *fdev; in st_fdma_probe() local
749 fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL); in st_fdma_probe()
750 if (!fdev) in st_fdma_probe()
753 ret = st_fdma_parse_dt(pdev, drvdata, fdev); in st_fdma_probe()
759 fdev->chans = devm_kcalloc(&pdev->dev, fdev->nr_channels, in st_fdma_probe()
761 if (!fdev->chans) in st_fdma_probe()
764 fdev->dev = &pdev->dev; in st_fdma_probe()
765 fdev->drvdata = drvdata; in st_fdma_probe()
766 platform_set_drvdata(pdev, fdev); in st_fdma_probe()
768 fdev->irq = platform_get_irq(pdev, 0); in st_fdma_probe()
769 if (fdev->irq < 0) in st_fdma_probe()
772 ret = devm_request_irq(&pdev->dev, fdev->irq, st_fdma_irq_handler, 0, in st_fdma_probe()
773 dev_name(&pdev->dev), fdev); in st_fdma_probe()
779 fdev->slim_rproc = st_slim_rproc_alloc(pdev, fdev->fw_name); in st_fdma_probe()
780 if (IS_ERR(fdev->slim_rproc)) { in st_fdma_probe()
781 ret = PTR_ERR(fdev->slim_rproc); in st_fdma_probe()
787 INIT_LIST_HEAD(&fdev->dma_device.channels); in st_fdma_probe()
788 for (i = 0; i < fdev->nr_channels; i++) { in st_fdma_probe()
789 struct st_fdma_chan *fchan = &fdev->chans[i]; in st_fdma_probe()
791 fchan->fdev = fdev; in st_fdma_probe()
793 vchan_init(&fchan->vchan, &fdev->dma_device); in st_fdma_probe()
797 fdev->dreq_mask = BIT(0) | BIT(31); in st_fdma_probe()
799 dma_cap_set(DMA_SLAVE, fdev->dma_device.cap_mask); in st_fdma_probe()
800 dma_cap_set(DMA_CYCLIC, fdev->dma_device.cap_mask); in st_fdma_probe()
801 dma_cap_set(DMA_MEMCPY, fdev->dma_device.cap_mask); in st_fdma_probe()
803 fdev->dma_device.dev = &pdev->dev; in st_fdma_probe()
804 fdev->dma_device.device_alloc_chan_resources = st_fdma_alloc_chan_res; in st_fdma_probe()
805 fdev->dma_device.device_free_chan_resources = st_fdma_free_chan_res; in st_fdma_probe()
806 fdev->dma_device.device_prep_dma_cyclic = st_fdma_prep_dma_cyclic; in st_fdma_probe()
807 fdev->dma_device.device_prep_slave_sg = st_fdma_prep_slave_sg; in st_fdma_probe()
808 fdev->dma_device.device_prep_dma_memcpy = st_fdma_prep_dma_memcpy; in st_fdma_probe()
809 fdev->dma_device.device_tx_status = st_fdma_tx_status; in st_fdma_probe()
810 fdev->dma_device.device_issue_pending = st_fdma_issue_pending; in st_fdma_probe()
811 fdev->dma_device.device_terminate_all = st_fdma_terminate_all; in st_fdma_probe()
812 fdev->dma_device.device_config = st_fdma_slave_config; in st_fdma_probe()
813 fdev->dma_device.device_pause = st_fdma_pause; in st_fdma_probe()
814 fdev->dma_device.device_resume = st_fdma_resume; in st_fdma_probe()
816 fdev->dma_device.src_addr_widths = FDMA_DMA_BUSWIDTHS; in st_fdma_probe()
817 fdev->dma_device.dst_addr_widths = FDMA_DMA_BUSWIDTHS; in st_fdma_probe()
818 fdev->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); in st_fdma_probe()
819 fdev->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; in st_fdma_probe()
821 ret = dmaenginem_async_device_register(&fdev->dma_device); in st_fdma_probe()
828 ret = of_dma_controller_register(np, st_fdma_of_xlate, fdev); in st_fdma_probe()
835 dev_info(&pdev->dev, "ST FDMA engine driver, irq:%d\n", fdev->irq); in st_fdma_probe()
840 st_fdma_free(fdev); in st_fdma_probe()
841 st_slim_rproc_put(fdev->slim_rproc); in st_fdma_probe()
848 struct st_fdma_dev *fdev = platform_get_drvdata(pdev); in st_fdma_remove() local
850 devm_free_irq(&pdev->dev, fdev->irq, fdev); in st_fdma_remove()
851 st_slim_rproc_put(fdev->slim_rproc); in st_fdma_remove()