aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2014-01-14 05:44:09 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-01-29 14:23:22 -0500
commit0e4b949e6620689b1d3142e20bca2c9d1f918fda (patch)
tree90aa8eada5e819852c0d6be12be7cf25c6615e57 /drivers/net/can
parentc044dc2132d19d8c643cdd340f21afcec177c046 (diff)
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: Arnd Bergmann <arnd@arndb.de> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/Kconfig2
-rw-r--r--drivers/net/can/flexcan.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index d447b881bbde..9e7d95dae2c7 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
104 104
105config CAN_FLEXCAN 105config CAN_FLEXCAN
106 tristate "Support for Freescale FLEXCAN based chips" 106 tristate "Support for Freescale FLEXCAN based chips"
107 depends on (ARM && CPU_LITTLE_ENDIAN) || PPC 107 depends on ARM || PPC
108 ---help--- 108 ---help---
109 Say Y here if you want to support for Freescale FlexCAN. 109 Say Y here if you want to support for Freescale FlexCAN.
110 110
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index aaed97bee471..320bef2dba42 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -235,9 +235,12 @@ static const struct can_bittiming_const flexcan_bittiming_const = {
235}; 235};
236 236
237/* 237/*
238 * Abstract off the read/write for arm versus ppc. 238 * Abstract off the read/write for arm versus ppc. This
239 * assumes that PPC uses big-endian registers and everything
240 * else uses little-endian registers, independent of CPU
241 * endianess.
239 */ 242 */
240#if defined(__BIG_ENDIAN) 243#if defined(CONFIG_PPC)
241static inline u32 flexcan_read(void __iomem *addr) 244static inline u32 flexcan_read(void __iomem *addr)
242{ 245{
243 return in_be32(addr); 246 return in_be32(addr);