From 452448f9283e1939408b397e87974a418825b0a8 Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Wed, 9 Nov 2011 10:50:49 +0000 Subject: net/can/mscan: add listen only mode This patch adds listen only mode to the mscan controller. Signed-off-by: Marc Kleine-Budde Acked-by: Wolfgang Grandegger Signed-off-by: David S. Miller --- drivers/net/can/mscan/mscan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/net/can/mscan/mscan.c') diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index ec4a3119e2c..74f3b1829e0 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c @@ -581,7 +581,10 @@ static int mscan_open(struct net_device *dev) priv->open_time = jiffies; - clrbits8(®s->canctl1, MSCAN_LISTEN); + if (ctrlmode.flags & CAN_CTRLMODE_LISTENONLY) + setbits8(®s->canctl1, MSCAN_LISTEN); + else + clrbits8(®s->canctl1, MSCAN_LISTEN); ret = mscan_start(dev); if (ret) @@ -690,7 +693,8 @@ struct net_device *alloc_mscandev(void) priv->can.bittiming_const = &mscan_bittiming_const; priv->can.do_set_bittiming = mscan_do_set_bittiming; priv->can.do_set_mode = mscan_do_set_mode; - priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; + priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | + CAN_CTRLMODE_LISTENONLY; for (i = 0; i < TX_QUEUE_SIZE; i++) { priv->tx_queue[i].id = i; -- cgit v1.2.3-70-g09d2 From abbd00b82a2771b0460ba2cffdb1343aa827ccde Mon Sep 17 00:00:00 2001 From: Wolfgang Grandegger Date: Mon, 14 Nov 2011 14:30:05 -0500 Subject: net/can/mscan: Fix buggy listen only mode setting This patch fixes an issue introduced recently with commit 452448f9283e1939408b397e87974a418825b0a8. CC: Marc Kleine-Budde Signed-off-by: Wolfgang Grandegger Signed-off-by: David S. Miller --- drivers/net/can/mscan/mscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/can/mscan/mscan.c') diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c index 74f3b1829e0..1c82dd8b896 100644 --- a/drivers/net/can/mscan/mscan.c +++ b/drivers/net/can/mscan/mscan.c @@ -581,7 +581,7 @@ static int mscan_open(struct net_device *dev) priv->open_time = jiffies; - if (ctrlmode.flags & CAN_CTRLMODE_LISTENONLY) + if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) setbits8(®s->canctl1, MSCAN_LISTEN); else clrbits8(®s->canctl1, MSCAN_LISTEN); -- cgit v1.2.3-70-g09d2