|
12 | 12 | #include <linux/dma-mapping.h>
|
13 | 13 | #include <linux/dmaengine.h>
|
14 | 14 | #include <linux/interrupt.h>
|
| 15 | +#include <linux/iopoll.h> |
15 | 16 | #include <linux/list.h>
|
16 | 17 | #include <linux/module.h>
|
17 | 18 | #include <linux/of.h>
|
@@ -630,6 +631,21 @@ static void rz_dmac_virt_desc_free(struct virt_dma_desc *vd)
|
630 | 631 | */
|
631 | 632 | }
|
632 | 633 |
|
| 634 | +static void rz_dmac_device_synchronize(struct dma_chan *chan) |
| 635 | +{ |
| 636 | + struct rz_dmac_chan *channel = to_rz_dmac_chan(chan); |
| 637 | + struct rz_dmac *dmac = to_rz_dmac(chan->device); |
| 638 | + u32 chstat; |
| 639 | + int ret; |
| 640 | + |
| 641 | + ret = read_poll_timeout(rz_dmac_ch_readl, chstat, !(chstat & CHSTAT_EN), |
| 642 | + 100, 100000, false, channel, CHSTAT, 1); |
| 643 | + if (ret < 0) |
| 644 | + dev_warn(dmac->dev, "DMA Timeout"); |
| 645 | + |
| 646 | + rz_dmac_set_dmars_register(dmac, channel->index, 0); |
| 647 | +} |
| 648 | + |
633 | 649 | /*
|
634 | 650 | * -----------------------------------------------------------------------------
|
635 | 651 | * IRQ handling
|
@@ -909,6 +925,7 @@ static int rz_dmac_probe(struct platform_device *pdev)
|
909 | 925 | engine->device_config = rz_dmac_config;
|
910 | 926 | engine->device_terminate_all = rz_dmac_terminate_all;
|
911 | 927 | engine->device_issue_pending = rz_dmac_issue_pending;
|
| 928 | + engine->device_synchronize = rz_dmac_device_synchronize; |
912 | 929 |
|
913 | 930 | engine->copy_align = DMAENGINE_ALIGN_1_BYTE;
|
914 | 931 | dma_set_max_seg_size(engine->dev, U32_MAX);
|
|
0 commit comments