Lines Matching refs:atxdmac

310 static inline void __iomem *at_xdmac_chan_reg_base(struct at_xdmac *atxdmac, unsigned int chan_nb)  in at_xdmac_chan_reg_base()  argument
312 return atxdmac->regs + (atxdmac->layout->chan_cc_reg_base + chan_nb * 0x40); in at_xdmac_chan_reg_base()
315 #define at_xdmac_read(atxdmac, reg) readl_relaxed((atxdmac)->regs + (reg)) argument
316 #define at_xdmac_write(atxdmac, reg, value) \ argument
317 writel_relaxed((value), (atxdmac)->regs + (reg))
375 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_runtime_suspend_descriptors() local
382 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_runtime_suspend_descriptors()
383 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_runtime_suspend_descriptors()
389 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_runtime_resume_descriptors() local
397 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_runtime_resume_descriptors()
407 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_chan_is_enabled() local
410 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_chan_is_enabled()
416 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_chan_is_enabled()
417 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_chan_is_enabled()
422 static void at_xdmac_off(struct at_xdmac *atxdmac, bool suspend_descriptors) in at_xdmac_off() argument
428 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_off()
432 at_xdmac_write(atxdmac, AT_XDMAC_GD, -1L); in at_xdmac_off()
435 while (at_xdmac_read(atxdmac, AT_XDMAC_GS)) in at_xdmac_off()
438 at_xdmac_write(atxdmac, AT_XDMAC_GID, -1L); in at_xdmac_off()
441 if (!list_empty(&atxdmac->dma.channels) && suspend_descriptors) { in at_xdmac_off()
442 list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, in at_xdmac_off()
449 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_off()
450 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_off()
457 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_start_xfer() local
461 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_start_xfer()
472 if (atxdmac->layout->sdif) in at_xdmac_start_xfer()
529 at_xdmac_write(atxdmac, AT_XDMAC_GIE, atchan->mask); in at_xdmac_start_xfer()
533 at_xdmac_write(atxdmac, AT_XDMAC_GE, atchan->mask); in at_xdmac_start_xfer()
568 struct at_xdmac *atxdmac = to_at_xdmac(chan->device); in at_xdmac_alloc_desc() local
571 desc = dma_pool_zalloc(atxdmac->at_xdmac_desc_pool, gfp_flags, &phys); in at_xdmac_alloc_desc()
638 struct at_xdmac *atxdmac = of_dma->of_dma_data; in at_xdmac_xlate() local
641 struct device *dev = atxdmac->dma.dev; in at_xdmac_xlate()
648 chan = dma_get_any_slave_channel(&atxdmac->dma); in at_xdmac_xlate()
668 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_compute_chan_conf() local
680 if (atxdmac->layout->sdif) in at_xdmac_compute_chan_conf()
705 if (atxdmac->layout->sdif) in at_xdmac_compute_chan_conf()
1542 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_tx_status() local
1556 pm_status = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_tx_status()
1590 at_xdmac_write(atxdmac, atxdmac->layout->gswf, atchan->mask); in at_xdmac_tx_status()
1648 at_xdmac_write(atxdmac, atxdmac->layout->gswf, atchan->mask); in at_xdmac_tx_status()
1677 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_tx_status()
1678 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_tx_status()
1723 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_handle_error() local
1727 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_handle_error()
1745 at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); in at_xdmac_handle_error()
1746 while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask) in at_xdmac_handle_error()
1759 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_handle_error()
1760 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_handle_error()
1768 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_tasklet() local
1823 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_tasklet()
1824 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_tasklet()
1829 struct at_xdmac *atxdmac = (struct at_xdmac *)dev_id; in at_xdmac_interrupt() local
1836 imr = at_xdmac_read(atxdmac, AT_XDMAC_GIM); in at_xdmac_interrupt()
1837 status = at_xdmac_read(atxdmac, AT_XDMAC_GIS); in at_xdmac_interrupt()
1840 dev_vdbg(atxdmac->dma.dev, in at_xdmac_interrupt()
1848 for (i = 0; i < atxdmac->dma.chancnt; i++) { in at_xdmac_interrupt()
1852 atchan = &atxdmac->chan[i]; in at_xdmac_interrupt()
1856 dev_vdbg(atxdmac->dma.dev, in at_xdmac_interrupt()
1870 at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); in at_xdmac_interrupt()
1911 static void at_xdmac_device_pause_set(struct at_xdmac *atxdmac, in at_xdmac_device_pause_set() argument
1914 at_xdmac_write(atxdmac, atxdmac->layout->grws, atchan->mask); in at_xdmac_device_pause_set()
1922 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_device_pause_internal() local
1927 at_xdmac_device_pause_set(atxdmac, atchan); in at_xdmac_device_pause_internal()
1934 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_device_pause() local
1943 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_device_pause()
1949 at_xdmac_device_pause_set(atxdmac, atchan); in at_xdmac_device_pause()
1955 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_device_pause()
1956 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_device_pause()
1963 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_device_resume_internal() local
1967 at_xdmac_write(atxdmac, atxdmac->layout->grwr, atchan->mask); in at_xdmac_device_resume_internal()
1975 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_device_resume() local
1981 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_device_resume()
1994 at_xdmac_write(atxdmac, atxdmac->layout->grwr, atchan->mask); in at_xdmac_device_resume()
1999 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_device_resume()
2000 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_device_resume()
2009 struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device); in at_xdmac_device_terminate_all() local
2015 ret = pm_runtime_resume_and_get(atxdmac->dev); in at_xdmac_device_terminate_all()
2020 at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); in at_xdmac_device_terminate_all()
2021 while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask) in at_xdmac_device_terminate_all()
2035 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_device_terminate_all()
2036 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_device_terminate_all()
2044 pm_runtime_mark_last_busy(atxdmac->dev); in at_xdmac_device_terminate_all()
2045 pm_runtime_put_autosuspend(atxdmac->dev); in at_xdmac_device_terminate_all()
2093 struct at_xdmac *atxdmac = to_at_xdmac(chan->device); in at_xdmac_free_chan_resources() local
2099 dma_pool_free(atxdmac->at_xdmac_desc_pool, desc, desc->tx_dma_desc.phys); in at_xdmac_free_chan_resources()
2107 struct at_xdmac *atxdmac = (struct at_xdmac *)platform_get_drvdata(pdev); in at_xdmac_axi_config() local
2111 if (!atxdmac->layout->axi_config) in at_xdmac_axi_config()
2121 at_xdmac_write(atxdmac, AT_XDMAC_GCFG, AT_XDMAC_GCFG_M2M); in at_xdmac_axi_config()
2122 at_xdmac_write(atxdmac, AT_XDMAC_GWAC, AT_XDMAC_GWAC_M2M); in at_xdmac_axi_config()
2124 at_xdmac_write(atxdmac, AT_XDMAC_GCFG, AT_XDMAC_GCFG_P2M); in at_xdmac_axi_config()
2125 at_xdmac_write(atxdmac, AT_XDMAC_GWAC, AT_XDMAC_GWAC_P2M); in at_xdmac_axi_config()
2131 struct at_xdmac *atxdmac = dev_get_drvdata(dev); in atmel_xdmac_prepare() local
2134 list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { in atmel_xdmac_prepare()
2146 struct at_xdmac *atxdmac = dev_get_drvdata(dev); in atmel_xdmac_suspend() local
2150 ret = pm_runtime_resume_and_get(atxdmac->dev); in atmel_xdmac_suspend()
2154 list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { in atmel_xdmac_suspend()
2170 atxdmac->save_gim = at_xdmac_read(atxdmac, AT_XDMAC_GIM); in atmel_xdmac_suspend()
2171 atxdmac->save_gs = at_xdmac_read(atxdmac, AT_XDMAC_GS); in atmel_xdmac_suspend()
2173 at_xdmac_off(atxdmac, false); in atmel_xdmac_suspend()
2174 pm_runtime_mark_last_busy(atxdmac->dev); in atmel_xdmac_suspend()
2175 pm_runtime_put_noidle(atxdmac->dev); in atmel_xdmac_suspend()
2176 clk_disable_unprepare(atxdmac->clk); in atmel_xdmac_suspend()
2183 struct at_xdmac *atxdmac = dev_get_drvdata(dev); in atmel_xdmac_resume() local
2189 ret = clk_prepare_enable(atxdmac->clk); in atmel_xdmac_resume()
2193 pm_runtime_get_noresume(atxdmac->dev); in atmel_xdmac_resume()
2198 for (i = 0; i < atxdmac->dma.chancnt; i++) { in atmel_xdmac_resume()
2199 atchan = &atxdmac->chan[i]; in atmel_xdmac_resume()
2204 at_xdmac_write(atxdmac, AT_XDMAC_GIE, atxdmac->save_gim); in atmel_xdmac_resume()
2205 list_for_each_entry_safe(chan, _chan, &atxdmac->dma.channels, device_node) { in atmel_xdmac_resume()
2227 at_xdmac_device_pause_set(atxdmac, atchan); in atmel_xdmac_resume()
2233 if (atxdmac->save_gs & atchan->mask) in atmel_xdmac_resume()
2234 at_xdmac_write(atxdmac, AT_XDMAC_GE, atchan->mask); in atmel_xdmac_resume()
2238 pm_runtime_mark_last_busy(atxdmac->dev); in atmel_xdmac_resume()
2239 pm_runtime_put_autosuspend(atxdmac->dev); in atmel_xdmac_resume()
2246 struct at_xdmac *atxdmac = dev_get_drvdata(dev); in atmel_xdmac_runtime_suspend() local
2248 clk_disable(atxdmac->clk); in atmel_xdmac_runtime_suspend()
2255 struct at_xdmac *atxdmac = dev_get_drvdata(dev); in atmel_xdmac_runtime_resume() local
2257 return clk_enable(atxdmac->clk); in atmel_xdmac_runtime_resume()
2262 struct at_xdmac *atxdmac; in at_xdmac_probe() local
2288 atxdmac = devm_kzalloc(&pdev->dev, in at_xdmac_probe()
2289 struct_size(atxdmac, chan, nr_channels), in at_xdmac_probe()
2291 if (!atxdmac) { in at_xdmac_probe()
2296 atxdmac->regs = base; in at_xdmac_probe()
2297 atxdmac->irq = irq; in at_xdmac_probe()
2298 atxdmac->dev = &pdev->dev; in at_xdmac_probe()
2300 atxdmac->layout = of_device_get_match_data(&pdev->dev); in at_xdmac_probe()
2301 if (!atxdmac->layout) in at_xdmac_probe()
2304 atxdmac->clk = devm_clk_get(&pdev->dev, "dma_clk"); in at_xdmac_probe()
2305 if (IS_ERR(atxdmac->clk)) { in at_xdmac_probe()
2307 return PTR_ERR(atxdmac->clk); in at_xdmac_probe()
2311 ret = request_irq(atxdmac->irq, at_xdmac_interrupt, 0, "at_xdmac", atxdmac); in at_xdmac_probe()
2317 ret = clk_prepare_enable(atxdmac->clk); in at_xdmac_probe()
2323 atxdmac->at_xdmac_desc_pool = in at_xdmac_probe()
2326 if (!atxdmac->at_xdmac_desc_pool) { in at_xdmac_probe()
2332 dma_cap_set(DMA_CYCLIC, atxdmac->dma.cap_mask); in at_xdmac_probe()
2333 dma_cap_set(DMA_INTERLEAVE, atxdmac->dma.cap_mask); in at_xdmac_probe()
2334 dma_cap_set(DMA_MEMCPY, atxdmac->dma.cap_mask); in at_xdmac_probe()
2335 dma_cap_set(DMA_MEMSET, atxdmac->dma.cap_mask); in at_xdmac_probe()
2336 dma_cap_set(DMA_MEMSET_SG, atxdmac->dma.cap_mask); in at_xdmac_probe()
2337 dma_cap_set(DMA_SLAVE, atxdmac->dma.cap_mask); in at_xdmac_probe()
2342 dma_cap_set(DMA_PRIVATE, atxdmac->dma.cap_mask); in at_xdmac_probe()
2343 atxdmac->dma.dev = &pdev->dev; in at_xdmac_probe()
2344 atxdmac->dma.device_alloc_chan_resources = at_xdmac_alloc_chan_resources; in at_xdmac_probe()
2345 atxdmac->dma.device_free_chan_resources = at_xdmac_free_chan_resources; in at_xdmac_probe()
2346 atxdmac->dma.device_tx_status = at_xdmac_tx_status; in at_xdmac_probe()
2347 atxdmac->dma.device_issue_pending = at_xdmac_issue_pending; in at_xdmac_probe()
2348 atxdmac->dma.device_prep_dma_cyclic = at_xdmac_prep_dma_cyclic; in at_xdmac_probe()
2349 atxdmac->dma.device_prep_interleaved_dma = at_xdmac_prep_interleaved; in at_xdmac_probe()
2350 atxdmac->dma.device_prep_dma_memcpy = at_xdmac_prep_dma_memcpy; in at_xdmac_probe()
2351 atxdmac->dma.device_prep_dma_memset = at_xdmac_prep_dma_memset; in at_xdmac_probe()
2352 atxdmac->dma.device_prep_dma_memset_sg = at_xdmac_prep_dma_memset_sg; in at_xdmac_probe()
2353 atxdmac->dma.device_prep_slave_sg = at_xdmac_prep_slave_sg; in at_xdmac_probe()
2354 atxdmac->dma.device_config = at_xdmac_device_config; in at_xdmac_probe()
2355 atxdmac->dma.device_pause = at_xdmac_device_pause; in at_xdmac_probe()
2356 atxdmac->dma.device_resume = at_xdmac_device_resume; in at_xdmac_probe()
2357 atxdmac->dma.device_terminate_all = at_xdmac_device_terminate_all; in at_xdmac_probe()
2358 atxdmac->dma.src_addr_widths = AT_XDMAC_DMA_BUSWIDTHS; in at_xdmac_probe()
2359 atxdmac->dma.dst_addr_widths = AT_XDMAC_DMA_BUSWIDTHS; in at_xdmac_probe()
2360 atxdmac->dma.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); in at_xdmac_probe()
2361 atxdmac->dma.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; in at_xdmac_probe()
2363 platform_set_drvdata(pdev, atxdmac); in at_xdmac_probe()
2372 INIT_LIST_HEAD(&atxdmac->dma.channels); in at_xdmac_probe()
2375 at_xdmac_off(atxdmac, true); in at_xdmac_probe()
2378 struct at_xdmac_chan *atchan = &atxdmac->chan[i]; in at_xdmac_probe()
2380 atchan->chan.device = &atxdmac->dma; in at_xdmac_probe()
2382 &atxdmac->dma.channels); in at_xdmac_probe()
2384 atchan->ch_regs = at_xdmac_chan_reg_base(atxdmac, i); in at_xdmac_probe()
2397 ret = dma_async_device_register(&atxdmac->dma); in at_xdmac_probe()
2404 at_xdmac_xlate, atxdmac); in at_xdmac_probe()
2411 nr_channels, atxdmac->regs); in at_xdmac_probe()
2421 dma_async_device_unregister(&atxdmac->dma); in at_xdmac_probe()
2428 clk_disable_unprepare(atxdmac->clk); in at_xdmac_probe()
2430 free_irq(atxdmac->irq, atxdmac); in at_xdmac_probe()
2436 struct at_xdmac *atxdmac = (struct at_xdmac *)platform_get_drvdata(pdev); in at_xdmac_remove() local
2439 at_xdmac_off(atxdmac, true); in at_xdmac_remove()
2441 dma_async_device_unregister(&atxdmac->dma); in at_xdmac_remove()
2442 pm_runtime_disable(atxdmac->dev); in at_xdmac_remove()
2445 clk_disable_unprepare(atxdmac->clk); in at_xdmac_remove()
2447 free_irq(atxdmac->irq, atxdmac); in at_xdmac_remove()
2449 for (i = 0; i < atxdmac->dma.chancnt; i++) { in at_xdmac_remove()
2450 struct at_xdmac_chan *atchan = &atxdmac->chan[i]; in at_xdmac_remove()