can: c_can: Fix RX message handling, handle lost message before EOB

If we handle end of block messages with higher priority than a lost message,
we can run into an endless interrupt loop.

This is reproducable with a am335x processor and "cansequence -r" at 1Mbit.
As soon as we loose a packet we can't escape from an interrupt loop.

This patch fixes the problem by handling lost packets before EOB packets.

Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
ARM: dts: DRA7xx: Fix DCAN1 stuck in transition

We need to disable weak PULLS for the DCAN1_TX pin to prevent
the DCAN1 module from being stuck in transistion when DCAN1
interface is brought down while CAN bus is idle.

Signed-off-by: Roger Quadros <rogerq@ti.com>
net: can: c_can: Disable pins when CAN interface is down

DRA7 CAN IP suffers from a problem which causes it to be prevented
from fully turning OFF (i.e. stuck in transition) if the module was
disabled while there was traffic on the CAN_RX line.

To work around this issue we select the SLEEP pin state by default
on probe and use the DEFAULT pin state on CAN up and back to the
SLEEP pin state on CAN down.

Signed-off-by: Roger Quadros <rogerq@ti.com>
ARM: dts: DRA7xx: Add SLEEP pins for DCAN1

This is a workaround to prevent DCAN1 from being stuck in
transition when DCAN1 module is disabled with CAN traffic
present on DCAN1_RX pin.

Signed-off-by: Roger Quadros <rogerq@ti.com>
net: can: c_can: Fix done bit for DCAN2 instance

Done bit was never initialized for DCAN2 and so was left as 0.
Fix this up.

This also fixes the DCAN2 instance being stuck in transition
when DCAN2 module is disabled even when not connected to CAN
traffic.

Now it correctly transitions to "disabled/can't be accessed"
and we no longer see "omap_hwmod: dcan2: _wait_target_disable failed"
messages in kernel log.

Signed-off-by: Roger Quadros <rogerq@ti.com>