Add XDMA EOP support in C2H stream.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In XDMA'isr the C2H EOP condition is checked
with the Writeback descriptor.
If true, the stream transfer considered as completed.

Signed-off-by: Eric DEBIEF <debief@xxxxxxxxxxxx>
---
 drivers/dma/xilinx/xdma-regs.h |  5 +++++
 drivers/dma/xilinx/xdma.c      | 18 +++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/xilinx/xdma-regs.h b/drivers/dma/xilinx/xdma-regs.h
index 780ac3c9d34d..5765f8f5eb96 100644
--- a/drivers/dma/xilinx/xdma-regs.h
+++ b/drivers/dma/xilinx/xdma-regs.h
@@ -100,6 +100,11 @@ struct xdma_hw_desc {
 #define XDMA_CHAN_IN_STREAM_MODE(id)    \
     (((u32)(id) & XDMA_CHAN_ID_STREAM_BIT) != 0)

+/* C2H Write back */
+#define XDMA_CHAN_C2H_WB_EOP_BIT        BIT(0)
+#define XDMA_CHAN_C2H_WB_MAGIC_VAL        (0x52B4 << 16)
+#define XDMA_CHAN_C2H_WB_MAGIC_MASK        GENMASK(31, 16)
+
 /* bits of the channel control register */
 #define CHAN_CTRL_RUN_STOP            BIT(0)
 #define CHAN_CTRL_IE_DESC_STOPPED        BIT(1)
diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
index 3c7fcad761e8..247d775ffec2 100644
--- a/drivers/dma/xilinx/xdma.c
+++ b/drivers/dma/xilinx/xdma.c
@@ -925,6 +925,22 @@ static enum dma_status xdma_tx_status(struct
dma_chan *chan, dma_cookie_t cookie
     return ret;
 }

+
+/**
+ * xdma_is_c2h_eop - C2H channel End of Packet condition status
+ * @xchan : the XDMA channel to be checked
+ */
+static bool xdma_is_c2h_eop(struct xdma_chan *xchan)
+{
+    if ((xchan->c2h_wback != NULL) &&
+    ((xchan->c2h_wback->magic_status_bit & XDMA_CHAN_C2H_WB_MAGIC_MASK) ==
+                XDMA_CHAN_C2H_WB_MAGIC_VAL)) {
+        return (xchan->c2h_wback->magic_status_bit &
XDMA_CHAN_C2H_WB_EOP_BIT) != 0;
+    } else {
+        return false;
+    }
+}
+
 /**
  * xdma_channel_isr - XDMA channel interrupt handler
  * @irq: IRQ number
@@ -941,7 +957,7 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
     u32 st;
     bool repeat_tx;

-    if (xchan->stop_requested)
+    if ((xchan->stop_requested) || xdma_is_c2h_eop(xchan))
         complete(&xchan->last_interrupt);

     spin_lock(&xchan->vchan.lock);
--
2.34.1

-- 
 
<https://www.digigram.com/digigram-critical-audio-at-eurosatory-2024-in-paris/>




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux