OpenCloudOS-Kernel/drivers/net/can
Joakim Zhang a6597121d6 can: flexcan: initialize all flexcan memory for ECC function
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>
2020-09-30 21:56:57 +02:00
..
c_can can: c_can: Remove unused inline function 2020-09-21 10:13:17 +02:00
cc770 can: drivers: fix spelling mistakes 2020-09-21 10:13:16 +02:00
ifi_canfd treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
m_can can: drivers: fix spelling mistakes 2020-09-21 10:13:16 +02:00
mscan can: mscan: simplify clock enable/disable 2020-09-21 10:13:19 +02:00
peak_canfd can: peak_canfd: Remove unused macros 2020-09-21 10:13:18 +02:00
rcar treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
sja1000 can: drivers: fix spelling mistakes 2020-09-21 10:13:16 +02:00
softing can: softing: update dead link 2020-09-21 10:13:16 +02:00
spi can: mcp251xfd: rename all remaining occurrence to mcp251xfd 2020-09-30 21:55:28 +02:00
usb can: pcan_usb: add support of rxerr/txerr counters 2020-09-21 10:13:18 +02:00
Kconfig can: slcan: update dead link 2020-09-21 10:13:16 +02:00
Makefile can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices 2019-07-24 10:31:53 +02:00
at91_can.c can: drivers: fix spelling mistakes 2020-09-21 10:13:16 +02:00
dev.c can: dev: can_bus_off(): print scheduling of restart if activated 2020-09-21 10:13:17 +02:00
flexcan.c can: flexcan: initialize all flexcan memory for ECC function 2020-09-30 21:56:57 +02:00
grcan.c can: drivers: fix spelling mistakes 2020-09-21 10:13:16 +02:00
janz-ican3.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
kvaser_pciefd.c can: kvaser_pciefd: the PWM generator is running at the bus frequency of the system. 2019-09-03 10:23:57 +02:00
led.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pch_can.c can: pch_can: use generic power management 2020-09-21 10:13:18 +02:00
rx-offload.c can: rx-offload: can_rx_offload_add_manual(): add new initialization function 2020-09-21 10:13:19 +02:00
slcan.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sun4i_can.c net: Fix return value about devm_platform_ioremap_resource() 2020-05-23 16:28:25 -07:00
ti_hecc.c can: ti_hecc: convert to devm_platform_ioremap_resource_byname() 2020-09-21 10:13:17 +02:00
vcan.c can: make use of preallocated can_ml_priv for per device struct can_dev_rcv_lists 2019-09-04 13:29:15 +02:00
vxcan.c can: make use of preallocated can_ml_priv for per device struct can_dev_rcv_lists 2019-09-04 13:29:15 +02:00
xilinx_can.c can: drivers: fix spelling mistakes 2020-09-21 10:13:16 +02:00