Lines Matching full:dmac
7 * based on rcar-dmac.c
46 * @residue: residue after the DMAC completed a transfer
48 * @done_cookie: cookie after the DMAC completed a transfer
74 * @desc_freed: freed descriptors after the DMAC completed a transfer
95 * @channels: array of DMAC channels
151 static void usb_dmac_write(struct usb_dmac *dmac, u32 reg, u32 data) in usb_dmac_write() argument
153 writel(data, dmac->iomem + reg); in usb_dmac_write()
156 static u32 usb_dmac_read(struct usb_dmac *dmac, u32 reg) in usb_dmac_read() argument
158 return readl(dmac->iomem + reg); in usb_dmac_read()
244 static int usb_dmac_init(struct usb_dmac *dmac) in usb_dmac_init() argument
248 /* Clear all channels and enable the DMAC globally. */ in usb_dmac_init()
249 usb_dmac_write(dmac, USB_DMAOR, USB_DMAOR_DME); in usb_dmac_init()
251 dmaor = usb_dmac_read(dmac, USB_DMAOR); in usb_dmac_init()
253 dev_warn(dmac->dev, "DMAOR initialization failed.\n"); in usb_dmac_init()
346 struct usb_dmac *dmac = to_usb_dmac(chan->device); in usb_dmac_soft_reset() local
350 for (i = 0; i < dmac->n_channels; ++i) { in usb_dmac_soft_reset()
355 usb_dmac_write(dmac, USB_DMAOR, 0); in usb_dmac_soft_reset()
356 usb_dmac_write(dmac, USB_DMASWR, USB_DMASWR_SWR); in usb_dmac_soft_reset()
358 usb_dmac_write(dmac, USB_DMASWR, 0); in usb_dmac_soft_reset()
359 usb_dmac_write(dmac, USB_DMAOR, 1); in usb_dmac_soft_reset()
372 static void usb_dmac_stop(struct usb_dmac *dmac) in usb_dmac_stop() argument
374 usb_dmac_write(dmac, USB_DMAOR, 0); in usb_dmac_stop()
641 /* USB-DMAC should be used with fixed usb controller's FIFO */ in usb_dmac_chan_filter()
676 struct usb_dmac *dmac = dev_get_drvdata(dev); in usb_dmac_runtime_suspend() local
679 for (i = 0; i < dmac->n_channels; ++i) { in usb_dmac_runtime_suspend()
680 if (!dmac->channels[i].iomem) in usb_dmac_runtime_suspend()
682 usb_dmac_chan_halt(&dmac->channels[i]); in usb_dmac_runtime_suspend()
690 struct usb_dmac *dmac = dev_get_drvdata(dev); in usb_dmac_runtime_resume() local
692 return usb_dmac_init(dmac); in usb_dmac_runtime_resume()
707 static int usb_dmac_chan_probe(struct usb_dmac *dmac, in usb_dmac_chan_probe() argument
711 struct platform_device *pdev = to_platform_device(dmac->dev); in usb_dmac_chan_probe()
717 uchan->iomem = dmac->iomem + USB_DMAC_CHAN_OFFSET(index); in usb_dmac_chan_probe()
725 irqname = devm_kasprintf(dmac->dev, GFP_KERNEL, "%s:%u", in usb_dmac_chan_probe()
726 dev_name(dmac->dev), index); in usb_dmac_chan_probe()
730 ret = devm_request_irq(dmac->dev, uchan->irq, usb_dmac_isr_channel, in usb_dmac_chan_probe()
733 dev_err(dmac->dev, "failed to request IRQ %u (%d)\n", in usb_dmac_chan_probe()
739 vchan_init(&uchan->vc, &dmac->engine); in usb_dmac_chan_probe()
746 static int usb_dmac_parse_of(struct device *dev, struct usb_dmac *dmac) in usb_dmac_parse_of() argument
751 ret = of_property_read_u32(np, "dma-channels", &dmac->n_channels); in usb_dmac_parse_of()
757 if (dmac->n_channels <= 0 || dmac->n_channels >= 100) { in usb_dmac_parse_of()
759 dmac->n_channels); in usb_dmac_parse_of()
770 struct usb_dmac *dmac; in usb_dmac_probe() local
774 dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); in usb_dmac_probe()
775 if (!dmac) in usb_dmac_probe()
778 dmac->dev = &pdev->dev; in usb_dmac_probe()
779 platform_set_drvdata(pdev, dmac); in usb_dmac_probe()
781 ret = usb_dmac_parse_of(&pdev->dev, dmac); in usb_dmac_probe()
785 dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels, in usb_dmac_probe()
786 sizeof(*dmac->channels), GFP_KERNEL); in usb_dmac_probe()
787 if (!dmac->channels) in usb_dmac_probe()
791 dmac->iomem = devm_platform_ioremap_resource(pdev, 0); in usb_dmac_probe()
792 if (IS_ERR(dmac->iomem)) in usb_dmac_probe()
793 return PTR_ERR(dmac->iomem); in usb_dmac_probe()
803 ret = usb_dmac_init(dmac); in usb_dmac_probe()
811 INIT_LIST_HEAD(&dmac->engine.channels); in usb_dmac_probe()
813 for (i = 0; i < dmac->n_channels; ++i) { in usb_dmac_probe()
814 ret = usb_dmac_chan_probe(dmac, &dmac->channels[i], i); in usb_dmac_probe()
819 /* Register the DMAC as a DMA provider for DT. */ in usb_dmac_probe()
830 engine = &dmac->engine; in usb_dmac_probe()
862 static void usb_dmac_chan_remove(struct usb_dmac *dmac, in usb_dmac_chan_remove() argument
866 devm_free_irq(dmac->dev, uchan->irq, uchan); in usb_dmac_chan_remove()
871 struct usb_dmac *dmac = platform_get_drvdata(pdev); in usb_dmac_remove() local
874 for (i = 0; i < dmac->n_channels; ++i) in usb_dmac_remove()
875 usb_dmac_chan_remove(dmac, &dmac->channels[i]); in usb_dmac_remove()
877 dma_async_device_unregister(&dmac->engine); in usb_dmac_remove()
884 struct usb_dmac *dmac = platform_get_drvdata(pdev); in usb_dmac_shutdown() local
886 usb_dmac_stop(dmac); in usb_dmac_shutdown()
890 { .compatible = "renesas,usb-dmac", },
898 .name = "usb-dmac",