From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Robin Holt <holt-sJ/iWh9BUns@public.gmane.org>
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Subject: Re: [RFC 4/4] [flexcan] Add support for FLEXCAN_DEBUG
Date: Fri, 05 Aug 2011 09:16:06 +0200 [thread overview]
Message-ID: <4E3B98B6.4040003@pengutronix.de> (raw)
In-Reply-To: <1312509979-13226-5-git-send-email-holt-sJ/iWh9BUns@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 3634 bytes --]
On 08/05/2011 04:06 AM, Robin Holt wrote:
> Add a wrapper function for a register dump when a developer defines
> FLEXCAN_DEBUG
Comments inline..however I'm not sure if we need this patch.
> Signed-off-by: Robin Holt <holt-sJ/iWh9BUns@public.gmane.org>
> To: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> To: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
> Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> drivers/net/can/flexcan.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 40 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index fbb61c6..96684ca 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -316,6 +316,38 @@ static inline unsigned long flexcan_clk_get_rate(struct clk *clk)
>
> #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;
> +
> + printk(KERN_INFO "flexcan_reg_dump:%s:%d:%s()\n", file, line, func);
Use netdev_$LEVEL, please.
If you use dbg, you can remove the ifdef altogether.
> + printk(KERN_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));
> + printk(KERN_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));
> + printk(KERN_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
> */
> @@ -376,6 +408,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;
>
> @@ -408,6 +442,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;
> }
>
> @@ -676,6 +712,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 */
> @@ -716,6 +754,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
> netif_wake_queue(dev);
> }
>
> + flexcan_reg_dump(dev);
> +
> return IRQ_HANDLED;
> }
>
cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
[-- Attachment #2: Type: text/plain, Size: 188 bytes --]
_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core
next prev parent reply other threads:[~2011-08-05 7:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-05 2:06 [RFC 0/4] [flexcan] Add support for powerpc (freescale p1010) -V4 Robin Holt
2011-08-05 2:06 ` [RFC 1/4] [flexcan] Abstract off read/write for big/little endian Robin Holt
[not found] ` <1312509979-13226-2-git-send-email-holt-sJ/iWh9BUns@public.gmane.org>
2011-08-05 8:32 ` Marc Kleine-Budde
2011-08-05 2:06 ` [RFC 2/4] [flexcan] Introduce a flexcan_clk set of functions Robin Holt
[not found] ` <1312509979-13226-3-git-send-email-holt-sJ/iWh9BUns@public.gmane.org>
2011-08-05 8:34 ` Marc Kleine-Budde
2011-08-05 11:36 ` Robin Holt
[not found] ` <20110805113638.GF4926-sJ/iWh9BUns@public.gmane.org>
2011-08-05 12:29 ` Marc Kleine-Budde
[not found] ` <4E3BE23A.5080706-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-08-05 12:44 ` Robin Holt
2011-08-05 2:06 ` [RFC 3/4] [flexcan] Add of_match to platform_device definition Robin Holt
[not found] ` <1312509979-13226-4-git-send-email-holt-sJ/iWh9BUns@public.gmane.org>
2011-08-05 7:13 ` Marc Kleine-Budde
2011-08-05 2:06 ` [RFC 4/4] [flexcan] Add support for FLEXCAN_DEBUG Robin Holt
[not found] ` <1312509979-13226-5-git-send-email-holt-sJ/iWh9BUns@public.gmane.org>
2011-08-05 7:16 ` Marc Kleine-Budde [this message]
[not found] ` <4E3B98B6.4040003-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-08-05 14:01 ` Robin Holt
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=4E3B98B6.4040003@pengutronix.de \
--to=mkl-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=holt-sJ/iWh9BUns@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
--cc=wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).