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, Thomas Kopp <thomas.kopp@microchip.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 02/13] can: mcp25xxfd: mcp25xxfd_probe(): add SPI clk limit related errata information
Date: Wed, 30 Sep 2020 22:18:05 +0200	[thread overview]
Message-ID: <20200930201816.1032054-3-mkl@pengutronix.de> (raw)
In-Reply-To: <20200930201816.1032054-1-mkl@pengutronix.de>

From: Thomas Kopp <thomas.kopp@microchip.com>

This patch adds a reference to the recent released MCP2517FD and MCP2518FD
errata sheets and paste the explanation.

The driver already implements the proposed fix.

Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
Link: https://lore.kernel.org/r/20200925065606.358-1-thomas.kopp@microchip.com
[mkl: split into two patches, adjust subject and commit message]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 .../net/can/spi/mcp25xxfd/mcp25xxfd-core.c    | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index 106dda8e5310..c094bb716256 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -2819,11 +2819,21 @@ static int mcp25xxfd_probe(struct spi_device *spi)
 		priv->devtype_data = *(struct mcp25xxfd_devtype_data *)
 			spi_get_device_id(spi)->driver_data;
 
-	/* According to the datasheet the SPI clock must be less or
-	 * equal SYSCLOCK / 2.
+	/* Errata Reference:
+	 * mcp2517fd: DS80000789B, mcp2518fd: DS80000792C 4.
+	 *
+	 * The SPI can write corrupted data to the RAM at fast SPI
+	 * speeds:
+	 *
+	 * Simultaneous activity on the CAN bus while writing data to
+	 * RAM via the SPI interface, with high SCK frequency, can
+	 * lead to corrupted data being written to RAM.
+	 *
+	 * Fix/Work Around:
+	 * Ensure that FSCK is less than or equal to 0.85 *
+	 * (FSYSCLK/2).
 	 *
-	 * It turns out, that the Controller is not stable at this
-	 * rate. Known good and bad combinations are:
+	 * Known good and bad combinations are:
 	 *
 	 * MCP	ext-clk	SoC			SPI			SPI-clk		max-clk	parent-clk	Status	config
 	 *
@@ -2836,7 +2846,6 @@ static int mcp25xxfd_probe(struct spi_device *spi)
 	 * 2517 40 MHz	atmel,sama5d27		atmel,at91rm9200-spi	16400000 Hz	 82.00%	 82000000 Hz	good	default
 	 * 2518 40 MHz	atmel,sama5d27		atmel,at91rm9200-spi	16400000 Hz	 82.00%	 82000000 Hz	good	default
 	 *
-	 * Limit SPI clock to 85% of SYSCLOCK / 2 for now.
 	 */
 	priv->spi_max_speed_hz_orig = spi->max_speed_hz;
 	spi->max_speed_hz = min(spi->max_speed_hz, freq / 2 / 1000 * 850);
-- 
2.28.0


  parent reply	other threads:[~2020-09-30 20:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 01/13] can: mcp25xxfd: mcp25xxfd_handle_eccif(): add ECC related errata and update log messages Marc Kleine-Budde
2020-09-30 20:18 ` Marc Kleine-Budde [this message]
2020-09-30 20:18 ` [PATCH 03/13] can: mcp25xxfd: mcp25xxfd_ring_free(): fix memory leak during cleanup Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 04/13] can: mcp25xxfd: mcp25xxfd_irq(): add missing initialization of variable set_normal mode Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 05/13] dt-binding: can: mcp25xxfd: documentation fixes Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 06/13] dt-binding: can: mcp251xfd: narrow down wildcards in device tree bindings to "microchip,mcp251xfd" Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 07/13] can: mcp25xxfd: " Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 08/13] can: mcp251xfd: rename driver files and subdir to mcp251xfd Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 09/13] can: mcp251xfd: rename all user facing strings " Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 11/13] can: flexcan: initialize all flexcan memory for ECC function Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 12/13] can: flexcan: add flexcan driver for i.MX8MP Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 13/13] can: flexcan: disable runtime PM if register flexcandev failed Marc Kleine-Budde
2020-09-30 22:21 ` pull-request: can-next 2020-09-30 David Miller

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=20200930201816.1032054-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=thomas.kopp@microchip.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).