@@ -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)
@@ -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;
+ }
+}
+
/**