Lines Matching refs:fdev

37 	struct st_fdma_dev *fdev = fchan->fdev;  in st_fdma_dreq_get()  local
48 if (fdev->dreq_mask == ~0L) { in st_fdma_dreq_get()
49 dev_err(fdev->dev, "No req lines available\n"); in st_fdma_dreq_get()
54 dev_err(fdev->dev, "Invalid or used req line\n"); in st_fdma_dreq_get()
61 } while (test_and_set_bit(dreq_line, &fdev->dreq_mask)); in st_fdma_dreq_get()
63 dev_dbg(fdev->dev, "get dreq_line:%d mask:%#lx\n", in st_fdma_dreq_get()
64 dreq_line, fdev->dreq_mask); in st_fdma_dreq_get()
71 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_dreq_put() local
73 dev_dbg(fdev->dev, "put dreq_line:%#x\n", fchan->dreq_line); in st_fdma_dreq_put()
74 clear_bit(fchan->dreq_line, &fdev->dreq_mask); in st_fdma_dreq_put()
95 fchan->fdev->slim_rproc->peri + FDMA_CMD_SET_OFST); in st_fdma_xfer_desc()
97 dev_dbg(fchan->fdev->dev, "start chan:%d\n", fchan->vchan.chan.chan_id); in st_fdma_xfer_desc()
105 struct st_fdma_dev *fdev = fchan->fdev; in st_fdma_ch_sta_update() local
112 dev_warn(fdev->dev, "chan:%d, error:%ld\n", ch_id, ch_err); in st_fdma_ch_sta_update()
130 struct st_fdma_dev *fdev = dev_id; in st_fdma_irq_handler() local
132 struct st_fdma_chan *fchan = &fdev->chans[0]; in st_fdma_irq_handler()
135 int_sta = fdma_read(fdev, FDMA_INT_STA_OFST); in st_fdma_irq_handler()
164 fdma_write(fdev, clr, FDMA_INT_CLR_OFST); in st_fdma_irq_handler()
172 struct st_fdma_dev *fdev = ofdma->of_dma_data; in st_fdma_of_xlate() local
180 if (fdev->dma_device.dev->of_node != dma_spec->np) in st_fdma_of_xlate()
183 ret = rproc_boot(fdev->slim_rproc->rproc); in st_fdma_of_xlate()
189 chan = dma_get_any_slave_channel(&fdev->dma_device); in st_fdma_of_xlate()
217 dev_dbg(fdev->dev, "xlate req_line:%d type:%d req_ctrl:%#lx\n", in st_fdma_of_xlate()
223 rproc_shutdown(fdev->slim_rproc->rproc); in st_fdma_of_xlate()
275 fchan->fdev->dev, in st_fdma_alloc_chan_res()
281 dev_err(fchan->fdev->dev, "unable to allocate desc pool\n"); in st_fdma_alloc_chan_res()
285 dev_dbg(fchan->fdev->dev, "alloc ch_id:%d type:%d\n", in st_fdma_alloc_chan_res()
294 struct rproc *rproc = fchan->fdev->slim_rproc->rproc; in st_fdma_free_chan_res()
299 dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n", in st_fdma_free_chan_res()
332 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_dma_memcpy()
358 struct st_fdma_dev *fdev = fchan->fdev; in config_reqctrl() local
411 dev_dbg(fdev->dev, "chan:%d config_reqctrl:%#x req_ctrl:%#lx\n", in config_reqctrl()
446 dev_err(fchan->fdev->dev, "bad direction?\n"); in st_fdma_prep_common()
470 dev_err(fchan->fdev->dev, "bad width or direction\n"); in st_fdma_prep_dma_cyclic()
476 dev_err(fchan->fdev->dev, "len is not multiple of period\n"); in st_fdma_prep_dma_cyclic()
483 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_dma_cyclic()
532 dev_err(fchan->fdev->dev, "no memory for desc\n"); in st_fdma_prep_slave_sg()
634 dev_dbg(fchan->fdev->dev, "pause chan:%d\n", ch_id); in st_fdma_pause()
638 fdma_write(fchan->fdev, cmd, FDMA_CMD_SET_OFST); in st_fdma_pause()
651 dev_dbg(fchan->fdev->dev, "resume chan:%d\n", ch_id); in st_fdma_resume()
672 dev_dbg(fchan->fdev->dev, "terminate chan:%d\n", ch_id); in st_fdma_terminate_all()
675 fdma_write(fchan->fdev, cmd, FDMA_CMD_SET_OFST); in st_fdma_terminate_all()
721 struct st_fdma_dev *fdev) in st_fdma_parse_dt() argument
723 snprintf(fdev->fw_name, FW_NAME_SIZE, "fdma_%s_%d.elf", in st_fdma_parse_dt()
727 &fdev->nr_channels); in st_fdma_parse_dt()
734 static void st_fdma_free(struct st_fdma_dev *fdev) in st_fdma_free() argument
739 for (i = 0; i < fdev->nr_channels; i++) { in st_fdma_free()
740 fchan = &fdev->chans[i]; in st_fdma_free()
748 struct st_fdma_dev *fdev; in st_fdma_probe() local
762 fdev = devm_kzalloc(&pdev->dev, sizeof(*fdev), GFP_KERNEL); in st_fdma_probe()
763 if (!fdev) in st_fdma_probe()
766 ret = st_fdma_parse_dt(pdev, drvdata, fdev); in st_fdma_probe()
772 fdev->chans = devm_kcalloc(&pdev->dev, fdev->nr_channels, in st_fdma_probe()
774 if (!fdev->chans) in st_fdma_probe()
777 fdev->dev = &pdev->dev; in st_fdma_probe()
778 fdev->drvdata = drvdata; in st_fdma_probe()
779 platform_set_drvdata(pdev, fdev); in st_fdma_probe()
781 fdev->irq = platform_get_irq(pdev, 0); in st_fdma_probe()
782 if (fdev->irq < 0) { in st_fdma_probe()
787 ret = devm_request_irq(&pdev->dev, fdev->irq, st_fdma_irq_handler, 0, in st_fdma_probe()
788 dev_name(&pdev->dev), fdev); in st_fdma_probe()
794 fdev->slim_rproc = st_slim_rproc_alloc(pdev, fdev->fw_name); in st_fdma_probe()
795 if (IS_ERR(fdev->slim_rproc)) { in st_fdma_probe()
796 ret = PTR_ERR(fdev->slim_rproc); in st_fdma_probe()
802 INIT_LIST_HEAD(&fdev->dma_device.channels); in st_fdma_probe()
803 for (i = 0; i < fdev->nr_channels; i++) { in st_fdma_probe()
804 struct st_fdma_chan *fchan = &fdev->chans[i]; in st_fdma_probe()
806 fchan->fdev = fdev; in st_fdma_probe()
808 vchan_init(&fchan->vchan, &fdev->dma_device); in st_fdma_probe()
812 fdev->dreq_mask = BIT(0) | BIT(31); in st_fdma_probe()
814 dma_cap_set(DMA_SLAVE, fdev->dma_device.cap_mask); in st_fdma_probe()
815 dma_cap_set(DMA_CYCLIC, fdev->dma_device.cap_mask); in st_fdma_probe()
816 dma_cap_set(DMA_MEMCPY, fdev->dma_device.cap_mask); in st_fdma_probe()
818 fdev->dma_device.dev = &pdev->dev; in st_fdma_probe()
819 fdev->dma_device.device_alloc_chan_resources = st_fdma_alloc_chan_res; in st_fdma_probe()
820 fdev->dma_device.device_free_chan_resources = st_fdma_free_chan_res; in st_fdma_probe()
821 fdev->dma_device.device_prep_dma_cyclic = st_fdma_prep_dma_cyclic; in st_fdma_probe()
822 fdev->dma_device.device_prep_slave_sg = st_fdma_prep_slave_sg; in st_fdma_probe()
823 fdev->dma_device.device_prep_dma_memcpy = st_fdma_prep_dma_memcpy; in st_fdma_probe()
824 fdev->dma_device.device_tx_status = st_fdma_tx_status; in st_fdma_probe()
825 fdev->dma_device.device_issue_pending = st_fdma_issue_pending; in st_fdma_probe()
826 fdev->dma_device.device_terminate_all = st_fdma_terminate_all; in st_fdma_probe()
827 fdev->dma_device.device_config = st_fdma_slave_config; in st_fdma_probe()
828 fdev->dma_device.device_pause = st_fdma_pause; in st_fdma_probe()
829 fdev->dma_device.device_resume = st_fdma_resume; in st_fdma_probe()
831 fdev->dma_device.src_addr_widths = FDMA_DMA_BUSWIDTHS; in st_fdma_probe()
832 fdev->dma_device.dst_addr_widths = FDMA_DMA_BUSWIDTHS; in st_fdma_probe()
833 fdev->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); in st_fdma_probe()
834 fdev->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; in st_fdma_probe()
836 ret = dma_async_device_register(&fdev->dma_device); in st_fdma_probe()
843 ret = of_dma_controller_register(np, st_fdma_of_xlate, fdev); in st_fdma_probe()
850 dev_info(&pdev->dev, "ST FDMA engine driver, irq:%d\n", fdev->irq); in st_fdma_probe()
855 dma_async_device_unregister(&fdev->dma_device); in st_fdma_probe()
857 st_fdma_free(fdev); in st_fdma_probe()
858 st_slim_rproc_put(fdev->slim_rproc); in st_fdma_probe()
865 struct st_fdma_dev *fdev = platform_get_drvdata(pdev); in st_fdma_remove() local
867 devm_free_irq(&pdev->dev, fdev->irq, fdev); in st_fdma_remove()
868 st_slim_rproc_put(fdev->slim_rproc); in st_fdma_remove()
870 dma_async_device_unregister(&fdev->dma_device); in st_fdma_remove()