Re: [PATCH 1/3] dmaengine: dw-axi-dmac: dump channel registers on error

From: Ben Dooks
Date: Thu Jul 21 2022 - 18:16:38 EST


On 21/07/2022 13:30, Vinod Koul wrote:
On 08-07-22, 18:01, Ben Dooks wrote:
On channel error, dump the channel register state before
the channel's LLI entries to see what the controller was
actually doing when the error happend.

Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxx>
---
.../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 28 +++++++++++++++++++
1 file changed, 28 insertions(+)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index e9c9bcb1f5c2..75c537153e92 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -79,6 +79,20 @@ axi_chan_iowrite64(struct axi_dma_chan *chan, u32 reg, u64 val)
iowrite32(upper_32_bits(val), chan->chan_regs + reg + 4);
}
+static inline u64
+axi_chan_ioread64(struct axi_dma_chan *chan, u32 reg)
+{
+ u32 high, low;
+ u64 result;
+
+ low = ioread32(chan->chan_regs + reg);
+ high = ioread32(chan->chan_regs + reg + 4);
+
+ result = low;
+ result |= (u64)high << 32;
+ return result;
+}

Better to use helpers like lo_hi_readq()?

Will go check on those, thanks.