]> git.baikalelectronics.ru Git - kernel.git/commit
can: flexcan: fix endianess detection
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 25 Apr 2018 14:50:39 +0000 (16:50 +0200)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 8 May 2018 08:41:38 +0000 (10:41 +0200)
commit87432f51acdd62f960d2065a25968cffbd3d8af0
treeec7618de4b21dd6736f14d6d9d1ad091876ac2c9
parente6b49f5dcbbc0dad7c404887491faf428aec216d
can: flexcan: fix endianess detection

In commit 39b848f79419 ("can: flexcan: Remodel FlexCAN register r/w APIs
for big endian FlexCAN controllers.") the following logic was
implemented:

if the dt property "big-endian" is given or
   the device is compatible to "fsl,p1010-flexcan":
use big-endian mode;
else
use little-endian mode;

This relies on commit fc42db3d9aa1 ("arm: dts: Remove p1010-flexcan
compatible from imx series dts") which was applied a few commits later.
Without this commit (or an old device tree used for booting a new
kernel) the flexcan devices on i.MX25, i.MX28, i.MX35 and i.MX53 match
the 'the device is compatible to "fsl,p1010-flexcan"' test and so are
switched erroneously to big endian mode.

Instead of the check above put a quirk in devtype data and rely on
of_match_device yielding the most compatible match

Fixes: 39b848f79419 ("can: flexcan: Remodel FlexCAN register r/w APIs for big endian FlexCAN controllers.")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Gavin Schenk <g.schenk@eckelmann.de>
Cc: linux-stable <stable@vger.kernel.org> # >= v4.16
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/flexcan.c