Openwrt/target/linux/layerscape/patches-5.4/806-dma-0019-dmaengine-fsl-edma-calculate-the-real-count-for-slav.patch

71 lines
2.3 KiB
Diff
Raw Normal View History

From 7b126c5fbddf179c7d2c2393100329aa45cd8ac4 Mon Sep 17 00:00:00 2001
From: Fugang Duan <fugang.duan@nxp.com>
Date: Fri, 9 Aug 2019 15:14:08 +0800
Subject: [PATCH] dmaengine: fsl-edma: calculate the real count for slave sg
Calculate the rela count for current slave sg after eDMA stop.
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
---
drivers/dma/fsl-edma-common.c | 11 ++++++++++-
drivers/dma/fsl-edma-common.h | 2 ++
drivers/dma/fsl-edma.c | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -305,6 +305,11 @@ static size_t fsl_edma_desc_residue(stru
return len;
}
+void fsl_edma_get_realcnt(struct fsl_edma_chan *fsl_chan)
+{
+ fsl_chan->chn_real_count = fsl_edma_desc_residue(fsl_chan, NULL, true);
+}
+
enum dma_status fsl_edma_tx_status(struct dma_chan *chan,
dma_cookie_t cookie, struct dma_tx_state *txstate)
{
@@ -314,8 +319,12 @@ enum dma_status fsl_edma_tx_status(struc
unsigned long flags;
status = dma_cookie_status(chan, cookie, txstate);
- if (status == DMA_COMPLETE)
+ if (status == DMA_COMPLETE) {
+ spin_lock_irqsave(&fsl_chan->vchan.lock, flags);
+ txstate->residue = fsl_chan->chn_real_count;
+ spin_unlock_irqrestore(&fsl_chan->vchan.lock, flags);
return status;
+ }
if (!txstate)
return fsl_chan->status;
--- a/drivers/dma/fsl-edma-common.h
+++ b/drivers/dma/fsl-edma-common.h
@@ -126,6 +126,7 @@ struct fsl_edma_chan {
u32 dma_dev_size;
enum dma_data_direction dma_dir;
char chan_name[16];
+ u32 chn_real_count;
};
struct fsl_edma_desc {
@@ -229,6 +230,7 @@ int fsl_edma_pause(struct dma_chan *chan
int fsl_edma_resume(struct dma_chan *chan);
int fsl_edma_slave_config(struct dma_chan *chan,
struct dma_slave_config *cfg);
+void fsl_edma_get_realcnt(struct fsl_edma_chan *fsl_chan);
enum dma_status fsl_edma_tx_status(struct dma_chan *chan,
dma_cookie_t cookie, struct dma_tx_state *txstate);
struct dma_async_tx_descriptor *fsl_edma_prep_dma_cyclic(
--- a/drivers/dma/fsl-edma.c
+++ b/drivers/dma/fsl-edma.c
kernel: bump 5.4 to 5.4.58 This PR is a blend of several kernel bumps authored by ldir taken from his staging tree w/ some further adjustments made by me and update_kernel.sh Summary: Deleted upstreamed patches: generic: 742-v5.5-net-sfp-add-support-for-module-quirks.patch 743-v5.5-net-sfp-add-some-quirks-for-GPON-modules.patch bcm63xx: 022-v5.8-mtd-rawnand-brcmnand-correctly-verify-erased-pages.patch 024-v5.8-mtd-rawnand-brcmnand-fix-CS0-layout.patch mediatek: 0402-net-ethernet-mtk_eth_soc-Always-call-mtk_gmac0_rgmii.patch Deleted patches applied differently upstream: generic: 641-sch_cake-fix-IP-protocol-handling-in-the-presence-of.patch Manually merged patches: generic: 395-v5.8-net-sch_cake-Take-advantage-of-skb-hash-where-appropriate.patch bcm27xx: 950-0132-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch layerscape: 701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch Build system: x86_64 Build-tested: ath79/generic, bcm27xx/bcm2708, bcm27xx/bcm2711, imx6, mvebu/cortexa9, sunxi/a53 Run-tested: Netgear R7800 (ipq806x) No dmesg regressions, everything functional Signed-off-by: John Audia <graysky@archlinux.us> Tested-By: Lucian Cristian <Lucian.cristian@gmail.com> [mvebu] Tested-By: Curtis Deptuck <curtdept@me.com> [x86/64] [do not remove 395-v5.8-net-sch_cake-Take-advantage-... patch, adjust and refresh patches, adjust commit message] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Tested-By: John Audia <graysky@archlinux.us> [ipq806x]
2020-08-11 16:13:19 +00:00
@@ -53,6 +53,7 @@ static irqreturn_t fsl_edma_tx_handler(i
}
if (!fsl_chan->edesc->iscyclic) {
+ fsl_edma_get_realcnt(fsl_chan);
list_del(&fsl_chan->edesc->vdesc.node);
vchan_cookie_complete(&fsl_chan->edesc->vdesc);
fsl_chan->edesc = NULL;