linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Roman Fietze <roman.fietze@telemotive.de>,
	linux-stable <stable@vger.kernel.org>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 02/12] can: m_can.c: fix setup of CCCR register: clear CCCR NISO bit before checking can.ctrlmode
Date: Mon, 23 Jul 2018 14:58:33 +0200	[thread overview]
Message-ID: <20180723125843.391-3-mkl@pengutronix.de> (raw)
In-Reply-To: <20180723125843.391-1-mkl@pengutronix.de>

From: Roman Fietze <roman.fietze@telemotive.de>

Inside m_can_chip_config(), when setting up the new value of the CCCR,
the CCCR_NISO bit is not cleared like the others, CCCR_TEST, CCCR_MON,
CCCR_BRSE and CCCR_FDOE, before checking the can.ctrlmode bits for
CAN_CTRLMODE_FD_NON_ISO.

This way once the controller was configured for CAN_CTRLMODE_FD_NON_ISO,
this mode could never be cleared again.

This fix is only relevant for controllers with version 3.1.x or 3.2.x.
Older versions do not support NISO.

Signed-off-by: Roman Fietze <roman.fietze@telemotive.de>
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/m_can.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index b397a33f3d32..8e2b7f873c4d 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1109,7 +1109,8 @@ static void m_can_chip_config(struct net_device *dev)
 
 	} else {
 	/* Version 3.1.x or 3.2.x */
-		cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE);
+		cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE |
+			  CCCR_NISO);
 
 		/* Only 3.2.x has NISO Bit implemented */
 		if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
-- 
2.18.0

  parent reply	other threads:[~2018-07-23 12:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 12:58 pull-request: can 2018-07-23 Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 01/12] can: peak_canfd: fix firmware < v3.3.0: limit allocation to 32-bit DMA addr only Marc Kleine-Budde
2018-07-23 12:58 ` Marc Kleine-Budde [this message]
2018-07-23 12:58 ` [PATCH 03/12] can: mpc5xxx_can: check of_iomap return before use Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 04/12] can: m_can: Fix runtime resume call Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 05/12] can: m_can: Move accessing of message ram to after clocks are enabled Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 06/12] can: xilinx_can: fix device dropping off bus on RX overrun Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 07/12] can: xilinx_can: fix RX loop if RXNEMP is asserted without RXOK Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 08/12] can: xilinx_can: fix recovery from error states not being propagated Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 09/12] can: xilinx_can: keep only 1-2 frames in TX FIFO to fix TX accounting Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 10/12] can: xilinx_can: fix RX overflow interrupt not being enabled Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 11/12] can: xilinx_can: fix incorrect clear of non-processed interrupts Marc Kleine-Budde
2018-07-23 12:58 ` [PATCH 12/12] can: xilinx_can: fix power management handling Marc Kleine-Budde
2018-07-23 18:02 ` pull-request: can 2018-07-23 David Miller
2018-07-24  7:27   ` Marc Kleine-Budde
2018-07-25 23:26     ` David Miller
2018-07-26  6:12       ` 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=20180723125843.391-3-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roman.fietze@telemotive.de \
    --cc=stable@vger.kernel.org \
    /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).