提交 0e4b949e 编写于 作者: A Arnd Bergmann 提交者: Marc Kleine-Budde

can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc

There is no reason to disallow building the driver on big-endian ARM kernels.
Furthermore, the current behavior is actually broken on little-endian PowerPC
as well.

The choice of register accessor functions must purely depend on the CPU
architecture, not which endianess the CPU is running on. Note that we nowadays
allow both big-endian ARM and little-endian PowerPC kernels.

With this patch applied, we will do the right thing in all four combinations.
Signed-off-by: NArnd Bergmann <arnd@arndb.de>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 c044dc21
...@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3 ...@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
config CAN_FLEXCAN config CAN_FLEXCAN
tristate "Support for Freescale FLEXCAN based chips" tristate "Support for Freescale FLEXCAN based chips"
depends on (ARM && CPU_LITTLE_ENDIAN) || PPC depends on ARM || PPC
---help--- ---help---
Say Y here if you want to support for Freescale FlexCAN. Say Y here if you want to support for Freescale FlexCAN.
......
...@@ -235,9 +235,12 @@ static const struct can_bittiming_const flexcan_bittiming_const = { ...@@ -235,9 +235,12 @@ static const struct can_bittiming_const flexcan_bittiming_const = {
}; };
/* /*
* Abstract off the read/write for arm versus ppc. * Abstract off the read/write for arm versus ppc. This
* assumes that PPC uses big-endian registers and everything
* else uses little-endian registers, independent of CPU
* endianess.
*/ */
#if defined(__BIG_ENDIAN) #if defined(CONFIG_PPC)
static inline u32 flexcan_read(void __iomem *addr) static inline u32 flexcan_read(void __iomem *addr)
{ {
return in_be32(addr); return in_be32(addr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册