Lines Matching refs:dmac

214 #define for_each_rcar_dmac_chan(i, dmac, chan)						\  argument
215 for (i = 0, chan = &(dmac)->channels[0]; i < (dmac)->n_channels; i++, chan++) \
216 if (!((dmac)->channels_mask & BIT(i))) continue; else
312 static void rcar_dmac_write(struct rcar_dmac *dmac, u32 reg, u32 data) in rcar_dmac_write() argument
315 writew(data, dmac->dmac_base + reg); in rcar_dmac_write()
317 writel(data, dmac->dmac_base + reg); in rcar_dmac_write()
320 static u32 rcar_dmac_read(struct rcar_dmac *dmac, u32 reg) in rcar_dmac_read() argument
323 return readw(dmac->dmac_base + reg); in rcar_dmac_read()
325 return readl(dmac->dmac_base + reg); in rcar_dmac_read()
344 static void rcar_dmac_chan_clear(struct rcar_dmac *dmac, in rcar_dmac_chan_clear() argument
347 if (dmac->chan_base) in rcar_dmac_chan_clear()
350 rcar_dmac_write(dmac, RCAR_DMACHCLR, BIT(chan->index)); in rcar_dmac_chan_clear()
353 static void rcar_dmac_chan_clear_all(struct rcar_dmac *dmac) in rcar_dmac_chan_clear_all() argument
358 if (dmac->chan_base) { in rcar_dmac_chan_clear_all()
359 for_each_rcar_dmac_chan(i, dmac, chan) in rcar_dmac_chan_clear_all()
362 rcar_dmac_write(dmac, RCAR_DMACHCLR, dmac->channels_mask); in rcar_dmac_chan_clear_all()
476 static int rcar_dmac_init(struct rcar_dmac *dmac) in rcar_dmac_init() argument
481 rcar_dmac_chan_clear_all(dmac); in rcar_dmac_init()
482 rcar_dmac_write(dmac, RCAR_DMAOR, in rcar_dmac_init()
485 dmaor = rcar_dmac_read(dmac, RCAR_DMAOR); in rcar_dmac_init()
487 dev_warn(dmac->dev, "DMAOR initialization failed.\n"); in rcar_dmac_init()
849 static void rcar_dmac_stop_all_chan(struct rcar_dmac *dmac) in rcar_dmac_stop_all_chan() argument
855 for_each_rcar_dmac_chan(i, dmac, chan) { in rcar_dmac_stop_all_chan()
1077 struct rcar_dmac *dmac = to_rcar_dmac(chan->device); in rcar_dmac_free_chan_resources() local
1096 clear_bit(rchan->mid_rid, dmac->modules); in rcar_dmac_free_chan_resources()
1589 struct rcar_dmac *dmac = to_rcar_dmac(chan->chan.device); in rcar_dmac_isr_channel() local
1596 rcar_dmac_chan_clear(dmac, chan); in rcar_dmac_isr_channel()
1686 struct rcar_dmac *dmac = to_rcar_dmac(chan->device); in rcar_dmac_chan_filter() local
1699 return !test_and_set_bit(dma_spec->args[0], dmac->modules); in rcar_dmac_chan_filter()
1739 struct rcar_dmac *dmac = dev_get_drvdata(dev); in rcar_dmac_runtime_resume() local
1741 return rcar_dmac_init(dmac); in rcar_dmac_runtime_resume()
1761 static int rcar_dmac_chan_probe(struct rcar_dmac *dmac, in rcar_dmac_chan_probe() argument
1764 struct platform_device *pdev = to_platform_device(dmac->dev); in rcar_dmac_chan_probe()
1786 irqname = devm_kasprintf(dmac->dev, GFP_KERNEL, "%s:%u", in rcar_dmac_chan_probe()
1787 dev_name(dmac->dev), rchan->index); in rcar_dmac_chan_probe()
1795 chan->device = &dmac->engine; in rcar_dmac_chan_probe()
1798 list_add_tail(&chan->device_node, &dmac->engine.channels); in rcar_dmac_chan_probe()
1800 ret = devm_request_threaded_irq(dmac->dev, rchan->irq, in rcar_dmac_chan_probe()
1805 dev_err(dmac->dev, "failed to request IRQ %u (%d)\n", in rcar_dmac_chan_probe()
1815 static int rcar_dmac_parse_of(struct device *dev, struct rcar_dmac *dmac) in rcar_dmac_parse_of() argument
1820 ret = of_property_read_u32(np, "dma-channels", &dmac->n_channels); in rcar_dmac_parse_of()
1827 if (dmac->n_channels <= 0 || in rcar_dmac_parse_of()
1828 dmac->n_channels >= RCAR_DMAC_MAX_CHANNELS) { in rcar_dmac_parse_of()
1830 dmac->n_channels); in rcar_dmac_parse_of()
1838 dmac->channels_mask = GENMASK(dmac->n_channels - 1, 0); in rcar_dmac_parse_of()
1839 of_property_read_u32(np, "dma-channel-mask", &dmac->channels_mask); in rcar_dmac_parse_of()
1842 dmac->channels_mask &= GENMASK(dmac->n_channels - 1, 0); in rcar_dmac_parse_of()
1857 struct rcar_dmac *dmac; in rcar_dmac_probe() local
1865 dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL); in rcar_dmac_probe()
1866 if (!dmac) in rcar_dmac_probe()
1869 dmac->dev = &pdev->dev; in rcar_dmac_probe()
1870 platform_set_drvdata(pdev, dmac); in rcar_dmac_probe()
1871 dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); in rcar_dmac_probe()
1873 ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); in rcar_dmac_probe()
1877 ret = rcar_dmac_parse_of(&pdev->dev, dmac); in rcar_dmac_probe()
1890 dmac->channels_mask &= ~BIT(0); in rcar_dmac_probe()
1892 dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels, in rcar_dmac_probe()
1893 sizeof(*dmac->channels), GFP_KERNEL); in rcar_dmac_probe()
1894 if (!dmac->channels) in rcar_dmac_probe()
1898 dmac->dmac_base = devm_platform_ioremap_resource(pdev, 0); in rcar_dmac_probe()
1899 if (IS_ERR(dmac->dmac_base)) in rcar_dmac_probe()
1900 return PTR_ERR(dmac->dmac_base); in rcar_dmac_probe()
1903 dmac->chan_base = devm_platform_ioremap_resource(pdev, 1); in rcar_dmac_probe()
1904 if (IS_ERR(dmac->chan_base)) in rcar_dmac_probe()
1905 return PTR_ERR(dmac->chan_base); in rcar_dmac_probe()
1907 chan_base = dmac->chan_base; in rcar_dmac_probe()
1909 chan_base = dmac->dmac_base + data->chan_offset_base; in rcar_dmac_probe()
1912 for_each_rcar_dmac_chan(i, dmac, chan) { in rcar_dmac_probe()
1925 ret = rcar_dmac_init(dmac); in rcar_dmac_probe()
1934 engine = &dmac->engine; in rcar_dmac_probe()
1961 for_each_rcar_dmac_chan(i, dmac, chan) { in rcar_dmac_probe()
1962 ret = rcar_dmac_chan_probe(dmac, chan); in rcar_dmac_probe()
1993 struct rcar_dmac *dmac = platform_get_drvdata(pdev); in rcar_dmac_remove() local
1996 dma_async_device_unregister(&dmac->engine); in rcar_dmac_remove()
2003 struct rcar_dmac *dmac = platform_get_drvdata(pdev); in rcar_dmac_shutdown() local
2005 rcar_dmac_stop_all_chan(dmac); in rcar_dmac_shutdown()