Lines Matching refs:fdev
34 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_dreq_get() local
45 if (fdev->dreq_mask == ~0L) { in st_fdma_dreq_get()
46 dev_err(fdev->dev, "No req lines available\n"); in st_fdma_dreq_get()
51 dev_err(fdev->dev, "Invalid or used req line\n"); in st_fdma_dreq_get()
58 } while (test_and_set_bit(dreq_line, &fdev->dreq_mask)); in st_fdma_dreq_get()
60 dev_dbg(fdev->dev, "get dreq_line:%d mask:%#lx\n", in st_fdma_dreq_get()
61 dreq_line, fdev->dreq_mask); in st_fdma_dreq_get()
68 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_dreq_put() local
70 dev_dbg(fdev->dev, "put dreq_line:%#x\n", fchan->dreq_line); in st_fdma_dreq_put()
71 clear_bit(fchan->dreq_line, &fdev->dreq_mask); in st_fdma_dreq_put()
92 fchan->fdev->slim_rproc->peri + FDMA_CMD_SET_OFST); in st_fdma_xfer_desc()
94 dev_dbg(fchan->fdev->dev, "start chan:%d\n", fchan->vchan.chan.chan_id); in st_fdma_xfer_desc()
102 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_ch_sta_update() local
109 dev_warn(fdev->dev, "chan:%d, error:%ld\n", ch_id, ch_err); in st_fdma_ch_sta_update()
127 struct st_fdma_dev *fdev = dev_id; in st_fdma_irq_handler() local
129 struct st_fdma_chan *fchan = &fdev->chans[0]; in st_fdma_irq_handler()
132 int_sta = fdma_read(fdev, FDMA_INT_STA_OFST); in st_fdma_irq_handler()
161 fdma_write(fdev, clr, FDMA_INT_CLR_OFST); in st_fdma_irq_handler()
169 struct st_fdma_dev *fdev = ofdma->of_dma_data; in st_fdma_of_xlate() local
177 if (fdev->dma_device.dev->of_node != dma_spec->np) in st_fdma_of_xlate()
180 ret = rproc_boot(fdev->slim_rproc->rproc); in st_fdma_of_xlate()
186 chan = dma_get_any_slave_channel(&fdev->dma_device); in st_fdma_of_xlate()
214 dev_dbg(fdev->dev, "xlate req_line:%d type:%d req_ctrl:%#lx\n", in st_fdma_of_xlate()
220 rproc_shutdown(fdev->slim_rproc->rproc); in st_fdma_of_xlate()
271 fchan->fdev->dev, in st_fdma_alloc_chan_res()
277 dev_err(fchan->fdev->dev, "unable to allocate desc pool\n"); in st_fdma_alloc_chan_res()
281 dev_dbg(fchan->fdev->dev, "alloc ch_id:%d type:%d\n", in st_fdma_alloc_chan_res()
290 struct rproc *rproc = fchan->fdev->slim_rproc->rproc; in st_fdma_free_chan_res()
293 dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n", in st_fdma_free_chan_res()
326 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_dma_memcpy()
352 struct st_fdma_dev *fdev = fchan->fdev; in config_reqctrl() local
405 dev_dbg(fdev->dev, "chan:%d config_reqctrl:%#x req_ctrl:%#lx\n", in config_reqctrl()
440 dev_err(fchan->fdev->dev, "bad direction?\n"); in st_fdma_prep_common()
464 dev_err(fchan->fdev->dev, "bad width or direction\n"); in st_fdma_prep_dma_cyclic()
470 dev_err(fchan->fdev->dev, "len is not multiple of period\n"); in st_fdma_prep_dma_cyclic()
477 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_dma_cyclic()
526 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_slave_sg()
627 dev_dbg(fchan->fdev->dev, "pause chan:%d\n", ch_id); in st_fdma_pause()
631 fdma_write(fchan->fdev, cmd, FDMA_CMD_SET_OFST); in st_fdma_pause()
644 dev_dbg(fchan->fdev->dev, "resume chan:%d\n", ch_id); in st_fdma_resume()
665 dev_dbg(fchan->fdev->dev, "terminate chan:%d\n", ch_id); in st_fdma_terminate_all()
668 fdma_write(fchan->fdev, cmd, FDMA_CMD_SET_OFST); in st_fdma_terminate_all()
714 struct st_fdma_dev *fdev) in st_fdma_parse_dt() argument
716 snprintf(fdev->fw_name, FW_NAME_SIZE, "fdma_%s_%d.elf", in st_fdma_parse_dt()
720 &fdev->nr_channels); in st_fdma_parse_dt()
727 static void st_fdma_free(struct st_fdma_dev *fdev) in st_fdma_free() argument
732 for (i = 0; i < fdev->nr_channels; i++) { in st_fdma_free()
733 fchan = &fdev->chans[i]; in st_fdma_free()
741 struct st_fdma_dev *fdev; in st_fdma_probe() local
755 fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL); in st_fdma_probe()
756 if (!fdev) in st_fdma_probe()
759 ret = st_fdma_parse_dt(pdev, drvdata, fdev); in st_fdma_probe()
765 fdev->chans = devm_kcalloc(&pdev->dev, fdev->nr_channels, in st_fdma_probe()
767 if (!fdev->chans) in st_fdma_probe()
770 fdev->dev = &pdev->dev; in st_fdma_probe()
771 fdev->drvdata = drvdata; in st_fdma_probe()
772 platform_set_drvdata(pdev, fdev); in st_fdma_probe()
774 fdev->irq = platform_get_irq(pdev, 0); in st_fdma_probe()
775 if (fdev->irq < 0) in st_fdma_probe()
778 ret = devm_request_irq(&pdev->dev, fdev->irq, st_fdma_irq_handler, 0, in st_fdma_probe()
779 dev_name(&pdev->dev), fdev); in st_fdma_probe()
785 fdev->slim_rproc = st_slim_rproc_alloc(pdev, fdev->fw_name); in st_fdma_probe()
786 if (IS_ERR(fdev->slim_rproc)) { in st_fdma_probe()
787 ret = PTR_ERR(fdev->slim_rproc); in st_fdma_probe()
793 INIT_LIST_HEAD(&fdev->dma_device.channels); in st_fdma_probe()
794 for (i = 0; i < fdev->nr_channels; i++) { in st_fdma_probe()
795 struct st_fdma_chan *fchan = &fdev->chans[i]; in st_fdma_probe()
797 fchan->fdev = fdev; in st_fdma_probe()
799 vchan_init(&fchan->vchan, &fdev->dma_device); in st_fdma_probe()
803 fdev->dreq_mask = BIT(0) | BIT(31); in st_fdma_probe()
805 dma_cap_set(DMA_SLAVE, fdev->dma_device.cap_mask); in st_fdma_probe()
806 dma_cap_set(DMA_CYCLIC, fdev->dma_device.cap_mask); in st_fdma_probe()
807 dma_cap_set(DMA_MEMCPY, fdev->dma_device.cap_mask); in st_fdma_probe()
809 fdev->dma_device.dev = &pdev->dev; in st_fdma_probe()
810 fdev->dma_device.device_alloc_chan_resources = st_fdma_alloc_chan_res; in st_fdma_probe()
811 fdev->dma_device.device_free_chan_resources = st_fdma_free_chan_res; in st_fdma_probe()
812 fdev->dma_device.device_prep_dma_cyclic = st_fdma_prep_dma_cyclic; in st_fdma_probe()
813 fdev->dma_device.device_prep_slave_sg = st_fdma_prep_slave_sg; in st_fdma_probe()
814 fdev->dma_device.device_prep_dma_memcpy = st_fdma_prep_dma_memcpy; in st_fdma_probe()
815 fdev->dma_device.device_tx_status = st_fdma_tx_status; in st_fdma_probe()
816 fdev->dma_device.device_issue_pending = st_fdma_issue_pending; in st_fdma_probe()
817 fdev->dma_device.device_terminate_all = st_fdma_terminate_all; in st_fdma_probe()
818 fdev->dma_device.device_config = st_fdma_slave_config; in st_fdma_probe()
819 fdev->dma_device.device_pause = st_fdma_pause; in st_fdma_probe()
820 fdev->dma_device.device_resume = st_fdma_resume; in st_fdma_probe()
822 fdev->dma_device.src_addr_widths = FDMA_DMA_BUSWIDTHS; in st_fdma_probe()
823 fdev->dma_device.dst_addr_widths = FDMA_DMA_BUSWIDTHS; in st_fdma_probe()
824 fdev->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); in st_fdma_probe()
825 fdev->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; in st_fdma_probe()
827 ret = dmaenginem_async_device_register(&fdev->dma_device); in st_fdma_probe()
834 ret = of_dma_controller_register(np, st_fdma_of_xlate, fdev); in st_fdma_probe()
841 dev_info(&pdev->dev, "ST FDMA engine driver, irq:%d\n", fdev->irq); in st_fdma_probe()
846 st_fdma_free(fdev); in st_fdma_probe()
847 st_slim_rproc_put(fdev->slim_rproc); in st_fdma_probe()
854 struct st_fdma_dev *fdev = platform_get_drvdata(pdev); in st_fdma_remove() local
856 devm_free_irq(&pdev->dev, fdev->irq, fdev); in st_fdma_remove()
857 st_slim_rproc_put(fdev->slim_rproc); in st_fdma_remove()