dma: Introduce DMA register dump.
authorJaejoon Yoo <joonyj7.yoo@samsung.com>
Tue, 2 Aug 2016 02:17:09 +0000 (11:17 +0900)
committerTaekki Kim <taekki.kim@samsung.com>
Mon, 14 May 2018 05:42:47 +0000 (14:42 +0900)
Change-Id: I4316c39a062fb862450c5e3bb9ff21055aade6e0
Signed-off-by: Jaejoon Yoo <joonyj7.yoo@samsung.com>
drivers/dma/pl330.c
include/linux/amba/pl330.h
include/linux/dma/dma-pl330.h

index 6b202c755aea94300ae24910109a21a872555b55..de43a520e550a36c5381babe832655976b4f7a3b 100644 (file)
@@ -277,6 +277,12 @@ static unsigned cmd_line;
 #define PL330_DBGMC_START(addr)                do {} while (0)
 #endif
 
+#ifdef CONFIG_DMADEVICES_DEBUG
+#define DBG_PRINT(x...)                exynos_ss_printk(x);
+#else
+#define DBG_PRINT(x...)                do {} while (0)
+#endif
+
 /* The number of default descriptors */
 
 #define NR_DEFAULT_DESC        16
@@ -2173,11 +2179,13 @@ static void pl330_tasklet(unsigned long data)
 
                dma_descriptor_unmap(&desc->txd);
 
+               DBG_PRINT("[%s] before callback\n", __func__);
                if (dmaengine_desc_callback_valid(&cb)) {
                        spin_unlock_irqrestore(&pch->lock, flags);
                        dmaengine_desc_callback_invoke(&cb, NULL);
                        spin_lock_irqsave(&pch->lock, flags);
                }
+               DBG_PRINT("[%s] after callback\n", __func__);
        }
        spin_unlock_irqrestore(&pch->lock, flags);
 
@@ -2938,6 +2946,38 @@ static irqreturn_t pl330_irq_handler(int irq, void *data)
                return IRQ_NONE;
 }
 
+int pl330_dma_debug(struct dma_chan *chan)
+{
+       struct dma_pl330_chan *pch = to_pchan(chan);
+       void __iomem *regs;
+       struct pl330_thread *thrd;
+
+       if (unlikely(!pch))
+               return -EINVAL;
+
+       thrd = pch->thread;
+       regs = &pch->dmac->base;
+
+       dev_info(pch->dmac->ddma.dev,"[ DMA Register Dump(id: %d) ]\n", thrd->id);
+       dev_info(pch->dmac->ddma.dev,"DAR:0x%x\n", readl(regs + DA(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"SAR:0x%x\n", readl(regs + SA(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"DBGSTATUS:0x%x\n", readl(regs + DBGSTATUS));
+       dev_info(pch->dmac->ddma.dev,"INTMIS:0x%x\n", readl(regs + INTSTATUS));
+       dev_info(pch->dmac->ddma.dev,"DSR:0x%x\n", readl(regs + DS));
+       dev_info(pch->dmac->ddma.dev,"CCR:0x%x\n", readl(regs + CC(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"CSR:0x%x\n", readl(regs + CS(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"CRD:0x%x\n", readl(regs + CRD));
+       dev_info(pch->dmac->ddma.dev,"LC0:0x%x\n", readl(regs + LC0(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"LC1:0x%x\n", readl(regs + LC1(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"FTR:0x%x\n", readl(regs + FTC(thrd->id)));
+       dev_info(pch->dmac->ddma.dev,"FTRD:0x%x\n", readl(regs + FTM));
+       dev_info(pch->dmac->ddma.dev,"FSRC:0x%x\n", readl(regs + FSC));
+       dev_info(pch->dmac->ddma.dev,"FSRD:0x%x\n", readl(regs + FSM));
+
+       return 0;
+}
+EXPORT_SYMBOL(pl330_dma_debug);
+
 int pl330_dma_getposition(struct dma_chan *chan,
                dma_addr_t *src, dma_addr_t *dst)
 {
index c95df58e0e7af6d345b0e31bf3d5308edc6ae719..16f5027b51ed78fb10b8a1d360111d94e741dcbf 100644 (file)
@@ -34,4 +34,5 @@ struct dma_pl330_platdata {
 extern bool pl330_filter(struct dma_chan *chan, void *param);
 extern int pl330_dma_getposition(struct dma_chan *chan,
                dma_addr_t *src, dma_addr_t *dst);
+extern int pl330_dma_debug(struct dma_chan *chan);
 #endif /* __AMBA_PL330_H_ */
index 2b8158aaea4e494ec7272a0a8c0e74e5702613a0..5e289113cd7b58db50e16b53209f7a2de0ccca1b 100644 (file)
@@ -11,8 +11,6 @@
 #ifndef __DMA_PL330_H_
 #define __DMA_PL330_H_ __FILE__
 
-#include <linux/dmaengine.h>
-
 /*
  * PL330 can assign any channel to communicate with
  * any of the peripherals attched to the DMAC.
  * use these just as IDs.
  */
 enum dma_ch {
-       DMACH_MAX = 0,
+       DMACH_UART0_RX = 0,
+       DMACH_UART0_TX,
+       DMACH_UART1_RX,
+       DMACH_UART1_TX,
+       DMACH_UART2_RX,
+       DMACH_UART2_TX,
+       DMACH_UART3_RX,
+       DMACH_UART3_TX,
+       DMACH_UART4_RX,
+       DMACH_UART4_TX,
+       DMACH_UART5_RX,
+       DMACH_UART5_TX,
+       DMACH_USI_RX,
+       DMACH_USI_TX,
+       DMACH_IRDA,
+       DMACH_I2S0_RX,
+       DMACH_I2S0_TX,
+       DMACH_I2S0S_TX,
+       DMACH_I2S1_RX,
+       DMACH_I2S1_TX,
+       DMACH_I2S2_RX,
+       DMACH_I2S2_TX,
+       DMACH_SPI0_RX,
+       DMACH_SPI0_TX,
+       DMACH_SPI1_RX,
+       DMACH_SPI1_TX,
+       DMACH_SPI2_RX,
+       DMACH_SPI2_TX,
+       DMACH_AC97_MICIN,
+       DMACH_AC97_PCMIN,
+       DMACH_AC97_PCMOUT,
+       DMACH_EXTERNAL,
+       DMACH_PWM,
+       DMACH_SPDIF,
+       DMACH_HSI_RX,
+       DMACH_HSI_TX,
+       DMACH_PCM0_TX,
+       DMACH_PCM0_RX,
+       DMACH_PCM1_TX,
+       DMACH_PCM1_RX,
+       DMACH_PCM2_TX,
+       DMACH_PCM2_RX,
+       DMACH_MSM_REQ3,
+       DMACH_MSM_REQ2,
+       DMACH_MSM_REQ1,
+       DMACH_MSM_REQ0,
+       DMACH_SLIMBUS0_RX,
+       DMACH_SLIMBUS0_TX,
+       DMACH_SLIMBUS0AUX_RX,
+       DMACH_SLIMBUS0AUX_TX,
+       DMACH_SLIMBUS1_RX,
+       DMACH_SLIMBUS1_TX,
+       DMACH_SLIMBUS2_RX,
+       DMACH_SLIMBUS2_TX,
+       DMACH_SLIMBUS3_RX,
+       DMACH_SLIMBUS3_TX,
+       DMACH_SLIMBUS4_RX,
+       DMACH_SLIMBUS4_TX,
+       DMACH_SLIMBUS5_RX,
+       DMACH_SLIMBUS5_TX,
+       DMACH_MIPI_HSI0,
+       DMACH_MIPI_HSI1,
+       DMACH_MIPI_HSI2,
+       DMACH_MIPI_HSI3,
+       DMACH_MIPI_HSI4,
+       DMACH_MIPI_HSI5,
+       DMACH_MIPI_HSI6,
+       DMACH_MIPI_HSI7,
+       DMACH_DISP1,
+       DMACH_MTOM_0,
+       DMACH_MTOM_1,
+       DMACH_MTOM_2,
+       DMACH_MTOM_3,
+       DMACH_MTOM_4,
+       DMACH_MTOM_5,
+       DMACH_MTOM_6,
+       DMACH_MTOM_7,
+       /* END Marker, also used to denote a reserved channel */
+       DMACH_MAX,
 };
 
 struct s3c2410_dma_client {
@@ -45,6 +121,8 @@ static inline bool samsung_dma_has_infiniteloop(void)
        return true;
 }
 
+#include <linux/dmaengine.h>
+
 struct samsung_dma_req {
        enum dma_transaction_type cap;
        struct s3c2410_dma_client *client;
@@ -82,24 +160,25 @@ struct samsung_dma_ops {
        int (*debug)(unsigned long ch);
 };
 
-/*
- * samsung_dma_get_ops
- * get the set of samsung dma operations
- */
-#ifdef CONFIG_SAMSUNG_DMADEV
 extern void *samsung_dmadev_get_ops(void);
 extern void *s3c_dma_get_ops(void);
 
-static inline void *samsung_dma_get_ops(void)
+static inline void *__samsung_dma_get_ops(void)
 {
        if (samsung_dma_is_dmadev())
                return samsung_dmadev_get_ops();
        else
                return s3c_dma_get_ops();
 }
+
+/*
+ * samsung_dma_get_ops
+ * get the set of samsung dma operations
+ */
+#ifdef CONFIG_SAMSUNG_DMADEV
+#define samsung_dma_get_ops() __samsung_dma_get_ops()
 #else
 #define samsung_dma_get_ops() NULL
 #endif
 
 #endif /* __DMA_PL330_H_ */
-