]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ENGR00258885 flexcan: fix errata ERR005829 that MB may fail to be sent
authorDong Aisheng <b29396@freescale.com>
Fri, 12 Apr 2013 10:49:36 +0000 (18:49 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:45 +0000 (10:06 +0200)
commitd07c5d09906566b72fbd634f395ca357d66b4a43
treeb3e036aae852a5e9915d44b61d85bf8e62dea2e5
parent1a0df11a15b62ccc06231f24baa922a35d022694
ENGR00258885 flexcan: fix errata ERR005829 that MB may fail to be sent

This is an issue from IC errata ERR005829 which is described as follows:
----------------------------------------------------------
FlexCAN does not transmit a message that is enabled to be transmitted
in a specific moment during the arbitration process. The following
conditions are necessary to have the issue.
- Only one MB is configured to be transmitted
- The write which enables the MB to be transmitted (write on Control status
  word) happens during a specific clock during the arbitration process.

After this arbitration process occurs, the bus goes to Idle state and no
new message is received on bus.

For example:
1) MB13 is deactivated on RxIntermission (write 0x0 on CODE field from Control
Status word) - First write on CODE
2) Reconfigure the ID and data fields
3) Enable the MB13 to be transmitted on BusIdle (write 0xC on Code
field) - Second write on code
4) CAN bus keeps in Idle state
5) No write on Control status from any MB happens.
During the second write on code (step 3), the write must happen one clock
before the current MB13 is to be scanned by arbitration process.
In this case, it does not detect the new code (0xC) and no new arbitration is
scheduled.

The suggested workaround which is implemented in this patch is:
The workaround consists of executing two extra steps:
6. Reserve the first valid mailbox as an inactive mailbox (CODE=0b1000).
If RX FIFO is disabled, this mailbox must be MB0. Otherwise, the first
valid mailbox can be found by using table "RX FIFO filters" on FlexCAN3 chapter.
7. Write twice INACTIVE code (0b1000) into the first valid mailbox.
Note: The first mailbox cannot be used for reception or transmission process.
-------------------------------------------------------------

Note: Although the currently flexcan driver does not have the step 1 to run,
it's also possible to meet this issue in theory because we can not predict
when the arbitration is scheduled.

With a modified can-utils/canfdttest tool simulating Pingpong test, we were
able to reproduce this issue after running a about one day.
After applying this patch, we ran six days and did not see the issue happen
again on two mx6q sabrelite boards.

Note: with a few minors change for new kernel and change errata id from
ERR005641 to ERR005829 which is the open one in freescale website.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
(cherry picked from commit 872eb1691afb83a2760052c615ed410a7cfe71e0)
drivers/net/can/flexcan.c