[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1312641270-6018-5-git-send-email-holt@sgi.com>
Date: Sat, 6 Aug 2011 09:34:29 -0500
From: Robin Holt <holt@....com>
To: Robin Holt <holt@....com>, Marc Kleine-Budde <mkl@...gutronix.de>,
Wolfgang Grandegger <wg@...ndegger.com>,
U Bhaskar-B22300 <B22300@...escale.com>
Cc: Robin Holt <holt@....com>, socketcan-core@...ts.berlios.de,
netdev@...r.kernel.org
Subject: [RFC 4/5] [flexcan] Add support for FLEXCAN_DEBUG
Add a wrapper function for a register dump when a developer defines
FLEXCAN_DEBUG.
Signed-off-by: Robin Holt <holt@....com>
To: Marc Kleine-Budde <mkl@...gutronix.de>
To: Wolfgang Grandegger <wg@...ndegger.com>
To: U Bhaskar-B22300 <B22300@...escale.com>
Cc: socketcan-core@...ts.berlios.de
Cc: netdev@...r.kernel.org
---
drivers/net/can/flexcan.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index d4ac81b..c2fb829 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -215,6 +215,35 @@ static inline void flexcan_write(u32 val, void __iomem *addr)
}
#endif
+#if defined(FLEXCAN_DEBUG)
+void _flexcan_reg_dump(struct net_device *dev, const char *file, int line,
+ const char *func)
+{
+ const struct flexcan_priv *priv = netdev_priv(dev);
+ struct flexcan_regs __iomem *regs = priv->base;
+
+ netdev_info("flexcan_reg_dump:%s:%d:%s()\n", file, line, func);
+ netdev_info("\t mcr 0x%08x ctrl 0x%08x timer 0x%08x rxg 0x%08x",
+ flexcan_read(®s->mcr),
+ flexcan_read(®s->ctrl),
+ flexcan_read(®s->timer),
+ flexcan_read(®s->rxgmask));
+ netdev_info("\t rx14 0x%08x rx15 0x%08x ecr 0x%08x esr 0x%08x",
+ flexcan_read(®s->rx14mask),
+ flexcan_read(®s->rx15mask),
+ flexcan_read(®s->ecr),
+ flexcan_read(®s->esr));
+ netdev_info("\timsk2 0x%08x imsk1 0x%08x iflg2 0x%08x iflg1 0x%08x",
+ flexcan_read(®s->imask2),
+ flexcan_read(®s->imask1),
+ flexcan_read(®s->iflag2),
+ flexcan_read(®s->iflag1));
+}
+#define flexcan_reg_dump(_d) _flexcan_reg_dump(_d, __FILE__, __LINE__, __func__)
+#else
+#define flexcan_reg_dump(_d)
+#endif
+
/*
* Swtich transceiver on or off
*/
@@ -275,6 +304,8 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
u32 can_id;
u32 ctrl = FLEXCAN_MB_CNT_CODE(0xc) | (cf->can_dlc << 16);
+ flexcan_reg_dump(dev);
+
if (can_dropped_invalid_skb(dev, skb))
return NETDEV_TX_OK;
@@ -307,6 +338,8 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* tx_packets is incremented in flexcan_irq */
stats->tx_bytes += cf->can_dlc;
+ flexcan_reg_dump(dev);
+
return NETDEV_TX_OK;
}
@@ -575,6 +608,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
struct flexcan_regs __iomem *regs = priv->base;
u32 reg_iflag1, reg_esr;
+ flexcan_reg_dump(dev);
+
reg_iflag1 = flexcan_read(®s->iflag1);
reg_esr = flexcan_read(®s->esr);
flexcan_write(FLEXCAN_ESR_ERR_INT, ®s->esr); /* ACK err IRQ */
@@ -615,6 +650,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
netif_wake_queue(dev);
}
+ flexcan_reg_dump(dev);
+
return IRQ_HANDLED;
}
--
1.7.2.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists