Skip to contentSkip to conversation

make cadence ethernet drivers build on any architecture

PATCH Superseded Joachim Eastwood 3 participants 17 messages Oct 21, 2012 – Oct 22, 2012

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover make cadence ethernet drivers build on any architecture

This series makes the at91_ether and macb driver build-able on any architecture.

Patch 1 removes the HAVE_NET_MACB from the cadence Kconfig and this allow macb to be built on any architecture. The macb driver requires no other modifications.

Patch 3 moves a bootloader quirk for CSB337 from at91_ether into CSB337 board setup. This allow us to remove the last mach include and build this driver on any architecture. It also make it easier to share the address setup between at91_ether and macb.

Patch 4-5 removes the now unused HAVE_NET_MACB config symbol from AT91/AVR32 Kconfig.

Note that patch 3 is not tested on a real CSB337 board. I only tested it on an other AT91RM9200 board to verify the logic that reverses the address byte order works.

The next series will make the at91_ether driver use address setting and statistics from macb. There is also a clean up of print outs plus some comment/style fixes.

Joachim Eastwood (5):
net/cadence: get rid of HAVE_NET_MACB net/at91_ether: select MACB in Kconfig net/at91_ether: move eth addr quirk into csb337 board setup
ARM: AT91: Remove HAVE_NET_MACB
AVR32: Remove HAVE_NET_MACB

 arch/arm/mach-at91/Kconfig                |  4 ----
 arch/arm/mach-at91/board-csb337.c         | 35 +++++++++++++++++++++++++++++++
 arch/avr32/Kconfig                        |  1 -
 drivers/net/ethernet/cadence/Kconfig      |  8 +------
 drivers/net/ethernet/cadence/Makefile     |  2 +-
 drivers/net/ethernet/cadence/at91_ether.c | 26 ++++++-----------------
 6 files changed, 43 insertions(+), 33 deletions(-)
Signature · 1 line
1.7.12.4
#1 lore raw

PATCH 1/5 net/cadence: get rid of HAVE_NET_MACB

macb is a platform driver and there is nothing that prevents this driver from being built on non-ARM/AVR32 platforms.

---
 drivers/net/ethernet/cadence/Kconfig | 5 -----
 1 file changed, 5 deletions(-)
drivers/net/ethernet/cadence/Kconfig +0 -5
index 57f78abe..5d1ea30 100644
@@ -2,13 +2,9 @@
 # Atmel device configuration
 #
 
-config HAVE_NET_MACB
-	bool
-
 config NET_CADENCE
 	bool "Cadence devices"
 	default y
-	depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200)
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y.
 	  Make sure you know the name of your card. Read the Ethernet-HOWTO,
@@ -34,7 +30,6 @@ config ARM_AT91_ETHER
 
 config MACB
 	tristate "Cadence MACB/GEM support"
-	depends on HAVE_NET_MACB
 	select PHYLIB
 	---help---
 	  The Cadence MACB ethernet interface is found on many Atmel AT32 and
Signature · 1 line
1.7.12.4
#7 lore raw

PATCH 2/5 net/at91_ether: select MACB in Kconfig

In reply to Joachim Eastwood

Now that HAVE_NET_MACB is gone let's just select MACB to satisfy the dependecies in at91_ether.

PHYLIB will then by selected by MACB.

---
 drivers/net/ethernet/cadence/Kconfig  | 2 +-
 drivers/net/ethernet/cadence/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/Kconfig +1 -1
index 5d1ea30..f6d0956 100644
@@ -23,7 +23,7 @@ config ARM_AT91_ETHER
 	tristate "AT91RM9200 Ethernet support"
 	depends on ARM && ARCH_AT91RM9200
 	select NET_CORE
-	select PHYLIB
+	select MACB
 	---help---
 	  If you wish to compile a kernel for the AT91RM9200 and enable
 	  ethernet support, then you should always answer Y to this.
drivers/net/ethernet/cadence/Makefile +1 -1
index 798b1e0..9068b83 100644
@@ -2,5 +2,5 @@
 # Makefile for the Atmel network device drivers.
 #
 
-obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o macb.o
+obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o
 obj-$(CONFIG_MACB) += macb.o
Signature · 1 line
1.7.12.4
#10 lore raw

PATCH 3/5 net/at91_ether: move eth addr quirk into csb337 board setup

In reply to Joachim Eastwood

Move Ethernet address byte order fix for csb337 into it's board setup.

This will allow us to remove the last mach include from at91_ether and also to share the address setup with the macb driver.

---
 arch/arm/mach-at91/board-csb337.c         | 35 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/cadence/Kconfig      |  1 -
 drivers/net/ethernet/cadence/at91_ether.c | 26 ++++++-----------------
 3 files changed, 41 insertions(+), 21 deletions(-)
arch/arm/mach-at91/board-csb337.c +35 -0
index 3e37437..5522132 100644
@@ -217,6 +217,40 @@ static struct gpio_led csb_leds[] = {
 	}
 };
 
+/*
+ * MicroMonitor (uMon) on the CSB337 store the ethernet address in the
+ * wrong byte order (and continues to do so, for bug-compatibility).
+ */
+#define MACB_SA1B	0x0098
+#define MACB_SA1T	0x009c
+static void __init csb337_fix_eth_addr(void)
+{
+	void __iomem *emac;
+	u32 lo, hi, tmp;
+	int i;
+
+	emac = ioremap(AT91RM9200_BASE_EMAC, SZ_16K);
+	if (!emac) {
+		printk(KERN_ERR "csb337: unable to fixup Ethernet address\n");
+		return;
+	}
+
+	/* Fix byte order on all 4 address registers */
+	for (i = 0; i < 4; i++) {
+		lo = readl(emac + MACB_SA1B + i * 8);
+		hi = readl(emac + MACB_SA1T + i * 8);
+
+		tmp = (lo & 0xff) << 8 | (lo & 0xff00) >> 8;
+		writel(tmp, emac + MACB_SA1T + i * 8);
+
+		tmp = (hi & 0xff) << 8 | (hi & 0xff00) >> 8
+			| (lo & 0xff0000) << 8
+			| (lo & 0xff000000) >> 8;
+		writel(tmp, emac + MACB_SA1B + i * 8);
+	}
+
+	iounmap(emac);
+}
 
 static void __init csb337_board_init(void)
 {
@@ -225,6 +259,7 @@ static void __init csb337_board_init(void)
 	at91_register_uart(0, 0, 0);
 	at91_add_device_serial();
 	/* Ethernet */
+	csb337_fix_eth_addr();
 	at91_add_device_eth(&csb337_eth_data);
 	/* USB Host */
 	at91_add_device_usbh(&csb337_usbh_data);
drivers/net/ethernet/cadence/Kconfig +0 -1
index f6d0956..40172d1 100644
@@ -21,7 +21,6 @@ if NET_CADENCE
 
 config ARM_AT91_ETHER
 	tristate "AT91RM9200 Ethernet support"
-	depends on ARM && ARCH_AT91RM9200
 	select NET_CORE
 	select MACB
 	---help---
drivers/net/ethernet/cadence/at91_ether.c +6 -20
index 375d272..5ed1a63 100644
@@ -32,8 +32,6 @@
 #include <linux/phy.h>
 #include <linux/io.h>
 
-#include <asm/mach-types.h>
-
 #include "macb.h"
 
 #define DRV_NAME	"at91_ether"
@@ -55,30 +53,18 @@
  *   U-Boot on the AT91RM9200-DK do not do this.
  *
  * - Likewise it must store the addresses in the correct byte order.
- *   MicroMonitor (uMon) on the CSB337 does this incorrectly (and
- *   continues to do so, for bug-compatibility).
  */
 
 static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo)
 {
 	char addr[6];
 
-	if (machine_is_csb337()) {
-		addr[5] = (lo & 0xff);			/* The CSB337 bootloader stores the MAC the wrong-way around */
-		addr[4] = (lo & 0xff00) >> 8;
-		addr[3] = (lo & 0xff0000) >> 16;
-		addr[2] = (lo & 0xff000000) >> 24;
-		addr[1] = (hi & 0xff);
-		addr[0] = (hi & 0xff00) >> 8;
-	}
-	else {
-		addr[0] = (lo & 0xff);
-		addr[1] = (lo & 0xff00) >> 8;
-		addr[2] = (lo & 0xff0000) >> 16;
-		addr[3] = (lo & 0xff000000) >> 24;
-		addr[4] = (hi & 0xff);
-		addr[5] = (hi & 0xff00) >> 8;
-	}
+	addr[0] = (lo & 0xff);
+	addr[1] = (lo & 0xff00) >> 8;
+	addr[2] = (lo & 0xff0000) >> 16;
+	addr[3] = (lo & 0xff000000) >> 24;
+	addr[4] = (hi & 0xff);
+	addr[5] = (hi & 0xff00) >> 8;
 
 	if (is_valid_ether_addr(addr)) {
 		memcpy(dev->dev_addr, &addr, 6);
Signature · 1 line
1.7.12.4
#15 lore raw

PATCH 4/5 ARM: AT91: Remove HAVE_NET_MACB

In reply to Joachim Eastwood

HAVE_NET_MACB has already been removed from the driver itself so removed it from mach Kconfig as well.

---
 arch/arm/mach-at91/Kconfig | 4 ----
 1 file changed, 4 deletions(-)
arch/arm/mach-at91/Kconfig +0 -4
index d846b6e..72020fb 100644
@@ -45,7 +45,6 @@ config SOC_AT91RM9200
 config SOC_AT91SAM9260
 	bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20"
 	select HAVE_AT91_DBGU0
-	select HAVE_NET_MACB
 	select SOC_AT91SAM9
 	help
 	  Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE
@@ -63,7 +62,6 @@ config SOC_AT91SAM9263
 	bool "AT91SAM9263"
 	select HAVE_AT91_DBGU1
 	select HAVE_FB_ATMEL
-	select HAVE_NET_MACB
 	select SOC_AT91SAM9
 
 config SOC_AT91SAM9RL
@@ -76,7 +74,6 @@ config SOC_AT91SAM9G45
 	bool "AT91SAM9G45 or AT91SAM9M10 families"
 	select HAVE_AT91_DBGU1
 	select HAVE_FB_ATMEL
-	select HAVE_NET_MACB
 	select SOC_AT91SAM9
 	help
 	  Select this if you are using one of Atmel's AT91SAM9G45 family SoC.
@@ -86,7 +83,6 @@ config SOC_AT91SAM9X5
 	bool "AT91SAM9x5 family"
 	select HAVE_AT91_DBGU0
 	select HAVE_FB_ATMEL
-	select HAVE_NET_MACB
 	select SOC_AT91SAM9
 	help
 	  Select this if you are using one of Atmel's AT91SAM9x5 family SoC.
Signature · 1 line
1.7.12.4
#16 lore raw

PATCH 5/5 AVR32: Remove HAVE_NET_MACB

In reply to Joachim Eastwood

HAVE_NET_MACB has already been removed from the driver itself so removed it from arch Kconfig as well.

---
 arch/avr32/Kconfig | 1 -
 1 file changed, 1 deletion(-)
arch/avr32/Kconfig +0 -1
index 06e73bf..09f9fa8 100644
@@ -80,7 +80,6 @@ config PLATFORM_AT32AP
 	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_ALLOCATOR
 	select HAVE_FB_ATMEL
-	select HAVE_NET_MACB
 
 #
 # CPU types
Signature · 1 line
1.7.12.4
#11 lore raw

Re: [PATCH 3/5] net/at91_ether: move eth addr quirk into csb337 board setup

In reply to Joachim Eastwood
Quoted 5 lines · Joachim Eastwood

Move Ethernet address byte order fix for csb337 into it's board setup.

This will allow us to remove the last mach include from at91_ether and also to share the address setup with the macb driver.

no the at91rm9200 move to DT this is not compatible with it

you need to pass ths in info via platform_data

and do not touch driver code related stuff in boards

Best Regards,
J.

Quoted 126 lines
---
 arch/arm/mach-at91/board-csb337.c         | 35 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/cadence/Kconfig      |  1 -
 drivers/net/ethernet/cadence/at91_ether.c | 26 ++++++-----------------
 3 files changed, 41 insertions(+), 21 deletions(-)
arch/arm/mach-at91/board-csb337.c +35 -0
index 3e37437..5522132 100644
@@ -217,6 +217,40 @@ static struct gpio_led csb_leds[] = {
 	}
 };
 
+/*
+ * MicroMonitor (uMon) on the CSB337 store the ethernet address in the
+ * wrong byte order (and continues to do so, for bug-compatibility).
+ */
+#define MACB_SA1B	0x0098
+#define MACB_SA1T	0x009c
+static void __init csb337_fix_eth_addr(void)
+{
+	void __iomem *emac;
+	u32 lo, hi, tmp;
+	int i;
+
+	emac = ioremap(AT91RM9200_BASE_EMAC, SZ_16K);
+	if (!emac) {
+		printk(KERN_ERR "csb337: unable to fixup Ethernet address\n");
+		return;
+	}
+
+	/* Fix byte order on all 4 address registers */
+	for (i = 0; i < 4; i++) {
+		lo = readl(emac + MACB_SA1B + i * 8);
+		hi = readl(emac + MACB_SA1T + i * 8);
+
+		tmp = (lo & 0xff) << 8 | (lo & 0xff00) >> 8;
+		writel(tmp, emac + MACB_SA1T + i * 8);
+
+		tmp = (hi & 0xff) << 8 | (hi & 0xff00) >> 8
+			| (lo & 0xff0000) << 8
+			| (lo & 0xff000000) >> 8;
+		writel(tmp, emac + MACB_SA1B + i * 8);
+	}
+
+	iounmap(emac);
+}
 
 static void __init csb337_board_init(void)
 {
@@ -225,6 +259,7 @@ static void __init csb337_board_init(void)
 	at91_register_uart(0, 0, 0);
 	at91_add_device_serial();
 	/* Ethernet */
+	csb337_fix_eth_addr();
 	at91_add_device_eth(&csb337_eth_data);
 	/* USB Host */
 	at91_add_device_usbh(&csb337_usbh_data);
drivers/net/ethernet/cadence/Kconfig +0 -1
index f6d0956..40172d1 100644
@@ -21,7 +21,6 @@ if NET_CADENCE
 
 config ARM_AT91_ETHER
 	tristate "AT91RM9200 Ethernet support"
-	depends on ARM && ARCH_AT91RM9200
 	select NET_CORE
 	select MACB
 	---help---
drivers/net/ethernet/cadence/at91_ether.c +6 -20
index 375d272..5ed1a63 100644
@@ -32,8 +32,6 @@
 #include <linux/phy.h>
 #include <linux/io.h>
 
-#include <asm/mach-types.h>
-
 #include "macb.h"
 
 #define DRV_NAME	"at91_ether"
@@ -55,30 +53,18 @@
  *   U-Boot on the AT91RM9200-DK do not do this.
  *
  * - Likewise it must store the addresses in the correct byte order.
- *   MicroMonitor (uMon) on the CSB337 does this incorrectly (and
- *   continues to do so, for bug-compatibility).
  */
 
 static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo)
 {
 	char addr[6];
 
-	if (machine_is_csb337()) {
-		addr[5] = (lo & 0xff);			/* The CSB337 bootloader stores the MAC the wrong-way around */
-		addr[4] = (lo & 0xff00) >> 8;
-		addr[3] = (lo & 0xff0000) >> 16;
-		addr[2] = (lo & 0xff000000) >> 24;
-		addr[1] = (hi & 0xff);
-		addr[0] = (hi & 0xff00) >> 8;
-	}
-	else {
-		addr[0] = (lo & 0xff);
-		addr[1] = (lo & 0xff00) >> 8;
-		addr[2] = (lo & 0xff0000) >> 16;
-		addr[3] = (lo & 0xff000000) >> 24;
-		addr[4] = (hi & 0xff);
-		addr[5] = (hi & 0xff00) >> 8;
-	}
+	addr[0] = (lo & 0xff);
+	addr[1] = (lo & 0xff00) >> 8;
+	addr[2] = (lo & 0xff0000) >> 16;
+	addr[3] = (lo & 0xff000000) >> 24;
+	addr[4] = (hi & 0xff);
+	addr[5] = (hi & 0xff00) >> 8;
 
 	if (is_valid_ether_addr(addr)) {
 		memcpy(dev->dev_addr, &addr, 6);
Signature · 1 line
1.7.12.4
#2 lore raw

Re: [PATCH 1/5] net/cadence: get rid of HAVE_NET_MACB

In reply to Joachim Eastwood
Quoted 2 lines · Joachim Eastwood

macb is a platform driver and there is nothing that prevents this driver from being built on non-ARM/AVR32 platforms.

if you want to drop the HAVE_NET_MACB you need to drop it everywher in one patch

Best Regards,
J.

Quoted 35 lines
---
 drivers/net/ethernet/cadence/Kconfig | 5 -----
 1 file changed, 5 deletions(-)
drivers/net/ethernet/cadence/Kconfig +0 -5
index 57f78abe..5d1ea30 100644
@@ -2,13 +2,9 @@
 # Atmel device configuration
 #
 
-config HAVE_NET_MACB
-	bool
-
 config NET_CADENCE
 	bool "Cadence devices"
 	default y
-	depends on HAVE_NET_MACB || (ARM && ARCH_AT91RM9200)
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y.
 	  Make sure you know the name of your card. Read the Ethernet-HOWTO,
@@ -34,7 +30,6 @@ config ARM_AT91_ETHER
 
 config MACB
 	tristate "Cadence MACB/GEM support"
-	depends on HAVE_NET_MACB
 	select PHYLIB
 	---help---
 	  The Cadence MACB ethernet interface is found on many Atmel AT32 and
Signature · 1 line
1.7.12.4
#8 lore raw

Re: [PATCH 2/5] net/at91_ether: select MACB in Kconfig

In reply to Joachim Eastwood
Quoted 16 lines · Joachim Eastwood

Now that HAVE_NET_MACB is gone let's just select MACB to satisfy the dependecies in at91_ether.

PHYLIB will then by selected by MACB.

---
 drivers/net/ethernet/cadence/Kconfig  | 2 +-
 drivers/net/ethernet/cadence/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/Kconfig +0 -0
index 5d1ea30..f6d0956 100644

drivers/net/ethernet/cadence/Kconfig config ARM_AT91_ETHER · line 26

Quoted 5 lines
drivers/net/ethernet/cadence/Kconfig +1 -1
@@ -23,7 +23,7 @@ config ARM_AT91_ETHER
 	tristate "AT91RM9200 Ethernet support"
 	depends on ARM && ARCH_AT91RM9200
 	select NET_CORE
-	select PHYLIB
+	select MACB

no the ether and macb are two diferrent drivers for 2 IPs from cadence

the ehter does not need the macb

Best Regards,
J.

Quoted 17 lines
drivers/net/ethernet/cadence/Kconfig +0 -0
 	---help---
 	  If you wish to compile a kernel for the AT91RM9200 and enable
 	  ethernet support, then you should always answer Y to this.
drivers/net/ethernet/cadence/Makefile +1 -1
index 798b1e0..9068b83 100644
@@ -2,5 +2,5 @@
 # Makefile for the Atmel network device drivers.
 #
 
-obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o macb.o
+obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o
 obj-$(CONFIG_MACB) += macb.o
Signature · 1 line
1.7.12.4
#13 lore raw

Re: [PATCH 3/5] net/at91_ether: move eth addr quirk into csb337 board setup

In reply to Joachim Eastwood
Quoted 5 lines · Joachim Eastwood

Move Ethernet address byte order fix for csb337 into it's board setup.

This will allow us to remove the last mach include from at91_ether and also to share the address setup with the macb driver.

no the current drivers expect mach/board.h, mach/at91rm9200_emac.h, asm/gpio.h

waht you did will not even compile on non at91 platform

Did you even compile it on non at91?

Best Regards,
J.

Quoted 126 lines
---
 arch/arm/mach-at91/board-csb337.c         | 35 +++++++++++++++++++++++++++++++
 drivers/net/ethernet/cadence/Kconfig      |  1 -
 drivers/net/ethernet/cadence/at91_ether.c | 26 ++++++-----------------
 3 files changed, 41 insertions(+), 21 deletions(-)
arch/arm/mach-at91/board-csb337.c +35 -0
index 3e37437..5522132 100644
@@ -217,6 +217,40 @@ static struct gpio_led csb_leds[] = {
 	}
 };
 
+/*
+ * MicroMonitor (uMon) on the CSB337 store the ethernet address in the
+ * wrong byte order (and continues to do so, for bug-compatibility).
+ */
+#define MACB_SA1B	0x0098
+#define MACB_SA1T	0x009c
+static void __init csb337_fix_eth_addr(void)
+{
+	void __iomem *emac;
+	u32 lo, hi, tmp;
+	int i;
+
+	emac = ioremap(AT91RM9200_BASE_EMAC, SZ_16K);
+	if (!emac) {
+		printk(KERN_ERR "csb337: unable to fixup Ethernet address\n");
+		return;
+	}
+
+	/* Fix byte order on all 4 address registers */
+	for (i = 0; i < 4; i++) {
+		lo = readl(emac + MACB_SA1B + i * 8);
+		hi = readl(emac + MACB_SA1T + i * 8);
+
+		tmp = (lo & 0xff) << 8 | (lo & 0xff00) >> 8;
+		writel(tmp, emac + MACB_SA1T + i * 8);
+
+		tmp = (hi & 0xff) << 8 | (hi & 0xff00) >> 8
+			| (lo & 0xff0000) << 8
+			| (lo & 0xff000000) >> 8;
+		writel(tmp, emac + MACB_SA1B + i * 8);
+	}
+
+	iounmap(emac);
+}
 
 static void __init csb337_board_init(void)
 {
@@ -225,6 +259,7 @@ static void __init csb337_board_init(void)
 	at91_register_uart(0, 0, 0);
 	at91_add_device_serial();
 	/* Ethernet */
+	csb337_fix_eth_addr();
 	at91_add_device_eth(&csb337_eth_data);
 	/* USB Host */
 	at91_add_device_usbh(&csb337_usbh_data);
drivers/net/ethernet/cadence/Kconfig +0 -1
index f6d0956..40172d1 100644
@@ -21,7 +21,6 @@ if NET_CADENCE
 
 config ARM_AT91_ETHER
 	tristate "AT91RM9200 Ethernet support"
-	depends on ARM && ARCH_AT91RM9200
 	select NET_CORE
 	select MACB
 	---help---
drivers/net/ethernet/cadence/at91_ether.c +6 -20
index 375d272..5ed1a63 100644
@@ -32,8 +32,6 @@
 #include <linux/phy.h>
 #include <linux/io.h>
 
-#include <asm/mach-types.h>
-
 #include "macb.h"
 
 #define DRV_NAME	"at91_ether"
@@ -55,30 +53,18 @@
  *   U-Boot on the AT91RM9200-DK do not do this.
  *
  * - Likewise it must store the addresses in the correct byte order.
- *   MicroMonitor (uMon) on the CSB337 does this incorrectly (and
- *   continues to do so, for bug-compatibility).
  */
 
 static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo)
 {
 	char addr[6];
 
-	if (machine_is_csb337()) {
-		addr[5] = (lo & 0xff);			/* The CSB337 bootloader stores the MAC the wrong-way around */
-		addr[4] = (lo & 0xff00) >> 8;
-		addr[3] = (lo & 0xff0000) >> 16;
-		addr[2] = (lo & 0xff000000) >> 24;
-		addr[1] = (hi & 0xff);
-		addr[0] = (hi & 0xff00) >> 8;
-	}
-	else {
-		addr[0] = (lo & 0xff);
-		addr[1] = (lo & 0xff00) >> 8;
-		addr[2] = (lo & 0xff0000) >> 16;
-		addr[3] = (lo & 0xff000000) >> 24;
-		addr[4] = (hi & 0xff);
-		addr[5] = (hi & 0xff00) >> 8;
-	}
+	addr[0] = (lo & 0xff);
+	addr[1] = (lo & 0xff00) >> 8;
+	addr[2] = (lo & 0xff0000) >> 16;
+	addr[3] = (lo & 0xff000000) >> 24;
+	addr[4] = (hi & 0xff);
+	addr[5] = (hi & 0xff00) >> 8;
 
 	if (is_valid_ether_addr(addr)) {
 		memcpy(dev->dev_addr, &addr, 6);
Signature · 1 line
1.7.12.4
#3 lore raw

Re: [PATCH 1/5] net/cadence: get rid of HAVE_NET_MACB

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Joachim Eastwood

macb is a platform driver and there is nothing that prevents this driver from being built on non-ARM/AVR32 platforms.

if you want to drop the HAVE_NET_MACB you need to drop it everywher in one patch

Breaking it up in several patches doesn't seem to cause any build failures and I did this in case the patches were going into different git trees.

regards
Joachim Eastwood

#9 lore raw

Re: [PATCH 2/5] net/at91_ether: select MACB in Kconfig

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 24 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Joachim Eastwood

Now that HAVE_NET_MACB is gone let's just select MACB to satisfy the dependecies in at91_ether.

PHYLIB will then by selected by MACB.

---
 drivers/net/ethernet/cadence/Kconfig  | 2 +-
 drivers/net/ethernet/cadence/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cadence/Kconfig +0 -0
index 5d1ea30..f6d0956 100644

drivers/net/ethernet/cadence/Kconfig config ARM_AT91_ETHER · line 26

Quoted 5 lines
drivers/net/ethernet/cadence/Kconfig +1 -1
@@ -23,7 +23,7 @@ config ARM_AT91_ETHER
      tristate "AT91RM9200 Ethernet support"
      depends on ARM && ARCH_AT91RM9200
      select NET_CORE
-     select PHYLIB
+     select MACB

no the ether and macb are two diferrent drivers for 2 IPs from cadence

Quoted 1 line

the ehter does not need the macb

The at91_ether in net-next does.

regards
Joachim Eastwood

#14 lore raw

Re: [PATCH 3/5] net/at91_ether: move eth addr quirk into csb337 board setup

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Joachim Eastwood

Move Ethernet address byte order fix for csb337 into it's board setup.

This will allow us to remove the last mach include from at91_ether and also to share the address setup with the macb driver.

no the current drivers expect mach/board.h, mach/at91rm9200_emac.h, asm/gpio.h

waht you did will not even compile on non at91 platform

Did you even compile it on non at91?

This is the last mach include in the at91_ether driver in net-next. And, yes, after this patch it complies fine for at least x86_64.

regards
Joachim Eastwood

#12 lore raw

Re: [PATCH 3/5] net/at91_ether: move eth addr quirk into csb337 board setup

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Joachim Eastwood

Move Ethernet address byte order fix for csb337 into it's board setup.

This will allow us to remove the last mach include from at91_ether and also to share the address setup with the macb driver.

no the at91rm9200 move to DT this is not compatible with it

you need to pass ths in info via platform_data

and do not touch driver code related stuff in boards

I know the board code is a bit nasty.
If it's unacceptable I'll cook up a flag and pass it by platform_data, something like "reverse_eth_addr". Still it will only ever be used on the csb337 board.

regards
Joachim Eastwood

maintainer
#4 lore raw

Re: [PATCH 1/5] net/cadence: get rid of HAVE_NET_MACB

In reply to Joachim Eastwood

You do know that this is going to generate warnings on 64-bit platforms?

I was hoping you would have noticed and corrected this before enabling the driver everywhere, I guess my expectations were way too high :-/

#5 lore raw

Re: [PATCH 1/5] net/cadence: get rid of HAVE_NET_MACB

Quoted 7 lines · David Miller

You do know that this is going to generate warnings on 64-bit platforms?

I was hoping you would have noticed and corrected this before enabling the driver everywhere, I guess my expectations were way too high :-/

ah, sorry.

Yes, macb seem to generate some integer overflows on ~0UL on 64-bit. I have a patch that turns ~0UL into -1.

I can repost the series with fix included. Do you want me to do that?

regards
Joachim Eastwood

maintainer
#6 lore raw

Re: [PATCH 1/5] net/cadence: get rid of HAVE_NET_MACB

From: Joachim Eastwood <[email protected]>
Date: Mon, 22 Oct 2012 08:59:17 +0200

Quoted 9 lines · David Miller
Quoted 7 lines

You do know that this is going to generate warnings on 64-bit platforms?

I was hoping you would have noticed and corrected this before enabling the driver everywhere, I guess my expectations were way too high :-/

Quoted 6 lines

ah, sorry.

Yes, macb seem to generate some integer overflows on ~0UL on 64-bit. I have a patch that turns ~0UL into -1.

I can repost the series with fix included. Do you want me to do that?

Yes, please do.

Thanks.