All of lore.kernel.org
 help / color / mirror / Atom feed
* commit 40d4511 "can: Disable flexcan driver build for big endian CPU on ARM" breaks Flexcan on ARM
@ 2014-01-20 11:32 ` Lothar Waßmann
  0 siblings, 0 replies; 6+ messages in thread
From: Lothar Waßmann @ 2014-01-20 11:32 UTC (permalink / raw)
  To: Guenter Roeck, Marc Kleine-Budde
  Cc: linux-arm-kernel, Wolfgang Grandegger, linux-can

Hi,

The commit 40d451181a7fa57e32bca4632ae7b22f80861a73
|Author: Guenter Roeck <linux@roeck-us.net>
|Date:   Mon Jan 6 05:21:03 2014 -0800
|
|    can: Disable flexcan driver build for big endian CPU on ARM
|    
|    Building arm:allmodconfig fails with
|    
|    flexcan.c: In function 'flexcan_read':
|    flexcan.c:243:2: error: implicit declaration of function 'in_be32'
|    flexcan.c: In function 'flexcan_write':
|    flexcan.c:248:2: error: implicit declaration of function 'out_be32'
|    
|    in_be32 and out_be32 do not (or no longer) exist for ARM targets.
|    Disable the build for ARM on big endian CPUs.
|    
|    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
|diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
|index 9e7d95d..d447b88 100644
|--- a/drivers/net/can/Kconfig
|+++ b/drivers/net/can/Kconfig
|@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
| 
| config CAN_FLEXCAN
|        tristate "Support for Freescale FLEXCAN based chips"
|-       depends on ARM || PPC
|+       depends on (ARM && CPU_LITTLE_ENDIAN) || PPC
|        ---help---
|          Say Y here if you want to support for Freescale FlexCAN.
>
completely disables the flexcan driver for all ARM platforms, since the
symbol CPU_LITTLE_ENDIAN does not exist on ARM!


Lothar Waßmann

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* commit 40d4511 "can: Disable flexcan driver build for big endian CPU on ARM" breaks Flexcan on ARM
@ 2014-01-20 11:32 ` Lothar Waßmann
  0 siblings, 0 replies; 6+ messages in thread
From: Lothar Waßmann @ 2014-01-20 11:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

The commit 40d451181a7fa57e32bca4632ae7b22f80861a73
|Author: Guenter Roeck <linux@roeck-us.net>
|Date:   Mon Jan 6 05:21:03 2014 -0800
|
|    can: Disable flexcan driver build for big endian CPU on ARM
|    
|    Building arm:allmodconfig fails with
|    
|    flexcan.c: In function 'flexcan_read':
|    flexcan.c:243:2: error: implicit declaration of function 'in_be32'
|    flexcan.c: In function 'flexcan_write':
|    flexcan.c:248:2: error: implicit declaration of function 'out_be32'
|    
|    in_be32 and out_be32 do not (or no longer) exist for ARM targets.
|    Disable the build for ARM on big endian CPUs.
|    
|    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
|    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|
|diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
|index 9e7d95d..d447b88 100644
|--- a/drivers/net/can/Kconfig
|+++ b/drivers/net/can/Kconfig
|@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
| 
| config CAN_FLEXCAN
|        tristate "Support for Freescale FLEXCAN based chips"
|-       depends on ARM || PPC
|+       depends on (ARM && CPU_LITTLE_ENDIAN) || PPC
|        ---help---
|          Say Y here if you want to support for Freescale FlexCAN.
>
completely disables the flexcan driver for all ARM platforms, since the
symbol CPU_LITTLE_ENDIAN does not exist on ARM!


Lothar Wa?mann

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: commit 40d4511 "can: Disable flexcan driver build for big endian CPU on ARM" breaks Flexcan on ARM
  2014-01-20 11:32 ` Lothar Waßmann
@ 2014-01-20 11:37   ` Marc Kleine-Budde
  -1 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2014-01-20 11:37 UTC (permalink / raw)
  To: Lothar Waßmann, Guenter Roeck
  Cc: Wolfgang Grandegger, linux-can, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]

On 01/20/2014 12:32 PM, Lothar Waßmann wrote:
> Hi,
> 
> The commit 40d451181a7fa57e32bca4632ae7b22f80861a73
> |Author: Guenter Roeck <linux@roeck-us.net>
> |Date:   Mon Jan 6 05:21:03 2014 -0800
> |
> |    can: Disable flexcan driver build for big endian CPU on ARM
> |    
> |    Building arm:allmodconfig fails with
> |    
> |    flexcan.c: In function 'flexcan_read':
> |    flexcan.c:243:2: error: implicit declaration of function 'in_be32'
> |    flexcan.c: In function 'flexcan_write':
> |    flexcan.c:248:2: error: implicit declaration of function 'out_be32'
> |    
> |    in_be32 and out_be32 do not (or no longer) exist for ARM targets.
> |    Disable the build for ARM on big endian CPUs.
> |    
> |    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> |    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> |
> |diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
> |index 9e7d95d..d447b88 100644
> |--- a/drivers/net/can/Kconfig
> |+++ b/drivers/net/can/Kconfig
> |@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
> | 
> | config CAN_FLEXCAN
> |        tristate "Support for Freescale FLEXCAN based chips"
> |-       depends on ARM || PPC
> |+       depends on (ARM && CPU_LITTLE_ENDIAN) || PPC
> |        ---help---
> |          Say Y here if you want to support for Freescale FlexCAN.
>>
> completely disables the flexcan driver for all ARM platforms, since the
> symbol CPU_LITTLE_ENDIAN does not exist on ARM!

Arnd Bergmann posted a better patch, which I'll include in a pull
request once the net tree is open again.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* commit 40d4511 "can: Disable flexcan driver build for big endian CPU on ARM" breaks Flexcan on ARM
@ 2014-01-20 11:37   ` Marc Kleine-Budde
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2014-01-20 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/20/2014 12:32 PM, Lothar Wa?mann wrote:
> Hi,
> 
> The commit 40d451181a7fa57e32bca4632ae7b22f80861a73
> |Author: Guenter Roeck <linux@roeck-us.net>
> |Date:   Mon Jan 6 05:21:03 2014 -0800
> |
> |    can: Disable flexcan driver build for big endian CPU on ARM
> |    
> |    Building arm:allmodconfig fails with
> |    
> |    flexcan.c: In function 'flexcan_read':
> |    flexcan.c:243:2: error: implicit declaration of function 'in_be32'
> |    flexcan.c: In function 'flexcan_write':
> |    flexcan.c:248:2: error: implicit declaration of function 'out_be32'
> |    
> |    in_be32 and out_be32 do not (or no longer) exist for ARM targets.
> |    Disable the build for ARM on big endian CPUs.
> |    
> |    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> |    Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> |
> |diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
> |index 9e7d95d..d447b88 100644
> |--- a/drivers/net/can/Kconfig
> |+++ b/drivers/net/can/Kconfig
> |@@ -104,7 +104,7 @@ config CAN_JANZ_ICAN3
> | 
> | config CAN_FLEXCAN
> |        tristate "Support for Freescale FLEXCAN based chips"
> |-       depends on ARM || PPC
> |+       depends on (ARM && CPU_LITTLE_ENDIAN) || PPC
> |        ---help---
> |          Say Y here if you want to support for Freescale FlexCAN.
>>
> completely disables the flexcan driver for all ARM platforms, since the
> symbol CPU_LITTLE_ENDIAN does not exist on ARM!

Arnd Bergmann posted a better patch, which I'll include in a pull
request once the net tree is open again.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 242 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140120/b60177fc/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc
  2014-01-20 11:37   ` Marc Kleine-Budde
@ 2014-01-20 11:44     ` Marc Kleine-Budde
  -1 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2014-01-20 11:44 UTC (permalink / raw)
  To: linux-can
  Cc: linux-arm-kernel, Arnd Bergmann, Guenter Roeck,
	Lothar Waßmann, Marc Kleine-Budde

From: Arnd Bergmann <arnd@arndb.de>

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>
---
Changes since v1:
* squash the revert of the original patch with the wrong fix

 drivers/net/can/Kconfig   | 2 +-
 drivers/net/can/flexcan.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index d447b88..9e7d95d 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -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.
 
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index aaed97b..320bef2 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 = {
 };
 
 /*
- * 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);
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc
@ 2014-01-20 11:44     ` Marc Kleine-Budde
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2014-01-20 11:44 UTC (permalink / raw)
  To: linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

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>
---
Changes since v1:
* squash the revert of the original patch with the wrong fix

 drivers/net/can/Kconfig   | 2 +-
 drivers/net/can/flexcan.c | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index d447b88..9e7d95d 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -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.
 
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index aaed97b..320bef2 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 = {
 };
 
 /*
- * 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);
-- 
1.8.5.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-20 11:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-20 11:32 commit 40d4511 "can: Disable flexcan driver build for big endian CPU on ARM" breaks Flexcan on ARM Lothar Waßmann
2014-01-20 11:32 ` Lothar Waßmann
2014-01-20 11:37 ` Marc Kleine-Budde
2014-01-20 11:37   ` Marc Kleine-Budde
2014-01-20 11:44   ` [PATCH v2] can: flexcan: fix flexcan driver build for big endian on ARM and little endian on PowerPc Marc Kleine-Budde
2014-01-20 11:44     ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.