mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] net: smc1111: improve debug capability
Date: Mon, 26 Jan 2015 22:34:10 +0100	[thread overview]
Message-ID: <1422308050-13895-3-git-send-email-robert.jarzmik@free.fr> (raw)
In-Reply-To: <1422308050-13895-1-git-send-email-robert.jarzmik@free.fr>

Improve smc1111 driver debug messages by printing the register accessed,
the current bank, and the values.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/net/smc91111.c | 114 ++++++++++++++++++++++++++++---------------------
 1 file changed, 65 insertions(+), 49 deletions(-)

diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 880bf75..76e576a 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -528,55 +528,71 @@ static const struct smc91111_accessors access_via_32bit = {
 
 /* ------------------------------------------------------------------------ */
 
-static inline void SMC_outb(struct smc91c111_priv *p, unsigned value,
-				unsigned offset)
-{
-	(p->a.ob)(value, p->base, offset);
-}
-
-static inline void SMC_outw(struct smc91c111_priv *p, unsigned value,
-				unsigned offset)
-{
-	(p->a.ow)(value, p->base, offset);
-}
-
-static inline void SMC_outl(struct smc91c111_priv *p, unsigned long value,
-				unsigned offset)
-{
-	(p->a.ol)(value, p->base, offset);
-}
-
-static inline void SMC_outsl(struct smc91c111_priv *p, unsigned offset,
-				const void *data, int count)
-{
-	(p->a.osl)(p->base, offset, data, count);
-}
-
-static inline unsigned SMC_inb(struct smc91c111_priv *p, unsigned offset)
-{
-	return (p->a.ib)(p->base, offset);
-}
-
-static inline unsigned SMC_inw(struct smc91c111_priv *p, unsigned offset)
-{
-	return (p->a.iw)(p->base, offset);
-}
-
-static inline unsigned long SMC_inl(struct smc91c111_priv *p, unsigned offset)
-{
-	return (p->a.il)(p->base, offset);
-}
-
-static inline void SMC_insl(struct smc91c111_priv *p, unsigned offset,
-				void *data, int count)
-{
-	(p->a.isl)(p->base, offset, data, count);
-}
-
-static inline void SMC_SELECT_BANK(struct smc91c111_priv *p, int bank)
-{
-	SMC_outw(p, bank, BANK_SELECT);
-}
+static unsigned last_bank;
+#define SMC_outb(p, value, offset) \
+	do {								\
+		PRINTK3("\t%s:%d outb: %s[%1d:0x%04x] = 0x%02x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), (value));				\
+		((p)->a.ob)((value), (p)->base, (offset));		\
+	} while (0)
+
+#define SMC_outw(p, value, offset)					\
+	do {								\
+		PRINTK3("\t%s:%d outw: %s[%1d:0x%04x] = 0x%04x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), (value));				\
+		((p)->a.ow)((value), (p)->base, (offset));		\
+	} while (0)
+
+#define SMC_outl(p, value, offset)					\
+	do {								\
+		PRINTK3("\t%s:%d outl: %s[%1d:0x%04x] = 0x%08lx\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), (unsigned long)(value));		\
+		((p)->a.ol)((value), (p)->base, (offset));		\
+	} while (0)
+
+#define SMC_outsl(p, offset, data, count)\
+	do {								\
+		PRINTK3("\t%s:%d outsl: %5d@%p -> [%1d:0x%04x]\n",	\
+			__func__, __LINE__, (count) * 4, data,		\
+			last_bank, (offset));				\
+		((p)->a.osl)((p)->base, (offset), data, (count));	\
+	} while (0)
+
+#define SMC_inb(p, offset)						\
+	({								\
+		unsigned _v = ((p)->a.ib)((p)->base, (offset));		\
+		PRINTK3("\t%s:%d inb: %s[%1d:0x%04x] -> 0x%02x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), _v);					\
+		_v; })
+
+#define SMC_inw(p, offset)						\
+	({								\
+		unsigned _v = ((p)->a.iw)((p)->base, (offset));		\
+		PRINTK3("\t%s:%d inw: %s[%1d:0x%04x] -> 0x%04x\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), _v);					\
+		_v; })
+
+#define SMC_inl(p, offset)						\
+	({								\
+		unsigned long _v = ((p)->a.il)((p)->base, (offset));	\
+		PRINTK3("\t%s:%d inl: %s[%1d:0x%04x] -> 0x%08lx\n",	\
+			__func__, __LINE__, #offset, last_bank,		\
+			(offset), _v);					\
+		_v; })
+
+#define SMC_insl(p, offset, data, count)		\
+	((p)->a.isl)((p)->base, (offset), data, (count))
+
+#define SMC_SELECT_BANK(p, bank)			\
+	do {						\
+		SMC_outw(p, bank & 0xf, BANK_SELECT);	\
+		last_bank = bank & 0xf;			\
+	} while (0)
 
 #if SMC_DEBUG > 2
 static void print_packet( unsigned char * buf, int length )
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-01-26 21:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 21:34 [PATCH 1/3] net: smc1111: allow platform specific accessors Robert Jarzmik
2015-01-26 21:34 ` [PATCH 2/3] net: smc1111: extend the driver for 91c94 and 91c96 support Robert Jarzmik
2015-01-26 21:34 ` Robert Jarzmik [this message]
2015-01-29  9:47 ` [PATCH 1/3] net: smc1111: allow platform specific accessors Sascha Hauer
2015-01-29 14:01   ` robert.jarzmik
2015-01-30  7:37     ` Sascha Hauer
2015-01-30  8:03       ` Robert Jarzmik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422308050-13895-3-git-send-email-robert.jarzmik@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox