Patchwork [v2] can: c_can: disable one shot mode until driver is fixed

login
register
mail settings
Submitter Marc Kleine-Budde
Date March 24, 2011, 11 a.m.
Message ID <1300964453-2634-1-git-send-email-mkl@pengutronix.de>
Download mbox | patch
Permalink /patch/88167/
State Superseded
Delegated to: David Miller
Headers show

Comments

Marc Kleine-Budde - March 24, 2011, 11 a.m.
This patch disables the one shot mode, until the driver has been fixed and
tested to support it.

> I'm quite sure I've seen a situation where msg_obj 17 "seemed" to be
> pending, while msg_obj 18 and 19 already have been transmitted. But
> in that case, I enabled ONESHOT for the can interface, which enables
> the DA mode (automatic retransmission is disabled).

Reported-by: Jan Altenberg <jan@linutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
---

Changes since v1:
* remove code to enable CAN_CTRLMODE_ONE_SHOT entirely
  (thanks Kurt)

 drivers/net/can/c_can/c_can.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
Wolfgang Grandegger - March 24, 2011, 11:56 a.m.
On 03/24/2011 12:00 PM, Marc Kleine-Budde wrote:
> This patch disables the one shot mode, until the driver has been fixed and
> tested to support it.
> 
>> I'm quite sure I've seen a situation where msg_obj 17 "seemed" to be
>> pending, while msg_obj 18 and 19 already have been transmitted. But
>> in that case, I enabled ONESHOT for the can interface, which enables
>> the DA mode (automatic retransmission is disabled).
> 
> Reported-by: Jan Altenberg <jan@linutronix.de>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
> Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>

I agree, ONESHOT mode is tricky and needs more thoughts and testing. I
remember some ugly principle problems with the MCP251x.

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
David Miller - March 28, 2011, 1:19 a.m.
From: Wolfgang Grandegger <wg@grandegger.com>
Date: Thu, 24 Mar 2011 12:56:19 +0100

> On 03/24/2011 12:00 PM, Marc Kleine-Budde wrote:
>> This patch disables the one shot mode, until the driver has been fixed and
>> tested to support it.
>> 
>>> I'm quite sure I've seen a situation where msg_obj 17 "seemed" to be
>>> pending, while msg_obj 18 and 19 already have been transmitted. But
>>> in that case, I enabled ONESHOT for the can interface, which enables
>>> the DA mode (automatic retransmission is disabled).
>> 
>> Reported-by: Jan Altenberg <jan@linutronix.de>
>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
>> Signed-off-by: Kurt Van Dijck <kurt.van.dijck@eia.be>
>> Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
> Acked-by: Wolfgang Grandegger <wg@grandegger.com>

Applied, thanks everyone.
--
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/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 110eda0..d0bffb0 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -588,14 +588,9 @@  static void c_can_chip_config(struct net_device *dev)
 {
 	struct c_can_priv *priv = netdev_priv(dev);
 
-	if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
-		/* disable automatic retransmission */
-		priv->write_reg(priv, &priv->regs->control,
-				CONTROL_DISABLE_AR);
-	else
-		/* enable automatic retransmission */
-		priv->write_reg(priv, &priv->regs->control,
-				CONTROL_ENABLE_AR);
+	/* enable automatic retransmission */
+	priv->write_reg(priv, &priv->regs->control,
+			CONTROL_ENABLE_AR);
 
 	if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY &
 					CAN_CTRLMODE_LOOPBACK)) {
@@ -1112,8 +1107,7 @@  struct net_device *alloc_c_can_dev(void)
 	priv->can.bittiming_const = &c_can_bittiming_const;
 	priv->can.do_set_mode = c_can_set_mode;
 	priv->can.do_get_berr_counter = c_can_get_berr_counter;
-	priv->can.ctrlmode_supported = CAN_CTRLMODE_ONE_SHOT |
-					CAN_CTRLMODE_LOOPBACK |
+	priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
 					CAN_CTRLMODE_LISTENONLY |
 					CAN_CTRLMODE_BERR_REPORTING;