summaryrefslogtreecommitdiff
path: root/drivers/net/can/bfin_can.c
diff options
context:
space:
mode:
authorWolfgang Grandegger <wg@grandegger.com>2012-02-01 14:14:13 +0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2012-02-03 04:21:26 +0400
commit79d0d8a7d5edca459f544c2ad75088e99307795e (patch)
tree97126b05dd6906f42ce717ba97f5ac9361bfaecb /drivers/net/can/bfin_can.c
parent03c49daa8168b58e6256f0cad88771b9440ca5f7 (diff)
downloadlinux-79d0d8a7d5edca459f544c2ad75088e99307795e.tar.xz
can: bfin_can/ti_hecc/mscan: add missing do_get_berr_counter callback
Cc: Anant Gole <anantgole@ti.com> Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/bfin_can.c')
-rw-r--r--drivers/net/can/bfin_can.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index 349e0fabb63a..e1e7f9da3da5 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -224,6 +224,20 @@ static int bfin_can_set_mode(struct net_device *dev, enum can_mode mode)
return 0;
}
+static int bfin_can_get_berr_counter(const struct net_device *dev,
+ struct can_berr_counter *bec)
+{
+ struct bfin_can_priv *priv = netdev_priv(dev);
+ struct bfin_can_regs __iomem *reg = priv->membase;
+
+ u16 cec = bfin_read(&reg->cec);
+
+ bec->txerr = cec >> 8;
+ bec->rxerr = cec;
+
+ return 0;
+}
+
static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct bfin_can_priv *priv = netdev_priv(dev);
@@ -509,6 +523,7 @@ struct net_device *alloc_bfin_candev(void)
priv->can.bittiming_const = &bfin_can_bittiming_const;
priv->can.do_set_bittiming = bfin_can_set_bittiming;
priv->can.do_set_mode = bfin_can_set_mode;
+ priv->can.do_get_berr_counter = bfin_can_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
return dev;