Linux CAN drivers development
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>, linux-can@vger.kernel.org
Subject: Re: [PATCH 2/4] can: flexcan: Detect error passive state change
Date: Mon, 18 Aug 2014 08:05:47 +0200	[thread overview]
Message-ID: <2862259.Nup8ES7SpR@ws-stein> (raw)
In-Reply-To: <53EDBFAA.3070809@pengutronix.de>

On Friday 15 August 2014 10:07:06, Marc Kleine-Budde wrote:
> On 08/12/2014 03:43 PM, Alexander Stein wrote:
> > Assuming there is no CAN frame reception or CAN_CTRLMODE_BERR_REPORTING:
> > If the Tx error counter steps from 127 to 128 the hardware enters error
> > passive. But in this case the FLEXCAN_ESR_ERR_STATE bits are unset:
> > TWRN_INT and RWRN_INT are not set during the transition from <96 to >=96.
> 
> Which hardware are you using? According to the documentation TWRN_INT
> and RWRN_INT _are_ actually set during the transition from <96 to >=96.

Meh, wrong case description... What I wanted to write:
TWRN_INT and RWRN_INT are _only_ set during the transition from <96 to >=96.
And for the records I'm using a i.MX35.

> > So we do not schedule NAPI thus not evaluating the error counters.
> > So we also check TX_WRN and RX_WRN in order to detect error passive.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> > ---
> >  drivers/net/can/flexcan.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> > index fd79dd40840b..5e391ec70a2b 100644
> > --- a/drivers/net/can/flexcan.c
> > +++ b/drivers/net/can/flexcan.c
> > @@ -721,7 +721,8 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
> >  	 * - bus error IRQ and bus error reporting is activated
> >  	 */
> >  	if ((reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE) ||
> > -	    (reg_esr & FLEXCAN_ESR_ERR_STATE) ||
> > +	    (reg_esr & (FLEXCAN_ESR_ERR_STATE |
> > +			FLEXCAN_ESR_TX_WRN | FLEXCAN_ESR_RX_WRN)) ||
> >  	    flexcan_has_and_handle_berr(priv, reg_esr)) {
> >  		/*
> >  		 * The error bits are cleared on read,
> > 
> 
> Marc
> 
> 

-- 
Dipl.-Inf. Alexander Stein

SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Tel.: 03765 38600-1156
Fax: 03765 38600-4100
Email: alexander.stein@systec-electronic.com
Website: www.systec-electronic.com
 
Managing Director: Dipl.-Phys. Siegmar Schmidt
Commercial registry: Amtsgericht Chemnitz, HRB 28082


  reply	other threads:[~2014-08-18  6:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12 13:43 [PATCH 1/4 RESEND] can: flexcan: Disable error interrupt when bus error reporting is disabled Alexander Stein
2014-08-12 13:43 ` [PATCH 2/4] can: flexcan: Detect error passive state change Alexander Stein
2014-08-15  8:07   ` Marc Kleine-Budde
2014-08-18  6:05     ` Alexander Stein [this message]
2014-08-12 13:43 ` [PATCH 3/4] can: flexcan: Put enabling error irq into separate function Alexander Stein
2014-08-12 13:43 ` [PATCH 4/4] can: flexcan: Disable error irq when in error passive Alexander Stein
2014-08-14 11:18   ` Marc Kleine-Budde
2014-08-14 13:19     ` Alexander Stein
2014-08-14 13:58       ` Marc Kleine-Budde
2014-08-20  5:53         ` Alexander Stein
2014-08-14 10:21 ` [PATCH 1/4 RESEND] can: flexcan: Disable error interrupt when bus error reporting is disabled Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2862259.Nup8ES7SpR@ws-stein \
    --to=alexander.stein@systec-electronic.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox