make cadence ethernet drivers build on any architecture
Subsystems (6)
v3 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 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(-)
Signature · 1 line
1.7.12.4
PATCH v3 1/4 net/macb: fix truncate warnings
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.
--- drivers/net/ethernet/cadence/macb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/cadence/macb.c +4 -4
@@ -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 ); }
Signature · 1 line
1.7.12.4
RE: [PATCH v3 1/4] net/macb: fix truncate warnings
Quoted 3 lines
When building macb on
x86_64the following warnings show up:
drivers/net/ethernet/cadence/macb.c: In functionmacb_interrupt:
drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
...
Review
Quoted 2 lines
(quoted diff) +1
-1- macb_writel(bp, IDR, ~0UL); + macb_writel(bp, IDR, -1);
Seems wrong to fix an error with an unsigned value by using -1.
David
David Miller
maintainerRe: [PATCH v3 1/4] net/macb: fix truncate warnings
From: "David Laight" <[email protected]>
Date: Tue, 23 Oct 2012 09:21:11 +0100
Quoted 9 lines
Quoted 3 lines
When building macb on
x86_64the following warnings show up:
drivers/net/ethernet/cadence/macb.c: In functionmacb_interrupt:
drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]...
Review
Quoted 2 lines
(quoted diff) +1
-1- 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.
Re: [PATCH v3 1/4] net/macb: fix truncate warnings
Hi,
Quoted 7 lines · David Miller
From: "David Laight" <[email protected]>
Date: Tue, 23 Oct 2012 09:21:11 +0100Quoted 4 lines
Quoted 3 lines
When building macb on
x86_64the following warnings show up:
drivers/net/ethernet/cadence/macb.c: In functionmacb_interrupt:
drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]...
Quoted 9 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- 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
Signature · 9 lines
___________________________________________________________ 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 ___________________________________________________________
Re: [PATCH v3 1/4] net/macb: fix truncate warnings
Quoted 13 lines · Lothar Wa?mann
Hi,
Quoted 10 lines · David Miller
From: "David Laight" <[email protected]>
Date: Tue, 23 Oct 2012 09:21:11 +0100Quoted 7 lines
Quoted 3 lines
When building macb on
x86_64the following warnings show up:
drivers/net/ethernet/cadence/macb.c: In functionmacb_interrupt:
drivers/net/ethernet/cadence/macb.c:556:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]...
Quoted 2 lines
(quoted diff) +1
-1- macb_writel(bp, IDR, ~0UL); + macb_writel(bp, IDR, -1);
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
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
PATCH v3 2/4 net/cadence: get rid of HAVE_NET_MACB
In reply to Joachim Eastwoodmacb is a platform driver and there is nothing that prevents this driver from being built on non-ARM/AVR32 platforms.
--- arch/arm/mach-at91/Kconfig | 4 ---- arch/avr32/Kconfig | 1 - drivers/net/ethernet/cadence/Kconfig | 5 ----- 3 files changed, 10 deletions(-)
arch/arm/mach-at91/Kconfig +0 -4
@@ -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.
arch/avr32/Kconfig +0 -1
@@ -80,7 +80,6 @@ config PLATFORM_AT32AP select ARCH_REQUIRE_GPIOLIB select GENERIC_ALLOCATOR select HAVE_FB_ATMEL - select HAVE_NET_MACB # # CPU types
drivers/net/ethernet/cadence/Kconfig +0 -5
@@ -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
PATCH v3 3/4 net/at91_ether: select MACB in Kconfig
In reply to Joachim EastwoodNow that HAVE_NET_MACB is gone let's just select MACB to satisfy the dependecies in at91_ether.
--- 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
@@ -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
@@ -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
PATCH v3 4/4 net/at91_ether: add pdata flag for reverse Eth addr
In reply to Joachim EastwoodThis will allow us to remove the last mach include from at91_ether and also make it easier to share address setup with macb.
--- 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(-)
arch/arm/mach-at91/board-csb337.c +2 -0
@@ -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 = {
drivers/net/ethernet/cadence/Kconfig +0 -1
@@ -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 +2 -3
@@ -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 ;
include/linux/platform_data/macb.h +1 -0
@@ -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__ */
Signature · 1 line
1.7.12.4
David Miller
maintainerFrom: Joachim Eastwood <[email protected]>
Date: Mon, 22 Oct 2012 20:45:30 +0200
Quoted 5 lines
Joachim Eastwood (4):
net/macb: fix truncate warnings net/cadence: get rid ofHAVE_NET_MACBnet/at91_ether: select MACB inKconfignet/at91_ether: add pdata flag for reverse Eth addr
All applied to net-next, thanks a lot.