Currently I try to use the Flexcan driver on our Vybrid VF61xx based Colibri VF61 module. I added the relevant platform data to our Timesys based 3.0 Kernel but I do run into IRQ storm on first communication. I also tried the latest mainline kernel, where I have the same issue even just after bringing up the link. The registers during IRQ strom looks like this:
# ip link set can0 type can bitrate 125000
# ip link set can0 up
[ 38.140222] flexcan_chip_enable, mcr is 7980000f
[ 38.145119] flexcan 40020000.flexcan can0: writing ctrl=0x1c3d2007
[ 38.151331] flexcan 40020000.flexcan can0: flexcan_set_bittiming: mcr=0x5980000f ctrl=0x1c3d2007
[ 38.160216] flexcan 40020000.flexcan can0: flexcan_chip_start: writing mcr=0x79a20208
[ 38.168131] flexcan 40020000.flexcan can0: flexcan_chip_start: mcr=0x79a20208
[ 38.175356] flexcan 40020000.flexcan can0: flexcan_chip_start: writing ctrl=0x1c3dac57
[ 38.183365] flexcan 40020000.flexcan can0: flexcan_chip_start: calling flexcan_transceiver_enable
[ 38.192331] flexcan 40020000.flexcan can0: flexcan_chip_start: calling flexcan_chip_unfreeze
[ 38.200820] flexcan 40020000.flexcan can0: flexcan_irq: esr=0x00000000 mcr=0x70a20208 ctrl=0x1c3dac57
[ 38.210146] flexcan 40020000.flexcan can0: flexcan_irq: esr=0x00000000 mcr=0x79a20208 ctrl=0x1c3dac57
[ 38.219543] flexcan 40020000.flexcan can0: flexcan_irq: esr=0x00000000 mcr=0x79a20208 ctrl=0x1c3dac57
The IRQ storm starts juster after unfreezing the CAN module (clearing the HALT bit). What is interesting that the ESR register is empty. Also interesting is that the MCR register is again in HALT mode (bit 28) and on the next interrupt, also the NOTRDY and FRZACK is set, hence it seems that just on the first IRQ the module switches into halt mode.
We use a MCP2551T-I/SN CAN transceiver which works fine with a MCP2515 CAN controller.Also the Pinmux was done according to the recommendation in the Reference Manual.
What makes the Flexcan module to go into halt mode by itself?
The Git tree with the FlexCAN enhancements:
And the patch with those debug output as attachement.
Original Attachment has been moved to: can_debug.patch.zip
I could solve the issue, the thread Flexcan with Vybrid VF6x and MQX4.1 pointed me to the right direction. It seems that also Errata e5295 is related. To fix this, I disable FCMECR[NCEFAFRZ] which should not put the module in freeze mode anymore and also disable the MECR interrupts completely.