* [PATCH v3 0/4] make cadence ethernet drivers build on any architecture
@ 2012-10-22 18:45 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: nicolas.ferre, davem, hskinnemoen, egtvedt, plagnioj, bgat
Cc: netdev, linux-arm-kernel, Joachim Eastwood
This series makes the at91_ether and macb driver build-able on any architecture.
Patch 1 fixes a integer truncated warning in macb, which will show up when compiling for 64-bit, before enabling macb driver for other architectures.
Patch 2 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 4 moves a bootloader quirk for CSB337 from at91_ether into platform data as a flag. 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.
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.
Patch log:
v3 - Include integer truncated warning fix for macb
v2 - Use macb platform data to support reversed ethernet address and squash HAVE_NET_MACB removal patches.
Joachim Eastwood (4):
net/macb: fix truncate warnings
net/cadence: get rid of HAVE_NET_MACB
net/at91_ether: select MACB in Kconfig
net/at91_ether: add pdata flag for reverse Eth addr
arch/arm/mach-at91/Kconfig | 4 ----
arch/arm/mach-at91/board-csb337.c | 2 ++
arch/avr32/Kconfig | 1 -
drivers/net/ethernet/cadence/Kconfig | 8 +-------
drivers/net/ethernet/cadence/Makefile | 2 +-
drivers/net/ethernet/cadence/at91_ether.c | 5 ++---
drivers/net/ethernet/cadence/macb.c | 8 ++++----
include/linux/platform_data/macb.h | 1 +
8 files changed, 11 insertions(+), 20 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 0/4] make cadence ethernet drivers build on any architecture
@ 2012-10-22 18:45 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: linux-arm-kernel
This series makes the at91_ether and macb driver build-able on any architecture.
Patch 1 fixes a integer truncated warning in macb, which will show up when compiling for 64-bit, before enabling macb driver for other architectures.
Patch 2 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 4 moves a bootloader quirk for CSB337 from at91_ether into platform data as a flag. 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.
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.
Patch log:
v3 - Include integer truncated warning fix for macb
v2 - Use macb platform data to support reversed ethernet address and squash HAVE_NET_MACB removal patches.
Joachim Eastwood (4):
net/macb: fix truncate warnings
net/cadence: get rid of HAVE_NET_MACB
net/at91_ether: select MACB in Kconfig
net/at91_ether: add pdata flag for reverse Eth addr
arch/arm/mach-at91/Kconfig | 4 ----
arch/arm/mach-at91/board-csb337.c | 2 ++
arch/avr32/Kconfig | 1 -
drivers/net/ethernet/cadence/Kconfig | 8 +-------
drivers/net/ethernet/cadence/Makefile | 2 +-
drivers/net/ethernet/cadence/at91_ether.c | 5 ++---
drivers/net/ethernet/cadence/macb.c | 8 ++++----
include/linux/platform_data/macb.h | 1 +
8 files changed, 11 insertions(+), 20 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/4] net/macb: fix truncate warnings
2012-10-22 18:45 ` Joachim Eastwood
@ 2012-10-22 18:45 ` Joachim Eastwood
-1 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: nicolas.ferre, davem, hskinnemoen, egtvedt, plagnioj, bgat
Cc: netdev, linux-arm-kernel, Joachim Eastwood
When building macb on x86_64 the following warnings show up:
drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
drivers/net/ethernet/cadence/macb.c: In function macb_reset_hw:
drivers/net/ethernet/cadence/macb.c:792:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
drivers/net/ethernet/cadence/macb.c:793:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
drivers/net/ethernet/cadence/macb.c:796:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Use -1 insted of ~0UL, as done in other places in the driver,
to silence these warnings.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/cadence/macb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 6c84a11..6a4f499 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -553,7 +553,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
while (status) {
/* close possible race with dev_close */
if (unlikely(!netif_running(dev))) {
- macb_writel(bp, IDR, ~0UL);
+ macb_writel(bp, IDR, -1);
break;
}
@@ -789,11 +789,11 @@ static void macb_reset_hw(struct macb *bp)
macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
/* Clear all status flags */
- macb_writel(bp, TSR, ~0UL);
- macb_writel(bp, RSR, ~0UL);
+ macb_writel(bp, TSR, -1);
+ macb_writel(bp, RSR, -1);
/* Disable all interrupts */
- macb_writel(bp, IDR, ~0UL);
+ macb_writel(bp, IDR, -1);
macb_readl(bp, ISR);
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 1/4] net/macb: fix truncate warnings
@ 2012-10-22 18:45 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: linux-arm-kernel
When building macb on x86_64 the following warnings show up:
drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
drivers/net/ethernet/cadence/macb.c: In function macb_reset_hw:
drivers/net/ethernet/cadence/macb.c:792:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
drivers/net/ethernet/cadence/macb.c:793:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
drivers/net/ethernet/cadence/macb.c:796:2: warning: large integer implicitly truncated to unsigned type [-Woverflow]
Use -1 insted of ~0UL, as done in other places in the driver,
to silence these warnings.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/cadence/macb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c
index 6c84a11..6a4f499 100644
--- a/drivers/net/ethernet/cadence/macb.c
+++ b/drivers/net/ethernet/cadence/macb.c
@@ -553,7 +553,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
while (status) {
/* close possible race with dev_close */
if (unlikely(!netif_running(dev))) {
- macb_writel(bp, IDR, ~0UL);
+ macb_writel(bp, IDR, -1);
break;
}
@@ -789,11 +789,11 @@ static void macb_reset_hw(struct macb *bp)
macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
/* Clear all status flags */
- macb_writel(bp, TSR, ~0UL);
- macb_writel(bp, RSR, ~0UL);
+ macb_writel(bp, TSR, -1);
+ macb_writel(bp, RSR, -1);
/* Disable all interrupts */
- macb_writel(bp, IDR, ~0UL);
+ macb_writel(bp, IDR, -1);
macb_readl(bp, ISR);
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 2/4] net/cadence: get rid of HAVE_NET_MACB
2012-10-22 18:45 ` Joachim Eastwood
@ 2012-10-22 18:45 ` Joachim Eastwood
-1 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: nicolas.ferre, davem, hskinnemoen, egtvedt, plagnioj, bgat
Cc: netdev, linux-arm-kernel, Joachim Eastwood
macb is a platform driver and there is nothing that prevents
this driver from being built on non-ARM/AVR32 platforms.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
arch/arm/mach-at91/Kconfig | 4 ----
arch/avr32/Kconfig | 1 -
drivers/net/ethernet/cadence/Kconfig | 5 -----
3 files changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index d846b6e..72020fb 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -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.
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 06e73bf..09f9fa8 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -80,7 +80,6 @@ config PLATFORM_AT32AP
select ARCH_REQUIRE_GPIOLIB
select GENERIC_ALLOCATOR
select HAVE_FB_ATMEL
- select HAVE_NET_MACB
#
# CPU types
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 57f78abe..5d1ea30 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -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
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 2/4] net/cadence: get rid of HAVE_NET_MACB
@ 2012-10-22 18:45 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: linux-arm-kernel
macb is a platform driver and there is nothing that prevents
this driver from being built on non-ARM/AVR32 platforms.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
arch/arm/mach-at91/Kconfig | 4 ----
arch/avr32/Kconfig | 1 -
drivers/net/ethernet/cadence/Kconfig | 5 -----
3 files changed, 10 deletions(-)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index d846b6e..72020fb 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -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.
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index 06e73bf..09f9fa8 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -80,7 +80,6 @@ config PLATFORM_AT32AP
select ARCH_REQUIRE_GPIOLIB
select GENERIC_ALLOCATOR
select HAVE_FB_ATMEL
- select HAVE_NET_MACB
#
# CPU types
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 57f78abe..5d1ea30 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -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
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 3/4] net/at91_ether: select MACB in Kconfig
2012-10-22 18:45 ` Joachim Eastwood
@ 2012-10-22 18:45 ` Joachim Eastwood
-1 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: nicolas.ferre, davem, hskinnemoen, egtvedt, plagnioj, bgat
Cc: netdev, linux-arm-kernel, Joachim Eastwood
Now that HAVE_NET_MACB is gone let's just select MACB to
satisfy the dependecies in at91_ether.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/cadence/Kconfig | 2 +-
drivers/net/ethernet/cadence/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 5d1ea30..f6d0956 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -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.
diff --git a/drivers/net/ethernet/cadence/Makefile b/drivers/net/ethernet/cadence/Makefile
index 798b1e0..9068b83 100644
--- a/drivers/net/ethernet/cadence/Makefile
+++ b/drivers/net/ethernet/cadence/Makefile
@@ -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
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 3/4] net/at91_ether: select MACB in Kconfig
@ 2012-10-22 18:45 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: linux-arm-kernel
Now that HAVE_NET_MACB is gone let's just select MACB to
satisfy the dependecies in at91_ether.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
drivers/net/ethernet/cadence/Kconfig | 2 +-
drivers/net/ethernet/cadence/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index 5d1ea30..f6d0956 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -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.
diff --git a/drivers/net/ethernet/cadence/Makefile b/drivers/net/ethernet/cadence/Makefile
index 798b1e0..9068b83 100644
--- a/drivers/net/ethernet/cadence/Makefile
+++ b/drivers/net/ethernet/cadence/Makefile
@@ -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
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 4/4] net/at91_ether: add pdata flag for reverse Eth addr
2012-10-22 18:45 ` Joachim Eastwood
@ 2012-10-22 18:45 ` Joachim Eastwood
-1 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: nicolas.ferre, davem, hskinnemoen, egtvedt, plagnioj, bgat
Cc: netdev, linux-arm-kernel, Joachim Eastwood
This will allow us to remove the last mach include from at91_ether
and also make it easier to share address setup with macb.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
arch/arm/mach-at91/board-csb337.c | 2 ++
drivers/net/ethernet/cadence/Kconfig | 1 -
drivers/net/ethernet/cadence/at91_ether.c | 5 ++---
include/linux/platform_data/macb.h | 1 +
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 3e37437..aa9b320 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -53,6 +53,8 @@ static void __init csb337_init_early(void)
static struct macb_platform_data __initdata csb337_eth_data = {
.phy_irq_pin = AT91_PIN_PC2,
.is_rmii = 0,
+ /* The CSB337 bootloader stores the MAC the wrong-way around */
+ .rev_eth_addr = 1,
};
static struct at91_usbh_data __initdata csb337_usbh_data = {
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index f6d0956..40172d1 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -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---
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 375d272..b92815a 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -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"
@@ -61,9 +59,10 @@
static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo)
{
+ struct macb *lp = netdev_priv(dev);
char addr[6];
- if (machine_is_csb337()) {
+ if (lp->board_data.rev_eth_addr) {
addr[5] = (lo & 0xff); /* The CSB337 bootloader stores the MAC the wrong-way around */
addr[4] = (lo & 0xff00) >> 8;
addr[3] = (lo & 0xff0000) >> 16;
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
index b081c72..044a124 100644
--- a/include/linux/platform_data/macb.h
+++ b/include/linux/platform_data/macb.h
@@ -12,6 +12,7 @@ struct macb_platform_data {
u32 phy_mask;
int phy_irq_pin; /* PHY IRQ */
u8 is_rmii; /* using RMII interface? */
+ u8 rev_eth_addr; /* reverse Ethernet address byte order */
};
#endif /* __MACB_PDATA_H__ */
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v3 4/4] net/at91_ether: add pdata flag for reverse Eth addr
@ 2012-10-22 18:45 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-22 18:45 UTC (permalink / raw)
To: linux-arm-kernel
This will allow us to remove the last mach include from at91_ether
and also make it easier to share address setup with macb.
Signed-off-by: Joachim Eastwood <manabian@gmail.com>
---
arch/arm/mach-at91/board-csb337.c | 2 ++
drivers/net/ethernet/cadence/Kconfig | 1 -
drivers/net/ethernet/cadence/at91_ether.c | 5 ++---
include/linux/platform_data/macb.h | 1 +
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 3e37437..aa9b320 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -53,6 +53,8 @@ static void __init csb337_init_early(void)
static struct macb_platform_data __initdata csb337_eth_data = {
.phy_irq_pin = AT91_PIN_PC2,
.is_rmii = 0,
+ /* The CSB337 bootloader stores the MAC the wrong-way around */
+ .rev_eth_addr = 1,
};
static struct at91_usbh_data __initdata csb337_usbh_data = {
diff --git a/drivers/net/ethernet/cadence/Kconfig b/drivers/net/ethernet/cadence/Kconfig
index f6d0956..40172d1 100644
--- a/drivers/net/ethernet/cadence/Kconfig
+++ b/drivers/net/ethernet/cadence/Kconfig
@@ -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---
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 375d272..b92815a 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -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"
@@ -61,9 +59,10 @@
static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo)
{
+ struct macb *lp = netdev_priv(dev);
char addr[6];
- if (machine_is_csb337()) {
+ if (lp->board_data.rev_eth_addr) {
addr[5] = (lo & 0xff); /* The CSB337 bootloader stores the MAC the wrong-way around */
addr[4] = (lo & 0xff00) >> 8;
addr[3] = (lo & 0xff0000) >> 16;
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
index b081c72..044a124 100644
--- a/include/linux/platform_data/macb.h
+++ b/include/linux/platform_data/macb.h
@@ -12,6 +12,7 @@ struct macb_platform_data {
u32 phy_mask;
int phy_irq_pin; /* PHY IRQ */
u8 is_rmii; /* using RMII interface? */
+ u8 rev_eth_addr; /* reverse Ethernet address byte order */
};
#endif /* __MACB_PDATA_H__ */
--
1.7.12.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v3 0/4] make cadence ethernet drivers build on any architecture
2012-10-22 18:45 ` Joachim Eastwood
@ 2012-10-23 6:40 ` David Miller
-1 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2012-10-23 6:40 UTC (permalink / raw)
To: manabian
Cc: nicolas.ferre, hskinnemoen, egtvedt, plagnioj, bgat, netdev,
linux-arm-kernel
From: Joachim Eastwood <manabian@gmail.com>
Date: Mon, 22 Oct 2012 20:45:30 +0200
> Joachim Eastwood (4):
> net/macb: fix truncate warnings
> net/cadence: get rid of HAVE_NET_MACB
> net/at91_ether: select MACB in Kconfig
> net/at91_ether: add pdata flag for reverse Eth addr
All applied to net-next, thanks a lot.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 0/4] make cadence ethernet drivers build on any architecture
@ 2012-10-23 6:40 ` David Miller
0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2012-10-23 6:40 UTC (permalink / raw)
To: linux-arm-kernel
From: Joachim Eastwood <manabian@gmail.com>
Date: Mon, 22 Oct 2012 20:45:30 +0200
> Joachim Eastwood (4):
> net/macb: fix truncate warnings
> net/cadence: get rid of HAVE_NET_MACB
> net/at91_ether: select MACB in Kconfig
> net/at91_ether: add pdata flag for reverse Eth addr
All applied to net-next, thanks a lot.
^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: [PATCH v3 1/4] net/macb: fix truncate warnings
2012-10-22 18:45 ` Joachim Eastwood
@ 2012-10-23 8:21 ` David Laight
-1 siblings, 0 replies; 20+ messages in thread
From: David Laight @ 2012-10-23 8:21 UTC (permalink / raw)
To: Joachim Eastwood, nicolas.ferre, davem, hskinnemoen, egtvedt,
plagnioj, bgat
Cc: netdev, linux-arm-kernel
> When building macb on x86_64 the following warnings show up:
> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
...
> - macb_writel(bp, IDR, ~0UL);
> + macb_writel(bp, IDR, -1);
Seems wrong to fix an error with an unsigned value
by using -1.
David
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/4] net/macb: fix truncate warnings
@ 2012-10-23 8:21 ` David Laight
0 siblings, 0 replies; 20+ messages in thread
From: David Laight @ 2012-10-23 8:21 UTC (permalink / raw)
To: linux-arm-kernel
> When building macb on x86_64 the following warnings show up:
> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
...
> - macb_writel(bp, IDR, ~0UL);
> + macb_writel(bp, IDR, -1);
Seems wrong to fix an error with an unsigned value
by using -1.
David
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 1/4] net/macb: fix truncate warnings
2012-10-23 8:21 ` David Laight
@ 2012-10-23 8:48 ` David Miller
-1 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2012-10-23 8:48 UTC (permalink / raw)
To: David.Laight
Cc: manabian, nicolas.ferre, hskinnemoen, egtvedt, plagnioj, bgat,
netdev, linux-arm-kernel
From: "David Laight" <David.Laight@ACULAB.COM>
Date: Tue, 23 Oct 2012 09:21:11 +0100
>> When building macb on x86_64 the following warnings show up:
>> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
>> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> ...
>> - macb_writel(bp, IDR, ~0UL);
>> + macb_writel(bp, IDR, -1);
>
> Seems wrong to fix an error with an unsigned value
> by using -1.
-1 is equally an unsigned value of all 1's and completely legitimate.
The correction being made here is one of size not signedness.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/4] net/macb: fix truncate warnings
@ 2012-10-23 8:48 ` David Miller
0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2012-10-23 8:48 UTC (permalink / raw)
To: linux-arm-kernel
From: "David Laight" <David.Laight@ACULAB.COM>
Date: Tue, 23 Oct 2012 09:21:11 +0100
>> When building macb on x86_64 the following warnings show up:
>> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
>> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> ...
>> - macb_writel(bp, IDR, ~0UL);
>> + macb_writel(bp, IDR, -1);
>
> Seems wrong to fix an error with an unsigned value
> by using -1.
-1 is equally an unsigned value of all 1's and completely legitimate.
The correction being made here is one of size not signedness.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 1/4] net/macb: fix truncate warnings
2012-10-23 8:48 ` David Miller
@ 2012-10-23 12:00 ` Lothar Waßmann
-1 siblings, 0 replies; 20+ messages in thread
From: Lothar Waßmann @ 2012-10-23 12:00 UTC (permalink / raw)
To: David Miller
Cc: bgat, netdev, manabian, nicolas.ferre, David.Laight, egtvedt,
plagnioj, linux-arm-kernel, hskinnemoen
Hi,
David Miller writes:
> From: "David Laight" <David.Laight@ACULAB.COM>
> Date: Tue, 23 Oct 2012 09:21:11 +0100
>
> >> When building macb on x86_64 the following warnings show up:
> >> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
> >> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> > ...
> >> - macb_writel(bp, IDR, ~0UL);
> >> + macb_writel(bp, IDR, -1);
> >
> > Seems wrong to fix an error with an unsigned value
> > by using -1.
>
> -1 is equally an unsigned value of all 1's and completely legitimate.
> The correction being made here is one of size not signedness.
>
You could use '~0' (without the 'UL').
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
_______________________________________________
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] 20+ messages in thread
* [PATCH v3 1/4] net/macb: fix truncate warnings
@ 2012-10-23 12:00 ` Lothar Waßmann
0 siblings, 0 replies; 20+ messages in thread
From: Lothar Waßmann @ 2012-10-23 12:00 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
David Miller writes:
> From: "David Laight" <David.Laight@ACULAB.COM>
> Date: Tue, 23 Oct 2012 09:21:11 +0100
>
> >> When building macb on x86_64 the following warnings show up:
> >> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
> >> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
> > ...
> >> - macb_writel(bp, IDR, ~0UL);
> >> + macb_writel(bp, IDR, -1);
> >
> > Seems wrong to fix an error with an unsigned value
> > by using -1.
>
> -1 is equally an unsigned value of all 1's and completely legitimate.
> The correction being made here is one of size not signedness.
>
You could use '~0' (without the 'UL').
Lothar Wa?mann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstra?e 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Gesch?ftsf?hrer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v3 1/4] net/macb: fix truncate warnings
2012-10-23 12:00 ` Lothar Waßmann
@ 2012-10-23 17:20 ` Joachim Eastwood
-1 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-23 17:20 UTC (permalink / raw)
To: Lothar Waßmann
Cc: David Miller, David.Laight, bgat, netdev, nicolas.ferre,
hskinnemoen, plagnioj, linux-arm-kernel, egtvedt
On Tue, Oct 23, 2012 at 2:00 PM, Lothar Waßmann <LW@karo-electronics.de> wrote:
> Hi,
>
> David Miller writes:
>> From: "David Laight" <David.Laight@ACULAB.COM>
>> Date: Tue, 23 Oct 2012 09:21:11 +0100
>>
>> >> When building macb on x86_64 the following warnings show up:
>> >> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
>> >> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>> > ...
>> >> - macb_writel(bp, IDR, ~0UL);
>> >> + macb_writel(bp, IDR, -1);
>> >
>> > Seems wrong to fix an error with an unsigned value
>> > by using -1.
>>
>> -1 is equally an unsigned value of all 1's and completely legitimate.
>> The correction being made here is one of size not signedness.
>>
> You could use '~0' (without the 'UL').
The reason for choosing '-1', as noted in patch description, is that
it already appears in a couple of other places in the driver. So I
though it would nice to be consistent.
regards
Joachim Eastwood
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v3 1/4] net/macb: fix truncate warnings
@ 2012-10-23 17:20 ` Joachim Eastwood
0 siblings, 0 replies; 20+ messages in thread
From: Joachim Eastwood @ 2012-10-23 17:20 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Oct 23, 2012 at 2:00 PM, Lothar Wa?mann <LW@karo-electronics.de> wrote:
> Hi,
>
> David Miller writes:
>> From: "David Laight" <David.Laight@ACULAB.COM>
>> Date: Tue, 23 Oct 2012 09:21:11 +0100
>>
>> >> When building macb on x86_64 the following warnings show up:
>> >> drivers/net/ethernet/cadence/macb.c: In function macb_interrupt:
>> >> drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
>> > ...
>> >> - macb_writel(bp, IDR, ~0UL);
>> >> + macb_writel(bp, IDR, -1);
>> >
>> > Seems wrong to fix an error with an unsigned value
>> > by using -1.
>>
>> -1 is equally an unsigned value of all 1's and completely legitimate.
>> The correction being made here is one of size not signedness.
>>
> You could use '~0' (without the 'UL').
The reason for choosing '-1', as noted in patch description, is that
it already appears in a couple of other places in the driver. So I
though it would nice to be consistent.
regards
Joachim Eastwood
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-10-23 17:20 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-22 18:45 [PATCH v3 0/4] make cadence ethernet drivers build on any architecture Joachim Eastwood
2012-10-22 18:45 ` Joachim Eastwood
2012-10-22 18:45 ` [PATCH v3 1/4] net/macb: fix truncate warnings Joachim Eastwood
2012-10-22 18:45 ` Joachim Eastwood
2012-10-23 8:21 ` David Laight
2012-10-23 8:21 ` David Laight
2012-10-23 8:48 ` David Miller
2012-10-23 8:48 ` David Miller
2012-10-23 12:00 ` Lothar Waßmann
2012-10-23 12:00 ` Lothar Waßmann
2012-10-23 17:20 ` Joachim Eastwood
2012-10-23 17:20 ` Joachim Eastwood
2012-10-22 18:45 ` [PATCH v3 2/4] net/cadence: get rid of HAVE_NET_MACB Joachim Eastwood
2012-10-22 18:45 ` Joachim Eastwood
2012-10-22 18:45 ` [PATCH v3 3/4] net/at91_ether: select MACB in Kconfig Joachim Eastwood
2012-10-22 18:45 ` Joachim Eastwood
2012-10-22 18:45 ` [PATCH v3 4/4] net/at91_ether: add pdata flag for reverse Eth addr Joachim Eastwood
2012-10-22 18:45 ` Joachim Eastwood
2012-10-23 6:40 ` [PATCH v3 0/4] make cadence ethernet drivers build on any architecture David Miller
2012-10-23 6:40 ` David Miller
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.