Skip to content

Commit

Permalink
can: flexcan: fix flexcan driver build for big endian on ARM and litt…
Browse files Browse the repository at this point in the history
…le 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 <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Lothar Waßmann <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
arndb authored and marckleinebudde committed Jan 29, 2014
1 parent c044dc2 commit 0e4b949
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/net/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3

config CAN_FLEXCAN
tristate "Support for Freescale FLEXCAN based chips"
depends on (ARM && CPU_LITTLE_ENDIAN) || PPC
depends on ARM || PPC
---help---
Say Y here if you want to support for Freescale FlexCAN.

Expand Down
7 changes: 5 additions & 2 deletions drivers/net/can/flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
return in_be32(addr);
Expand Down

0 comments on commit 0e4b949

Please sign in to comment.