2020-04-10 02:47:05 +00:00
|
|
|
From 094a648bc2217a9624f35224059c3eac86196143 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Joakim Zhang <qiangqing.zhang@nxp.com>
|
|
|
|
Date: Fri, 12 Jul 2019 08:02:51 +0000
|
|
|
|
Subject: [PATCH] can: flexcan: add ISO CAN FD feature support
|
|
|
|
|
|
|
|
ISO CAN FD is introduced to increase the failture detection capability
|
|
|
|
than non-ISO CAN FD. The non-ISO CAN FD is still supported by FlexCAN so
|
|
|
|
that it can be used mainly during an intermediate phase, for evaluation
|
|
|
|
and development purposes.
|
|
|
|
|
|
|
|
Therefore, it is strongly recommended to configure FlexCAN to the ISO
|
|
|
|
CAN FD protocol by setting the ISOCANFDEN field in the CTRL2 register.
|
|
|
|
|
|
|
|
NOTE: If you only set "fd on", driver will use ISO FD mode by default.
|
|
|
|
You should set "fd-non-iso on" after setting "fd on" if you want to use
|
|
|
|
NON ISO FD mode.
|
|
|
|
|
|
|
|
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
|
|
|
|
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
|
|
|
---
|
|
|
|
drivers/net/can/flexcan.c | 8 +++++++-
|
|
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/can/flexcan.c
|
|
|
|
+++ b/drivers/net/can/flexcan.c
|
|
|
|
@@ -92,6 +92,7 @@
|
|
|
|
#define FLEXCAN_CTRL2_MRP BIT(18)
|
|
|
|
#define FLEXCAN_CTRL2_RRS BIT(17)
|
|
|
|
#define FLEXCAN_CTRL2_EACEN BIT(16)
|
|
|
|
+#define FLEXCAN_CTRL2_ISOCANFDEN BIT(12)
|
|
|
|
|
|
|
|
/* FLEXCAN memory error control register (MECR) bits */
|
|
|
|
#define FLEXCAN_MECR_ECRWRDIS BIT(31)
|
|
|
|
@@ -1323,6 +1324,7 @@ static int flexcan_chip_start(struct net
|
|
|
|
reg_fdctrl = priv->read(®s->fdctrl) & ~FLEXCAN_FDCTRL_FDRATE;
|
|
|
|
reg_fdctrl &= ~(FLEXCAN_FDCTRL_MBDSR1(0x3) | FLEXCAN_FDCTRL_MBDSR0(0x3));
|
|
|
|
reg_mcr = priv->read(®s->mcr) & ~FLEXCAN_MCR_FDEN;
|
|
|
|
+ reg_ctrl2 = priv->read(®s->ctrl2) & ~FLEXCAN_CTRL2_ISOCANFDEN;
|
|
|
|
|
|
|
|
/* support BRS when set CAN FD mode
|
|
|
|
* 64 bytes payload per MB and 7 MBs per RAM block by default
|
|
|
|
@@ -1332,10 +1334,14 @@ static int flexcan_chip_start(struct net
|
|
|
|
reg_fdctrl |= FLEXCAN_FDCTRL_FDRATE;
|
|
|
|
reg_fdctrl |= FLEXCAN_FDCTRL_MBDSR1(0x3) | FLEXCAN_FDCTRL_MBDSR0(0x3);
|
|
|
|
reg_mcr |= FLEXCAN_MCR_FDEN;
|
|
|
|
+
|
|
|
|
+ if (!(priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO))
|
|
|
|
+ reg_ctrl2 |= FLEXCAN_CTRL2_ISOCANFDEN;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->write(reg_fdctrl, ®s->fdctrl);
|
|
|
|
priv->write(reg_mcr, ®s->mcr);
|
|
|
|
+ priv->write(reg_ctrl2, ®s->ctrl2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((priv->devtype_data->quirks & FLEXCAN_QUIRK_ENABLE_EACEN_RRS)) {
|
kernel: bump 5.4 to 5.4.73
Removed upstreamed patches:
generic/pending-5.4
445-mtd-spinand-gigadevice-Only-one-dummy-byte-in-QUA.patch
446-mtd-spinand-gigadevice-Add-QE-Bit.patch
pistachio/patches-5.4
150-pwm-img-Fix-null-pointer-access-in-probe.patch
Manually rebased:
layerscape/patches-5.4
801-audio-0011-Revert-ASoC-fsl_sai-add-of_match-data.patch
801-audio-0039-MLK-16224-6-ASoC-fsl_sai-fix-DSD-suspend-resume.patch
801-audio-0073-MLK-21957-3-ASoC-fsl_sai-add-bitcount-and-timestamp-.patch
820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh.patch
All modifications made by update_kernel.sh
Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711,
mvebu (mamba, rango), x86_64, ramips/mt7621
Run-tested: ipq806x/R7800, mvebu (mamba, rango), x86_64, ramips (RT-AC57U)
No dmesg regressions, everything functional
Signed-off-by: John Audia <graysky@archlinux.us>
[alter 820-usb-0009-usb-dwc3-Add-workaround-for-host-mode-VBUS-glitch-wh]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-31 11:35:12 +00:00
|
|
|
@@ -1853,7 +1859,7 @@ static int flexcan_probe(struct platform
|
2020-04-10 02:47:05 +00:00
|
|
|
|
|
|
|
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_TIMESTAMP_SUPPORT_FD) {
|
|
|
|
if (priv->devtype_data->quirks & FLEXCAN_QUIRK_USE_OFF_TIMESTAMP) {
|
|
|
|
- priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD;
|
|
|
|
+ priv->can.ctrlmode_supported |= CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO;
|
|
|
|
priv->can.bittiming_const = &flexcan_fd_bittiming_const;
|
|
|
|
priv->can.data_bittiming_const = &flexcan_fd_data_bittiming_const;
|
|
|
|
} else {
|