summaryrefslogtreecommitdiff
path: root/drivers/net/can/mscan
diff options
context:
space:
mode:
authorWolfgang Grandegger <wg@grandegger.com>2012-02-01 11:14:13 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2012-02-03 01:21:26 +0100
commit79d0d8a7d5edca459f544c2ad75088e99307795e (patch)
tree97126b05dd6906f42ce717ba97f5ac9361bfaecb /drivers/net/can/mscan
parent03c49daa8168b58e6256f0cad88771b9440ca5f7 (diff)
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/mscan')
-rw-r--r--drivers/net/can/mscan/mscan.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index 1c82dd8b896e..d11b0832ccd6 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -560,6 +560,18 @@ static int mscan_do_set_bittiming(struct net_device *dev)
return 0;
}
+static int mscan_get_berr_counter(const struct net_device *dev,
+ struct can_berr_counter *bec)
+{
+ struct mscan_priv *priv = netdev_priv(dev);
+ struct mscan_regs __iomem *regs = priv->reg_base;
+
+ bec->txerr = in_8(&regs->cantxerr);
+ bec->rxerr = in_8(&regs->canrxerr);
+
+ return 0;
+}
+
static int mscan_open(struct net_device *dev)
{
int ret;
@@ -639,8 +651,10 @@ int register_mscandev(struct net_device *dev, int mscan_clksrc)
else
ctl1 &= ~MSCAN_CLKSRC;
- if (priv->type == MSCAN_TYPE_MPC5121)
+ if (priv->type == MSCAN_TYPE_MPC5121) {
+ priv->can.do_get_berr_counter = mscan_get_berr_counter;
ctl1 |= MSCAN_BORM; /* bus-off recovery upon request */
+ }
ctl1 |= MSCAN_CANE;
out_8(&regs->canctl1, ctl1);