* pull-request: can-next 2020-09-30
@ 2020-09-30 20:18 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
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel
Hello David,
this is a pull request of 13 patches for net-next.
The first 10 target the mcp25xxfd driver (which is renamed to mcp251xfd during
this series).
The first two patches are by Thomas Kopp, which adds reference to the just
related errata and updates the documentation and log messages.
Dan Carpenter's patch fixes a resource leak during ifdown.
A patch by me adds the missing initialization of a variable.
Oleksij Rempel updates the DT binding documentation as requested by Rob
Herring.
The next 5 patches are by Thomas Kopp and me. During review Geert Uytterhoeven
suggested to use "microchip,mcp251xfd" instead of "microchip,mcp25xxfd" as the
DT autodetection compatible to avoid clashes with future but incompatible
devices. We decided not only to rename the compatible but the whole driver from
"mcp25xxfd" to "mcp251xfd". This is done in several patches.
Joakim Zhang contributes three patches for the flexcan driver. The first one
adds support for the ECC feature, which is implemented on some modern IP cores,
by initializing the controller's memory during ifup. The next patch adds
support for the i.MX8MP (which supports ECC) and the last patch properly
disables the runtime PM if device registration fails.
---
The following changes since commit 879456bedbe54f2d38b15c21dc5e3c30232b53e1:
net: mvneta: avoid possible cache misses in mvneta_rx_swbm (2020-09-29 18:10:07 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-5.10-20200930
for you to fetch changes up to 5a9323f55d52c9246ce85f2c9c6a8ec45413b1d0:
can: flexcan: disable runtime PM if register flexcandev failed (2020-09-30 21:56:58 +0200)
----------------------------------------------------------------
linux-can-next-for-5.10-20200930
----------------------------------------------------------------
Dan Carpenter (1):
can: mcp25xxfd: mcp25xxfd_ring_free(): fix memory leak during cleanup
Joakim Zhang (3):
can: flexcan: initialize all flexcan memory for ECC function
can: flexcan: add flexcan driver for i.MX8MP
can: flexcan: disable runtime PM if register flexcandev failed
Marc Kleine-Budde (4):
can: mcp25xxfd: mcp25xxfd_irq(): add missing initialization of variable set_normal mode
can: mcp251xfd: rename driver files and subdir to mcp251xfd
can: mcp251xfd: rename all user facing strings to mcp251xfd
can: mcp251xfd: rename all remaining occurrence to mcp251xfd
Oleksij Rempel (1):
dt-binding: can: mcp25xxfd: documentation fixes
Thomas Kopp (4):
can: mcp25xxfd: mcp25xxfd_handle_eccif(): add ECC related errata and update log messages
can: mcp25xxfd: mcp25xxfd_probe(): add SPI clk limit related errata information
dt-binding: can: mcp251xfd: narrow down wildcards in device tree bindings to "microchip,mcp251xfd"
can: mcp25xxfd: narrow down wildcards in device tree bindings to "microchip,mcp251xfd"
...hip,mcp25xxfd.yaml => microchip,mcp251xfd.yaml} | 16 +-
drivers/net/can/flexcan.c | 64 +-
drivers/net/can/spi/Kconfig | 2 +-
drivers/net/can/spi/Makefile | 2 +-
.../net/can/spi/{mcp25xxfd => mcp251xfd}/Kconfig | 10 +-
drivers/net/can/spi/mcp251xfd/Makefile | 8 +
.../mcp251xfd-core.c} | 1386 ++++++++++----------
.../mcp251xfd-crc16.c} | 24 +-
.../mcp251xfd-regmap.c} | 232 ++--
drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 835 ++++++++++++
drivers/net/can/spi/mcp25xxfd/Makefile | 8 -
drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h | 835 ------------
12 files changed, 1749 insertions(+), 1673 deletions(-)
rename Documentation/devicetree/bindings/net/can/{microchip,mcp25xxfd.yaml => microchip,mcp251xfd.yaml} (87%)
rename drivers/net/can/spi/{mcp25xxfd => mcp251xfd}/Kconfig (62%)
create mode 100644 drivers/net/can/spi/mcp251xfd/Makefile
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd-core.c => mcp251xfd/mcp251xfd-core.c} (54%)
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd-crc16.c => mcp251xfd/mcp251xfd-crc16.c} (81%)
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd-regmap.c => mcp251xfd/mcp251xfd-regmap.c} (60%)
create mode 100644 drivers/net/can/spi/mcp251xfd/mcp251xfd.h
delete mode 100644 drivers/net/can/spi/mcp25xxfd/Makefile
delete mode 100644 drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/13] can: mcp25xxfd: mcp25xxfd_handle_eccif(): add ECC related errata and update log messages
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
@ 2020-09-30 20:18 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 02/13] can: mcp25xxfd: mcp25xxfd_probe(): add SPI clk limit related errata information Marc Kleine-Budde
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Thomas Kopp, Marc Kleine-Budde
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 single error correction does not always work, so always indicate that a
single error occurred. If the location of the ECC error is outside of the
TX-RAM always use netdev_notice() to log the problem. For ECC errors in the
TX-RAM, there is a recovery procedure.
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 | 21 ++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index bd2ba981ae36..106dda8e5310 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -1973,8 +1973,20 @@ mcp25xxfd_handle_eccif(struct mcp25xxfd_priv *priv, bool set_normal_mode)
else
return err;
+ /* Errata Reference:
+ * mcp2517fd: DS80000789B, mcp2518fd: DS80000792C 2.
+ *
+ * ECC single error correction does not work in all cases:
+ *
+ * Fix/Work Around:
+ * Enable single error correction and double error detection
+ * interrupts by setting SECIE and DEDIE. Handle SECIF as a
+ * detection interrupt and do not rely on the error
+ * correction. Instead, handle both interrupts as a
+ * notification that the RAM word at ERRADDR was corrupted.
+ */
if (ecc_stat & MCP25XXFD_REG_ECCSTAT_SECIF)
- msg = "Single ECC Error corrected at address";
+ msg = "Single ECC Error detected at address";
else if (ecc_stat & MCP25XXFD_REG_ECCSTAT_DEDIF)
msg = "Double ECC Error detected at address";
else
@@ -1983,12 +1995,7 @@ mcp25xxfd_handle_eccif(struct mcp25xxfd_priv *priv, bool set_normal_mode)
if (!in_tx_ram) {
ecc->ecc_stat = 0;
- if (ecc_stat & MCP25XXFD_REG_ECCSTAT_SECIF)
- netdev_info(priv->ndev, "%s 0x%04x.\n",
- msg, addr);
- else
- netdev_notice(priv->ndev, "%s 0x%04x.\n",
- msg, addr);
+ netdev_notice(priv->ndev, "%s 0x%04x.\n", msg, addr);
} else {
/* Re-occurring error? */
if (ecc->ecc_stat == ecc_stat) {
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/13] can: mcp25xxfd: mcp25xxfd_probe(): add SPI clk limit related errata information
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
2020-09-30 20:18 ` [PATCH 03/13] can: mcp25xxfd: mcp25xxfd_ring_free(): fix memory leak during cleanup Marc Kleine-Budde
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Thomas Kopp, Marc Kleine-Budde
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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/13] can: mcp25xxfd: mcp25xxfd_ring_free(): fix memory leak during cleanup
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 ` [PATCH 02/13] can: mcp25xxfd: mcp25xxfd_probe(): add SPI clk limit related errata information Marc Kleine-Budde
@ 2020-09-30 20:18 ` 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
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Dan Carpenter, Marc Kleine-Budde
From: Dan Carpenter <dan.carpenter@oracle.com>
This loop doesn't free the first element of the array. The "i > 0" has
to be changed to "i >= 0".
Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200923112752.GA1473821@mwanda
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index c094bb716256..b91180b560fd 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -377,7 +377,7 @@ static void mcp25xxfd_ring_free(struct mcp25xxfd_priv *priv)
{
int i;
- for (i = ARRAY_SIZE(priv->rx) - 1; i > 0; i--) {
+ for (i = ARRAY_SIZE(priv->rx) - 1; i >= 0; i--) {
kfree(priv->rx[i]);
priv->rx[i] = NULL;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/13] can: mcp25xxfd: mcp25xxfd_irq(): add missing initialization of variable set_normal mode
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (2 preceding siblings ...)
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 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 05/13] dt-binding: can: mcp25xxfd: documentation fixes Marc Kleine-Budde
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Marc Kleine-Budde, Dan Carpenter,
Manivannan Sadhasivam
This patch fixes the following warning:
drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c:2155 mcp25xxfd_irq()
error: uninitialized symbol 'set_normal_mode'.
by adding the missing initialization.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Fixes: 55e5b97f003e ("can: mcp25xxfd: add driver for Microchip MCP25xxFD SPI CAN")
Link: https://lore.kernel.org/r/20200923114726.2704426-1-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index b91180b560fd..95d5cb46bc63 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -2080,7 +2080,7 @@ static irqreturn_t mcp25xxfd_irq(int irq, void *dev_id)
do {
u32 intf_pending, intf_pending_clearable;
- bool set_normal_mode;
+ bool set_normal_mode = false;
err = regmap_bulk_read(priv->map_reg, MCP25XXFD_REG_INT,
&priv->regs_status,
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/13] dt-binding: can: mcp25xxfd: documentation fixes
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (3 preceding siblings ...)
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 ` 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
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Oleksij Rempel, Rob Herring,
Marc Kleine-Budde
From: Oleksij Rempel <o.rempel@pengutronix.de>
Apply following fixes:
- Use 'interrupts'. (interrupts-extended will automagically be supported
by the tools)
- *-supply is always a single item. So, drop maxItems=1
- add "additionalProperties: false" flag to detect unneeded properties.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20200923125301.27200-1-o.rempel@pengutronix.de
Reported-by: Rob Herring <robh@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Fixes: 1b5a78e69c1f ("dt-binding: can: mcp25xxfd: document device tree bindings")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
.../devicetree/bindings/net/can/microchip,mcp25xxfd.yaml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
index aa2cad14d6d7..5beb00a614bf 100644
--- a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
@@ -24,7 +24,7 @@ properties:
reg:
maxItems: 1
- interrupts-extended:
+ interrupts:
maxItems: 1
clocks:
@@ -32,11 +32,9 @@ properties:
vdd-supply:
description: Regulator that powers the CAN controller.
- maxItems: 1
xceiver-supply:
description: Regulator that powers the CAN transceiver.
- maxItems: 1
microchip,rx-int-gpios:
description:
@@ -52,9 +50,11 @@ properties:
required:
- compatible
- reg
- - interrupts-extended
+ - interrupts
- clocks
+additionalProperties: false
+
examples:
- |
#include <dt-bindings/gpio/gpio.h>
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/13] dt-binding: can: mcp251xfd: narrow down wildcards in device tree bindings to "microchip,mcp251xfd"
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (4 preceding siblings ...)
2020-09-30 20:18 ` [PATCH 05/13] dt-binding: can: mcp25xxfd: documentation fixes Marc Kleine-Budde
@ 2020-09-30 20:18 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 07/13] can: mcp25xxfd: " Marc Kleine-Budde
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Thomas Kopp, Geert Uytterhoeven,
Marc Kleine-Budde
From: Thomas Kopp <thomas.kopp@microchip.com>
The wildcard should be narrowed down to prevent existing and future devices
that are not compatible from matching. It is very unlikely that incompatible
devices will be released that do not match the wildcard.
This is the documentation part of the commit.
Discussion Reference: https://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
Link: https://lore.kernel.org/r/20200930091423.755-2-thomas.kopp@microchip.com
[mkl: rename file, too]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
...{microchip,mcp25xxfd.yaml => microchip,mcp251xfd.yaml} | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
rename Documentation/devicetree/bindings/net/can/{microchip,mcp25xxfd.yaml => microchip,mcp251xfd.yaml} (91%)
diff --git a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml b/Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml
similarity index 91%
rename from Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
rename to Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml
index 5beb00a614bf..2a884c1fe0e0 100644
--- a/Documentation/devicetree/bindings/net/can/microchip,mcp25xxfd.yaml
+++ b/Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
-$id: http://devicetree.org/schemas/net/can/microchip,mcp25xxfd.yaml#
+$id: http://devicetree.org/schemas/net/can/microchip,mcp251xfd.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title:
@@ -18,7 +18,7 @@ properties:
description: for MCP2517FD
- const: microchip,mcp2518fd
description: for MCP2518FD
- - const: microchip,mcp25xxfd
+ - const: microchip,mcp251xfd
description: to autodetect chip variant
reg:
@@ -38,7 +38,7 @@ properties:
microchip,rx-int-gpios:
description:
- GPIO phandle of GPIO connected to to INT1 pin of the MCP25XXFD, which
+ GPIO phandle of GPIO connected to to INT1 pin of the MCP251XFD, which
signals a pending RX interrupt.
maxItems: 1
@@ -65,7 +65,7 @@ examples:
#size-cells = <0>;
can@0 {
- compatible = "microchip,mcp25xxfd";
+ compatible = "microchip,mcp251xfd";
reg = <0>;
clocks = <&can0_osc>;
pinctrl-names = "default";
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/13] can: mcp25xxfd: narrow down wildcards in device tree bindings to "microchip,mcp251xfd"
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (5 preceding siblings ...)
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 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 08/13] can: mcp251xfd: rename driver files and subdir to mcp251xfd Marc Kleine-Budde
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev
Cc: davem, linux-can, kernel, Thomas Kopp, Geert Uytterhoeven,
Marc Kleine-Budde
From: Thomas Kopp <thomas.kopp@microchip.com>
The wildcard should be narrowed down to prevent existing and future devices
that are not compatible from matching. It is very unlikely that incompatible
devices will be released that do not match the wildcard.
Discussion Reference: https://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Thomas Kopp <thomas.kopp@microchip.com>
Link: https://lore.kernel.org/r/20200930091423.755-1-thomas.kopp@microchip.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c | 18 +++++++++---------
drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h | 4 ++--
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
index 95d5cb46bc63..181207139343 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
@@ -41,10 +41,10 @@ static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp2518fd = {
};
/* Autodetect model, start with CRC enabled. */
-static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp25xxfd = {
+static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp251xfd = {
.quirks = MCP25XXFD_QUIRK_CRC_REG | MCP25XXFD_QUIRK_CRC_RX |
MCP25XXFD_QUIRK_CRC_TX | MCP25XXFD_QUIRK_ECC,
- .model = MCP25XXFD_MODEL_MCP25XXFD,
+ .model = MCP25XXFD_MODEL_MCP251XFD,
};
static const struct can_bittiming_const mcp25xxfd_bittiming_const = {
@@ -78,8 +78,8 @@ static const char *__mcp25xxfd_get_model_str(enum mcp25xxfd_model model)
return "MCP2517FD"; break;
case MCP25XXFD_MODEL_MCP2518FD:
return "MCP2518FD"; break;
- case MCP25XXFD_MODEL_MCP25XXFD:
- return "MCP25xxFD"; break;
+ case MCP25XXFD_MODEL_MCP251XFD:
+ return "MCP251xFD"; break;
}
return "<unknown>";
@@ -2494,7 +2494,7 @@ static int mcp25xxfd_register_chip_detect(struct mcp25xxfd_priv *priv)
else
devtype_data = &mcp25xxfd_devtype_data_mcp2517fd;
- if (!mcp25xxfd_is_25XX(priv) &&
+ if (!mcp25xxfd_is_251X(priv) &&
priv->devtype_data.model != devtype_data->model) {
netdev_info(ndev,
"Detected %s, but firmware specifies a %s. Fixing up.",
@@ -2703,8 +2703,8 @@ static const struct of_device_id mcp25xxfd_of_match[] = {
.compatible = "microchip,mcp2518fd",
.data = &mcp25xxfd_devtype_data_mcp2518fd,
}, {
- .compatible = "microchip,mcp25xxfd",
- .data = &mcp25xxfd_devtype_data_mcp25xxfd,
+ .compatible = "microchip,mcp251xfd",
+ .data = &mcp25xxfd_devtype_data_mcp251xfd,
}, {
/* sentinel */
},
@@ -2719,8 +2719,8 @@ static const struct spi_device_id mcp25xxfd_id_table[] = {
.name = "mcp2518fd",
.driver_data = (kernel_ulong_t)&mcp25xxfd_devtype_data_mcp2518fd,
}, {
- .name = "mcp25xxfd",
- .driver_data = (kernel_ulong_t)&mcp25xxfd_devtype_data_mcp25xxfd,
+ .name = "mcp251xfd",
+ .driver_data = (kernel_ulong_t)&mcp25xxfd_devtype_data_mcp251xfd,
}, {
/* sentinel */
},
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
index 3bc799204cb0..b1b5d7fd33ea 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
+++ b/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
@@ -553,7 +553,7 @@ struct mcp25xxfd_regs_status {
enum mcp25xxfd_model {
MCP25XXFD_MODEL_MCP2517FD = 0x2517,
MCP25XXFD_MODEL_MCP2518FD = 0x2518,
- MCP25XXFD_MODEL_MCP25XXFD = 0xffff, /* autodetect model */
+ MCP25XXFD_MODEL_MCP251XFD = 0xffff, /* autodetect model */
};
struct mcp25xxfd_devtype_data {
@@ -607,7 +607,7 @@ mcp25xxfd_is_##_model(const struct mcp25xxfd_priv *priv) \
MCP25XXFD_IS(2517);
MCP25XXFD_IS(2518);
-MCP25XXFD_IS(25XX);
+MCP25XXFD_IS(251X);
static inline u8 mcp25xxfd_first_byte_set(u32 mask)
{
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/13] can: mcp251xfd: rename driver files and subdir to mcp251xfd
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (6 preceding siblings ...)
2020-09-30 20:18 ` [PATCH 07/13] can: mcp25xxfd: " Marc Kleine-Budde
@ 2020-09-30 20:18 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 09/13] can: mcp251xfd: rename all user facing strings " Marc Kleine-Budde
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde
In [1] Geert noted that the autodetect compatible for the mcp25xxfd driver,
which is "microchip,mcp25xxfd" might be too generic and overlap with upcoming,
but incompatible chips.
In the previous patch the autodetect DT compatbile has been renamed to
"microchip,mcp251xfd", this patch changes the name of the driver subdir and the
individual files accordinly.
[1] http://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com
Link: https://lore.kernel.org/r/20200930091424.792165-8-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/Kconfig | 2 +-
drivers/net/can/spi/Makefile | 2 +-
drivers/net/can/spi/{mcp25xxfd => mcp251xfd}/Kconfig | 0
drivers/net/can/spi/mcp251xfd/Makefile | 8 ++++++++
.../mcp25xxfd-core.c => mcp251xfd/mcp251xfd-core.c} | 2 +-
.../mcp25xxfd-crc16.c => mcp251xfd/mcp251xfd-crc16.c} | 2 +-
.../mcp25xxfd-regmap.c => mcp251xfd/mcp251xfd-regmap.c} | 2 +-
.../spi/{mcp25xxfd/mcp25xxfd.h => mcp251xfd/mcp251xfd.h} | 0
drivers/net/can/spi/mcp25xxfd/Makefile | 8 --------
9 files changed, 13 insertions(+), 13 deletions(-)
rename drivers/net/can/spi/{mcp25xxfd => mcp251xfd}/Kconfig (100%)
create mode 100644 drivers/net/can/spi/mcp251xfd/Makefile
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd-core.c => mcp251xfd/mcp251xfd-core.c} (99%)
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd-crc16.c => mcp251xfd/mcp251xfd-crc16.c} (99%)
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd-regmap.c => mcp251xfd/mcp251xfd-regmap.c} (99%)
rename drivers/net/can/spi/{mcp25xxfd/mcp25xxfd.h => mcp251xfd/mcp251xfd.h} (100%)
delete mode 100644 drivers/net/can/spi/mcp25xxfd/Makefile
diff --git a/drivers/net/can/spi/Kconfig b/drivers/net/can/spi/Kconfig
index a82240628c33..f45449210047 100644
--- a/drivers/net/can/spi/Kconfig
+++ b/drivers/net/can/spi/Kconfig
@@ -13,6 +13,6 @@ config CAN_MCP251X
Driver for the Microchip MCP251x and MCP25625 SPI CAN
controllers.
-source "drivers/net/can/spi/mcp25xxfd/Kconfig"
+source "drivers/net/can/spi/mcp251xfd/Kconfig"
endmenu
diff --git a/drivers/net/can/spi/Makefile b/drivers/net/can/spi/Makefile
index 20c18ac96b1c..33e3f60bbc10 100644
--- a/drivers/net/can/spi/Makefile
+++ b/drivers/net/can/spi/Makefile
@@ -6,4 +6,4 @@
obj-$(CONFIG_CAN_HI311X) += hi311x.o
obj-$(CONFIG_CAN_MCP251X) += mcp251x.o
-obj-y += mcp25xxfd/
+obj-y += mcp251xfd/
diff --git a/drivers/net/can/spi/mcp25xxfd/Kconfig b/drivers/net/can/spi/mcp251xfd/Kconfig
similarity index 100%
rename from drivers/net/can/spi/mcp25xxfd/Kconfig
rename to drivers/net/can/spi/mcp251xfd/Kconfig
diff --git a/drivers/net/can/spi/mcp251xfd/Makefile b/drivers/net/can/spi/mcp251xfd/Makefile
new file mode 100644
index 000000000000..e943e6a2db0c
--- /dev/null
+++ b/drivers/net/can/spi/mcp251xfd/Makefile
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_CAN_MCP25XXFD) += mcp25xxfd.o
+
+mcp25xxfd-objs :=
+mcp25xxfd-objs += mcp251xfd-core.o
+mcp25xxfd-objs += mcp251xfd-crc16.o
+mcp25xxfd-objs += mcp251xfd-regmap.o
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
similarity index 99%
rename from drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
rename to drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 181207139343..7cd14531ab1e 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -23,7 +23,7 @@
#include <asm/unaligned.h>
-#include "mcp25xxfd.h"
+#include "mcp251xfd.h"
#define DEVICE_NAME "mcp25xxfd"
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-crc16.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-crc16.c
similarity index 99%
rename from drivers/net/can/spi/mcp25xxfd/mcp25xxfd-crc16.c
rename to drivers/net/can/spi/mcp251xfd/mcp251xfd-crc16.c
index 79d09aaebf33..bc90afb34df2 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-crc16.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-crc16.c
@@ -12,7 +12,7 @@
// Copyright (c) 2019 Martin Sperl <kernel@martin.sperl.org>
//
-#include "mcp25xxfd.h"
+#include "mcp251xfd.h"
/* The standard crc16 in linux/crc16.h is unfortunately not computing
* the correct results (left shift vs. right shift). So here an
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c
similarity index 99%
rename from drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c
rename to drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c
index 376649c7e443..3511317bb49b 100644
--- a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd-regmap.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c
@@ -6,7 +6,7 @@
// Marc Kleine-Budde <kernel@pengutronix.de>
//
-#include "mcp25xxfd.h"
+#include "mcp251xfd.h"
#include <asm/unaligned.h>
diff --git a/drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h
similarity index 100%
rename from drivers/net/can/spi/mcp25xxfd/mcp25xxfd.h
rename to drivers/net/can/spi/mcp251xfd/mcp251xfd.h
diff --git a/drivers/net/can/spi/mcp25xxfd/Makefile b/drivers/net/can/spi/mcp25xxfd/Makefile
deleted file mode 100644
index 4e17f592e22e..000000000000
--- a/drivers/net/can/spi/mcp25xxfd/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-
-obj-$(CONFIG_CAN_MCP25XXFD) += mcp25xxfd.o
-
-mcp25xxfd-objs :=
-mcp25xxfd-objs += mcp25xxfd-core.o
-mcp25xxfd-objs += mcp25xxfd-crc16.o
-mcp25xxfd-objs += mcp25xxfd-regmap.o
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/13] can: mcp251xfd: rename all user facing strings to mcp251xfd
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (7 preceding siblings ...)
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 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 11/13] can: flexcan: initialize all flexcan memory for ECC function Marc Kleine-Budde
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Marc Kleine-Budde
In [1] Geert noted that the autodetect compatible for the mcp25xxfd driver,
which is "microchip,mcp25xxfd" might be too generic and overlap with upcoming,
but incompatible chips.
In the previous patch the autodetect DT compatbile has been renamed to
"microchip,mcp251xfd", this patch changes all user facing strings from
"mcp25xxfd" to "mcp251xfd" and "MCP25XXFD" to "MCP251XFD", including:
- kconfig symbols
- name of kernel module
- DT and SPI compatible
[1] http://lore.kernel.org/r/CAMuHMdVkwGjr6dJuMyhQNqFoJqbh6Ec5V2b5LenCshwpM2SDsQ@mail.gmail.com
Link: https://lore.kernel.org/r/20200930091424.792165-9-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/mcp251xfd/Kconfig | 10 +++++-----
drivers/net/can/spi/mcp251xfd/Makefile | 10 +++++-----
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/Kconfig b/drivers/net/can/spi/mcp251xfd/Kconfig
index 9eb596019a58..f5a147a92cb2 100644
--- a/drivers/net/can/spi/mcp251xfd/Kconfig
+++ b/drivers/net/can/spi/mcp251xfd/Kconfig
@@ -1,14 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-only
-config CAN_MCP25XXFD
- tristate "Microchip MCP25xxFD SPI CAN controllers"
+config CAN_MCP251XFD
+ tristate "Microchip MCP251xFD SPI CAN controllers"
select REGMAP
help
- Driver for the Microchip MCP25XXFD SPI FD-CAN controller
+ Driver for the Microchip MCP251XFD SPI FD-CAN controller
family.
-config CAN_MCP25XXFD_SANITY
- depends on CAN_MCP25XXFD
+config CAN_MCP251XFD_SANITY
+ depends on CAN_MCP251XFD
bool "Additional Sanity Checks"
help
This option enables additional sanity checks in the driver,
diff --git a/drivers/net/can/spi/mcp251xfd/Makefile b/drivers/net/can/spi/mcp251xfd/Makefile
index e943e6a2db0c..cb71244cbe89 100644
--- a/drivers/net/can/spi/mcp251xfd/Makefile
+++ b/drivers/net/can/spi/mcp251xfd/Makefile
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_CAN_MCP25XXFD) += mcp25xxfd.o
+obj-$(CONFIG_CAN_MCP251XFD) += mcp251xfd.o
-mcp25xxfd-objs :=
-mcp25xxfd-objs += mcp251xfd-core.o
-mcp25xxfd-objs += mcp251xfd-crc16.o
-mcp25xxfd-objs += mcp251xfd-regmap.o
+mcp251xfd-objs :=
+mcp251xfd-objs += mcp251xfd-core.o
+mcp251xfd-objs += mcp251xfd-crc16.o
+mcp251xfd-objs += mcp251xfd-regmap.o
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 7cd14531ab1e..37d3f07c9bf6 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -25,7 +25,7 @@
#include "mcp251xfd.h"
-#define DEVICE_NAME "mcp25xxfd"
+#define DEVICE_NAME "mcp251xfd"
static const struct mcp25xxfd_devtype_data mcp25xxfd_devtype_data_mcp2517fd = {
.quirks = MCP25XXFD_QUIRK_MAB_NO_WARN | MCP25XXFD_QUIRK_CRC_REG |
@@ -2923,5 +2923,5 @@ static struct spi_driver mcp25xxfd_driver = {
module_spi_driver(mcp25xxfd_driver);
MODULE_AUTHOR("Marc Kleine-Budde <mkl@pengutronix.de>");
-MODULE_DESCRIPTION("Microchip MCP25xxFD Family CAN controller driver");
+MODULE_DESCRIPTION("Microchip MCP251xFD Family CAN controller driver");
MODULE_LICENSE("GPL v2");
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 11/13] can: flexcan: initialize all flexcan memory for ECC function
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (8 preceding siblings ...)
2020-09-30 20:18 ` [PATCH 09/13] can: mcp251xfd: rename all user facing strings " Marc Kleine-Budde
@ 2020-09-30 20:18 ` Marc Kleine-Budde
2020-09-30 20:18 ` [PATCH 12/13] can: flexcan: add flexcan driver for i.MX8MP Marc Kleine-Budde
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Joakim Zhang, Marc Kleine-Budde
From: Joakim Zhang <qiangqing.zhang@nxp.com>
One issue was reported at a baremetal environment, which is used for
FPGA verification. "The first transfer will fail for extended ID
format(for both 2.0B and FD format), following frames can be transmitted
and received successfully for extended format, and standard format don't
have this issue. This issue occurred randomly with high possiblity, when
it occurs, the transmitter will detect a BIT1 error, the receiver a CRC
error. According to the spec, a non-correctable error may cause this
transfer failure."
With FLEXCAN_QUIRK_DISABLE_MECR quirk, it supports correctable errors,
disable non-correctable errors interrupt and freeze mode. Platform has
ECC hardware support, but select this quirk, this issue may not come to
light. Initialize all FlexCAN memory before accessing them, at least it
can avoid non-correctable errors detected due to memory uninitialized.
The internal region can't be initialized when the hardware doesn't support
ECC.
According to IMX8MPRM, Rev.C, 04/2020. There is a NOTE at the section
11.8.3.13 Detection and correction of memory errors:
"All FlexCAN memory must be initialized before starting its operation in
order to have the parity bits in memory properly updated. CTRL2[WRMFRZ]
grants write access to all memory positions that require initialization,
ranging from 0x080 to 0xADF and from 0xF28 to 0xFFF when the CAN FD feature
is enabled. The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers need to
be initialized as well. MCR[RFEN] must not be set during memory initialization."
Memory range from 0x080 to 0xADF, there are reserved memory (unimplemented
by hardware, e.g. only configure 64 MBs), these memory can be initialized or not.
In this patch, initialize all flexcan memory which includes reserved memory.
In this patch, create FLEXCAN_QUIRK_SUPPORT_ECC for platforms which has ECC
feature. If you have a ECC platform in your hand, please select this
qurik to initialize all flexcan memory firstly, then you can select
FLEXCAN_QUIRK_DISABLE_MECR to only enable correctable errors.
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Link: https://lore.kernel.org/r/20200929211557.14153-2-qiangqing.zhang@nxp.com
[mkl: wrap long lines]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 53 +++++++++++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index e86925134009..19a29618f0c0 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -239,6 +239,8 @@
#define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8)
/* Support CAN-FD mode */
#define FLEXCAN_QUIRK_SUPPORT_FD BIT(9)
+/* support memory detection and correction */
+#define FLEXCAN_QUIRK_SUPPORT_ECC BIT(10)
/* Structure of the message buffer */
struct flexcan_mb {
@@ -292,7 +294,16 @@ struct flexcan_regs {
u32 rximr[64]; /* 0x880 - Not affected by Soft Reset */
u32 _reserved5[24]; /* 0x980 */
u32 gfwr_mx6; /* 0x9e0 - MX6 */
- u32 _reserved6[63]; /* 0x9e4 */
+ u32 _reserved6[39]; /* 0x9e4 */
+ u32 _rxfir[6]; /* 0xa80 */
+ u32 _reserved8[2]; /* 0xa98 */
+ u32 _rxmgmask; /* 0xaa0 */
+ u32 _rxfgmask; /* 0xaa4 */
+ u32 _rx14mask; /* 0xaa8 */
+ u32 _rx15mask; /* 0xaac */
+ u32 tx_smb[4]; /* 0xab0 */
+ u32 rx_smb0[4]; /* 0xac0 */
+ u32 rx_smb1[4]; /* 0xad0 */
u32 mecr; /* 0xae0 */
u32 erriar; /* 0xae4 */
u32 erridpr; /* 0xae8 */
@@ -305,9 +316,13 @@ struct flexcan_regs {
u32 fdctrl; /* 0xc00 - Not affected by Soft Reset */
u32 fdcbt; /* 0xc04 - Not affected by Soft Reset */
u32 fdcrc; /* 0xc08 */
+ u32 _reserved9[199]; /* 0xc0c */
+ u32 tx_smb_fd[18]; /* 0xf28 */
+ u32 rx_smb0_fd[18]; /* 0xf70 */
+ u32 rx_smb1_fd[18]; /* 0xfb8 */
};
-static_assert(sizeof(struct flexcan_regs) == 0x4 + 0xc08);
+static_assert(sizeof(struct flexcan_regs) == 0x4 * 18 + 0xfb8);
struct flexcan_devtype_data {
u32 quirks; /* quirks needed for different IP cores */
@@ -1292,6 +1307,37 @@ static void flexcan_set_bittiming(struct net_device *dev)
return flexcan_set_bittiming_ctrl(dev);
}
+static void flexcan_ram_init(struct net_device *dev)
+{
+ struct flexcan_priv *priv = netdev_priv(dev);
+ struct flexcan_regs __iomem *regs = priv->regs;
+ u32 reg_ctrl2;
+
+ /* 11.8.3.13 Detection and correction of memory errors:
+ * CTRL2[WRMFRZ] grants write access to all memory positions
+ * that require initialization, ranging from 0x080 to 0xADF
+ * and from 0xF28 to 0xFFF when the CAN FD feature is enabled.
+ * The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers
+ * need to be initialized as well. MCR[RFEN] must not be set
+ * during memory initialization.
+ */
+ reg_ctrl2 = priv->read(®s->ctrl2);
+ reg_ctrl2 |= FLEXCAN_CTRL2_WRMFRZ;
+ priv->write(reg_ctrl2, ®s->ctrl2);
+
+ memset_io(®s->mb[0][0], 0,
+ offsetof(struct flexcan_regs, rx_smb1[3]) -
+ offsetof(struct flexcan_regs, mb[0][0]) + 0x4);
+
+ if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
+ memset_io(®s->tx_smb_fd[0], 0,
+ offsetof(struct flexcan_regs, rx_smb1_fd[17]) -
+ offsetof(struct flexcan_regs, tx_smb_fd[0]) + 0x4);
+
+ reg_ctrl2 &= ~FLEXCAN_CTRL2_WRMFRZ;
+ priv->write(reg_ctrl2, ®s->ctrl2);
+}
+
/* flexcan_chip_start
*
* this functions is entered with clocks enabled
@@ -1316,6 +1362,9 @@ static int flexcan_chip_start(struct net_device *dev)
if (err)
goto out_chip_disable;
+ if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_ECC)
+ flexcan_ram_init(dev);
+
flexcan_set_bittiming(dev);
/* MCR
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 12/13] can: flexcan: add flexcan driver for i.MX8MP
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (9 preceding siblings ...)
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 ` 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
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Joakim Zhang, Marc Kleine-Budde
From: Joakim Zhang <qiangqing.zhang@nxp.com>
Add flexcan driver for i.MX8MP, which supports CAN FD and ECC.
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Link: https://lore.kernel.org/r/20200929211557.14153-3-qiangqing.zhang@nxp.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 19a29618f0c0..9cf1de42f428 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -214,6 +214,7 @@
* MX53 FlexCAN2 03.00.00.00 yes no no no no no
* MX6s FlexCAN3 10.00.12.00 yes yes no no yes no
* MX8QM FlexCAN3 03.00.23.00 yes yes no no yes yes
+ * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes
* VF610 FlexCAN3 ? no yes no yes yes? no
* LS1021A FlexCAN2 03.00.04.00 no yes no no yes no
* LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes
@@ -391,6 +392,13 @@ static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = {
FLEXCAN_QUIRK_SUPPORT_FD,
};
+static struct flexcan_devtype_data fsl_imx8mp_devtype_data = {
+ .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
+ FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |
+ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE |
+ FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC,
+};
+
static const struct flexcan_devtype_data fsl_vf610_devtype_data = {
.quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP |
@@ -1894,6 +1902,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev)
static const struct of_device_id flexcan_of_match[] = {
{ .compatible = "fsl,imx8qm-flexcan", .data = &fsl_imx8qm_devtype_data, },
+ { .compatible = "fsl,imx8mp-flexcan", .data = &fsl_imx8mp_devtype_data, },
{ .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
{ .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
{ .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, },
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 13/13] can: flexcan: disable runtime PM if register flexcandev failed
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (10 preceding siblings ...)
2020-09-30 20:18 ` [PATCH 12/13] can: flexcan: add flexcan driver for i.MX8MP Marc Kleine-Budde
@ 2020-09-30 20:18 ` Marc Kleine-Budde
2020-09-30 22:21 ` pull-request: can-next 2020-09-30 David Miller
12 siblings, 0 replies; 14+ messages in thread
From: Marc Kleine-Budde @ 2020-09-30 20:18 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-can, kernel, Joakim Zhang, Marc Kleine-Budde
From: Joakim Zhang <qiangqing.zhang@nxp.com>
Disable runtime PM if register flexcandev failed, and balance reference
of usage_count.
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Link: https://lore.kernel.org/r/20200929211557.14153-4-qiangqing.zhang@nxp.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/flexcan.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 9cf1de42f428..fbdd9a8c9374 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -2057,6 +2057,8 @@ static int flexcan_probe(struct platform_device *pdev)
return 0;
failed_register:
+ pm_runtime_put_noidle(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
free_candev(dev);
return err;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: pull-request: can-next 2020-09-30
2020-09-30 20:18 pull-request: can-next 2020-09-30 Marc Kleine-Budde
` (11 preceding siblings ...)
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 ` David Miller
12 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2020-09-30 22:21 UTC (permalink / raw)
To: mkl; +Cc: netdev, linux-can, kernel
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 30 Sep 2020 22:18:03 +0200
> this is a pull request of 13 patches for net-next.
Pulled, thanks Marc.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-09-30 22:22 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 02/13] can: mcp25xxfd: mcp25xxfd_probe(): add SPI clk limit related errata information Marc Kleine-Budde
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
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).