Patchwork net/can/mscan: add listen only mode

login
register
mail settings
Submitter Marc Kleine-Budde
Date Nov. 3, 2011, 1 p.m.
Message ID <1320325243-24907-1-git-send-email-mkl@pengutronix.de>
Download mbox | patch
Permalink /patch/123443/
State Deferred
Delegated to: David Miller
Headers show

Pull-request

git://git.pengutronix.de/git/mkl/linux-2.6.git can/mscan-listen-only-for-net-next

Comments

Marc Kleine-Budde - Nov. 3, 2011, 1 p.m.
This patch adds listen only mode to the mscan controller.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---

...can be pulled via:

The following changes since commit 8b3408f8ee994973869d8ba32c5bf482bc4ddca4:

  dp83640: free packet queues on remove (2011-10-24 19:14:50 -0400)

are available in the git repository at:
  git://git.pengutronix.de/git/mkl/linux-2.6.git can/mscan-listen-only-for-net-next

Marc Kleine-Budde (1):
      net/can/mscan: add listen only mode

 drivers/net/can/mscan/mscan.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
Marc Kleine-Budde - Nov. 9, 2011, 3:52 p.m.
On 11/03/2011 02:00 PM, Marc Kleine-Budde wrote:
> This patch adds listen only mode to the mscan controller.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

ping, any comments?

Marc
> ---
> 
> ...can be pulled via:
> 
> The following changes since commit 8b3408f8ee994973869d8ba32c5bf482bc4ddca4:
> 
>   dp83640: free packet queues on remove (2011-10-24 19:14:50 -0400)
> 
> are available in the git repository at:
>   git://git.pengutronix.de/git/mkl/linux-2.6.git can/mscan-listen-only-for-net-next
> 
> Marc Kleine-Budde (1):
>       net/can/mscan: add listen only mode
> 
>  drivers/net/can/mscan/mscan.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
> index ec4a311..74f3b18 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(&regs->canctl1, MSCAN_LISTEN);
> +	if (ctrlmode.flags & CAN_CTRLMODE_LISTENONLY)
> +		setbits8(&regs->canctl1, MSCAN_LISTEN);
> +	else
> +		clrbits8(&regs->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;
Wolfgang Grandegger - Nov. 9, 2011, 4:01 p.m.
On 11/09/2011 04:52 PM, Marc Kleine-Budde wrote:
> On 11/03/2011 02:00 PM, Marc Kleine-Budde wrote:
>> This patch adds listen only mode to the mscan controller.
>>
>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> 
> ping, any comments?

Looks good, therefore:

Acked-by: Wolfgang Grandegger <wg@grandegger.com>

Thanks,

Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index ec4a311..74f3b18 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(&regs->canctl1, MSCAN_LISTEN);
+	if (ctrlmode.flags & CAN_CTRLMODE_LISTENONLY)
+		setbits8(&regs->canctl1, MSCAN_LISTEN);
+	else
+		clrbits8(&regs->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;