mtd: nand: pxa3xx_nand: add register access debug

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Mar 24 11:59:05 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=26d072e36c732e6fe7eebdceb5e0497ddf256ded
Commit:     26d072e36c732e6fe7eebdceb5e0497ddf256ded
Parent:     02c3b0bd69a537557484e46a5937874a2d2ad454
Author:     Robert Jarzmik <robert.jarzmik at free.fr>
AuthorDate: Mon Jan 25 21:29:45 2016 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Mon Feb 1 09:58:38 2016 -0800

    mtd: nand: pxa3xx_nand: add register access debug
    
    Add verbose debug for register accesses. This enables easier debugging
    by following where and how hardware is stimulated, and how it answers.
    
    Signed-off-by: Robert Jarzmik <robert.jarzmik at free.fr>
    Acked-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/pxa3xx_nand.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 86fc245..e42496a 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -131,11 +131,23 @@
 #define READ_ID_BYTES		7
 
 /* macros for registers read/write */
-#define nand_writel(info, off, val)	\
-	writel_relaxed((val), (info)->mmio_base + (off))
-
-#define nand_readl(info, off)		\
-	readl_relaxed((info)->mmio_base + (off))
+#define nand_writel(info, off, val)					\
+	do {								\
+		dev_vdbg(&info->pdev->dev,				\
+			 "%s():%d nand_writel(0x%x, 0x%04x)\n",		\
+			 __func__, __LINE__, (val), (off));		\
+		writel_relaxed((val), (info)->mmio_base + (off));	\
+	} while (0)
+
+#define nand_readl(info, off)						\
+	({								\
+		unsigned int _v;					\
+		_v = readl_relaxed((info)->mmio_base + (off));		\
+		dev_vdbg(&info->pdev->dev,				\
+			 "%s():%d nand_readl(0x%04x) = 0x%x\n",		\
+			 __func__, __LINE__, (off), _v);		\
+		_v;							\
+	})
 
 /* error code and state */
 enum {



More information about the linux-mtd-cvs mailing list