From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Joakim Zhang <qiangqing.zhang@nxp.com>,
"sean@geanix.com" <sean@geanix.com>,
"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Cc: dl-linux-imx <linux-imx@nxp.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH V2 1/4] can: flexcan: fix deadlock when using self wakeup
Date: Wed, 4 Dec 2019 09:31:05 +0100 [thread overview]
Message-ID: <b4ce5a7a-7fc0-edb2-608e-4030ce6428a2@pengutronix.de> (raw)
In-Reply-To: <DB7PR04MB46183730127339DAC15ABF33E65D0@DB7PR04MB4618.eurprd04.prod.outlook.com>
[-- Attachment #1.1: Type: text/plain, Size: 2917 bytes --]
On 12/4/19 2:58 AM, Joakim Zhang wrote:
> [...]
>>> drivers/net/can/flexcan.c | 19 +++++++++++--------
>>> 1 file changed, 11 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
>>> index 2efa06119f68..2297663cacb2 100644
>>> --- a/drivers/net/can/flexcan.c
>>> +++ b/drivers/net/can/flexcan.c
>>> @@ -134,8 +134,7 @@
>>> (FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE) #define
>>> FLEXCAN_ESR_ALL_INT \
>>> (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \
>>> - FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT | \
>>> - FLEXCAN_ESR_WAK_INT)
>>> + FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT)
>>
>> Why do you remove the FLEXCAN_ESR_WAK_INT from the
>> FLEXCAN_ESR_ALL_INT?
>>
>>>
>>> /* FLEXCAN interrupt flag register (IFLAG) bits */
>>> /* Errata ERR005829 step7: Reserve first valid MB */ @@ -960,6
>>> +959,12 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
>>>
>>> reg_esr = priv->read(®s->esr);
>>>
>>> + /* ACK wakeup interrupt */
>>> + if (reg_esr & FLEXCAN_ESR_WAK_INT) {
>>> + handled = IRQ_HANDLED;
>>> + priv->write(reg_esr & FLEXCAN_ESR_WAK_INT, ®s->esr);
>>> + }
>>> +
>>
>> If FLEXCAN_ESR_WAK_INT stays in FLEXCAN_ESR_ALL_INT, you don't need
>> that explicit ACK here.
>
> Hi Marc,
>
> I remove the FLEXCAN_ESR_WAK_INT from the FLEXCAN_ESR_ALL_INT since
> FLEXCAN_ESR_ALL_INT is for all bus error and state change IRQ
> sources, wakeup interrupt does not belong to these. If you think this
> does not need, I can remove this change.
I see, makes sense.
Make this a separate patch. Move the FLEXCAN_ESR_WAK_INT from the
FLEXCAN_ESR_ALL_INT, but add it to the existing ack of the interrupts.
Like this:
> diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
> index b6f675a5e2d9..74f622b40b61 100644
> --- a/drivers/net/can/flexcan.c
> +++ b/drivers/net/can/flexcan.c
> @@ -960,10 +960,10 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
>
> reg_esr = priv->read(®s->esr);
>
> - /* ACK all bus error and state change IRQ sources */
> - if (reg_esr & FLEXCAN_ESR_ALL_INT) {
> + /* ACK all bus error, state change and wake IRQ sources */
> + if (reg_esr & (FLEXCAN_ESR_ALL_INT | FLEXCAN_ESR_WAK_INT)) {
> handled = IRQ_HANDLED;
> - priv->write(reg_esr & FLEXCAN_ESR_ALL_INT, ®s->esr);
> + priv->write(reg_esr & (FLEXCAN_ESR_ALL_INT | FLEXCAN_ESR_WAK_INT), ®s->esr);
> }
>
> /* state change interrupt or broken error state quirk fix is enabled */
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-12-04 8:31 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 5:56 [PATCH V2 0/4] can: flexcan: fixes for stop mode Joakim Zhang
2019-11-27 5:56 ` [PATCH V2 1/4] can: flexcan: fix deadlock when using self wakeup Joakim Zhang
2019-11-27 9:58 ` Sean Nyekjaer
2019-12-03 17:25 ` Marc Kleine-Budde
2019-12-03 17:42 ` Marc Kleine-Budde
2019-12-04 1:58 ` Joakim Zhang
2019-12-04 8:31 ` Marc Kleine-Budde [this message]
2019-12-04 8:35 ` Joakim Zhang
2019-11-27 5:56 ` [PATCH V2 2/4] can: flexcan: try to exit stop mode during probe stage Joakim Zhang
2019-11-27 9:58 ` Sean Nyekjaer
2019-12-03 18:14 ` Marc Kleine-Budde
2019-12-04 2:22 ` Joakim Zhang
2019-12-04 8:45 ` Marc Kleine-Budde
2019-12-04 9:58 ` Joakim Zhang
2019-12-05 8:46 ` Joakim Zhang
2019-12-05 9:21 ` Sean Nyekjaer
2019-12-05 11:04 ` Joakim Zhang
2019-12-05 11:11 ` Sean Nyekjaer
2019-12-05 11:19 ` Joakim Zhang
2019-12-05 11:32 ` Sean Nyekjaer
2019-12-07 20:32 ` Marc Kleine-Budde
2019-12-08 10:47 ` Sean Nyekjaer
2019-12-08 10:56 ` Marc Kleine-Budde
2019-11-27 5:56 ` [PATCH V2 3/4] can: flexcan: change the way of stop mode acknowledgment Joakim Zhang
2019-11-27 9:58 ` Sean Nyekjaer
2019-12-03 18:21 ` Marc Kleine-Budde
2019-12-04 2:23 ` Joakim Zhang
2019-11-27 5:56 ` [PATCH V2 4/4] can: flexcan: add LPSR mode support Joakim Zhang
2019-12-04 2:25 ` Joakim Zhang
2019-12-04 8:59 ` Marc Kleine-Budde
2019-12-04 9:58 ` Joakim Zhang
2019-12-04 9:20 ` Marc Kleine-Budde
2019-12-04 9:59 ` Joakim Zhang
2019-12-04 10:58 ` Joakim Zhang
2019-11-27 6:12 ` [PATCH V2 0/4] can: flexcan: fixes for stop mode Sean Nyekjaer
2019-11-27 8:12 ` Sean Nyekjaer
2019-11-27 9:36 ` Joakim Zhang
2019-11-27 9:48 ` Joakim Zhang
2019-11-27 9:52 ` Sean Nyekjaer
2019-11-27 9:58 ` Joakim Zhang
2019-11-27 9:59 ` Sean Nyekjaer
2019-11-27 10:04 ` Joakim Zhang
2019-12-03 10:16 ` Joakim Zhang
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=b4ce5a7a-7fc0-edb2-608e-4030ce6428a2@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=linux-can@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=qiangqing.zhang@nxp.com \
--cc=sean@geanix.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;
as well as URLs for NNTP newsgroup(s).