From 141ab7a52cf6678a992c504c641dd35896592a75 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 10 May 2010 16:10:00 -0400 Subject: AX88180: improve phy searching Rather than hardcode specific phy addresses, search the possible phy address space to find the first available phy. Also respect the normal CONFIG_PHY_ADDR option for board porters to pick a specific address. Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- drivers/net/ax88180.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/net/ax88180.h') diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h index d2113df..77bab5f 100644 --- a/drivers/net/ax88180.h +++ b/drivers/net/ax88180.h @@ -63,10 +63,8 @@ struct ax88180_private { /* Max Rx Jumbo size is 15K Bytes */ #define MAX_RX_SIZE 0x3C00 -#define MARVELL_88E1111_PHYADDR 0x18 #define MARVELL_88E1111_PHYIDR0 0x0141 -#define CICADA_CIS8201_PHYADDR 0x01 #define CICADA_CIS8201_PHYIDR0 0x000F #define MEDIA_AUTO 0 -- cgit v1.1 From f9abdfe0f27cccd67b4d7dd3e998e2a7a61119d7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 10 May 2010 16:47:36 -0400 Subject: AX88180: switch to common mii.h header No compiled code change here, just drop the local PHY defines in favor of the common standard ones. Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- drivers/net/ax88180.h | 48 ++---------------------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) (limited to 'drivers/net/ax88180.h') diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h index 77bab5f..c793e92 100644 --- a/drivers/net/ax88180.h +++ b/drivers/net/ax88180.h @@ -63,9 +63,9 @@ struct ax88180_private { /* Max Rx Jumbo size is 15K Bytes */ #define MAX_RX_SIZE 0x3C00 -#define MARVELL_88E1111_PHYIDR0 0x0141 +#define MARVELL_88E1111_PHYSID0 0x0141 -#define CICADA_CIS8201_PHYIDR0 0x000F +#define CICADA_CIS8201_PHYSID0 0x000F #define MEDIA_AUTO 0 #define MEDIA_1000FULL 1 @@ -276,50 +276,6 @@ struct ax88180_private { #define SOFTRST_NORMAL 0x00000003 #define SOFTRST_RESET_MAC 0x00000002 -/* External PHY Register Definition */ -#define BMCR 0x0000 - #define LINE_SPEED_MSB 0x0040 - #define DUPLEX_MODE 0x0100 - #define RESTART_AUTONEG 0x0200 - #define POWER_DOWN 0x0800 - #define AUTONEG_EN 0x1000 - #define LINE_SPEED_LSB 0x2000 - #define PHY_RESET 0x8000 - - #define MEDIAMODE_MASK (LINE_SPEED_MSB | LINE_SPEED_LSB |\ - DUPLEX_MODE) - #define BMCR_SPEED_1000 LINE_SPEED_MSB - #define BMCR_SPEED_100 LINE_SPEED_LSB - #define BMCR_SPEED_10 0x0000 - - #define BMCR_1000FULL (BMCR_SPEED_1000 | DUPLEX_MODE) - #define BMCR_100FULL (BMCR_SPEED_100 | DUPLEX_MODE) - #define BMCR_100HALF BMCR_SPEED_100 - #define BMCR_10FULL DUPLEX_MODE - #define BMCR_10HALF 0x0000 -#define BMSR 0x0001 - #define LINKOK 0x0004 - #define AUTONEG_ENABLE_STS 0x0008 - #define AUTONEG_COMPLETE 0x0020 -#define PHYIDR0 0x0002 -#define PHYIDR1 0x0003 -#define ANAR 0x0004 - #define ANAR_PAUSE 0x0400 - #define ANAR_100FULL 0x0100 - #define ANAR_100HALF 0x0080 - #define ANAR_10FULL 0x0040 - #define ANAR_10HALF 0x0020 - #define ANAR_8023BIT 0x0001 -#define ANLPAR 0x0005 -#define ANER 0x0006 -#define AUX_1000_CTRL 0x0009 - #define ENABLE_1000HALF 0x0100 - #define ENABLE_1000FULL 0x0200 - #define DEFAULT_AUX_1000_CTRL (ENABLE_1000HALF | ENABLE_1000FULL) -#define AUX_1000_STATUS 0x000A - #define LP_1000HALF 0x0400 - #define LP_1000FULL 0x0800 - /* Marvell 88E1111 Gigabit PHY Register Definition */ #define M88_SSR 0x0011 #define SSR_SPEED_MASK 0xC000 -- cgit v1.1 From 256670680b058105bb948c9f55e11db7ed949fa9 Mon Sep 17 00:00:00 2001 From: Hoan Hoang Date: Tue, 11 May 2010 02:42:38 -0400 Subject: AX88180: add support for the Marvell 88E1118 phy Some places in the current code equate the Marvell 88E1111 PHY as the family when in reality it's a subpart of the Alaska family. So once we generalize that, add support for the 88E1118 PHY. Signed-off-by: Hoan Hoang Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- drivers/net/ax88180.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'drivers/net/ax88180.h') diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h index c793e92..f26a91b 100644 --- a/drivers/net/ax88180.h +++ b/drivers/net/ax88180.h @@ -33,6 +33,7 @@ struct ax88180_private { unsigned char PadSize; unsigned short PhyAddr; unsigned short PhyID0; + unsigned short PhyID1; unsigned short FirstTxDesc; unsigned short NextTxDesc; ax88180_link_state LinkState; @@ -63,7 +64,8 @@ struct ax88180_private { /* Max Rx Jumbo size is 15K Bytes */ #define MAX_RX_SIZE 0x3C00 -#define MARVELL_88E1111_PHYSID0 0x0141 +#define MARVELL_ALASKA_PHYSID0 0x141 +#define MARVELL_88E1118_PHYSID1 0xE40 #define CICADA_CIS8201_PHYSID0 0x000F @@ -296,14 +298,36 @@ struct ax88180_private { #define LINK_CHANGE_INT 0x0400 #define M88_ISR 0x0013 #define LINK_CHANGE_STATUS 0x0400 -#define M88_EXT_SCR 0x0014 +#define M88E1111_EXT_SCR 0x0014 #define RGMII_RXCLK_DELAY 0x0080 #define RGMII_TXCLK_DELAY 0x0002 #define DEFAULT_EXT_SCR (RGMII_TXCLK_DELAY | RGMII_RXCLK_DELAY) -#define M88_EXT_SSR 0x001B +#define M88E1111_EXT_SSR 0x001B #define HWCFG_MODE_MASK 0x000F #define RGMII_COPPER_MODE 0x000B +/* Marvell 88E1118 Gigabit PHY Register Definition */ +#define M88E1118_CR 0x14 + #define M88E1118_CR_RGMII_RXCLK_DELAY 0x0020 + #define M88E1118_CR_RGMII_TXCLK_DELAY 0x0010 + #define M88E1118_CR_DEFAULT (M88E1118_CR_RGMII_TXCLK_DELAY | \ + M88E1118_CR_RGMII_RXCLK_DELAY) +#define M88E1118_LEDCTL 0x10 /* Reg 16 on page 3 */ + #define M88E1118_LEDCTL_LED2INT 0x200 + #define M88E1118_LEDCTL_LED2BLNK 0x400 + #define M88E1118_LEDCTL_LED0DUALMODE1 0xc + #define M88E1118_LEDCTL_LED0DUALMODE2 0xd + #define M88E1118_LEDCTL_LED0DUALMODE3 0xe + #define M88E1118_LEDCTL_LED0DUALMODE4 0xf + #define M88E1118_LEDCTL_DEFAULT (M88E1118_LEDCTL_LED2BLNK | \ + M88E1118_LEDCTL_LED0DUALMODE4) + +#define M88E1118_LEDMIX 0x11 /* Reg 17 on page 3 */ + #define M88E1118_LEDMIX_LED050 0x4 + #define M88E1118_LEDMIX_LED150 0x8 + +#define M88E1118_PAGE_SEL 0x16 /* Reg page select */ + /* CICADA CIS8201 Gigabit PHY Register Definition */ #define CIS_IMR 0x0019 #define CIS_INT_ENABLE 0x8000 -- cgit v1.1 From 14f637f8f7e4d4d43ac717075aacd0681b3ff270 Mon Sep 17 00:00:00 2001 From: Hoan Hoang Date: Tue, 11 May 2010 02:43:07 -0400 Subject: AX88180: make OUTW handle 32bit/16bit defines too The current OUTW function is always defined as a 16bit function, but this doesn't work correctly when using the 32bit access mode. So define it as a 32bit function when in 32bit mode so things work correctly on Blackfin 32bit LE systems. Signed-off-by: Hoan Hoang Signed-off-by: Mike Frysinger Signed-off-by: Ben Warren --- drivers/net/ax88180.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers/net/ax88180.h') diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h index f26a91b..9a324bd 100644 --- a/drivers/net/ax88180.h +++ b/drivers/net/ax88180.h @@ -357,15 +357,15 @@ static inline unsigned short INW (struct eth_device *dev, unsigned long addr) return le16_to_cpu (*(volatile unsigned short *) (addr + dev->iobase)); } +/* + Access RXBUFFER_START/TXBUFFER_START to read RX buffer/write TX buffer +*/ +#if defined (CONFIG_DRIVER_AX88180_16BIT) static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr) { *(volatile unsigned short *) ((addr + dev->iobase)) = cpu_to_le16 (command); } -/* - Access RXBUFFER_START/TXBUFFER_START to read RX buffer/write TX buffer -*/ -#if defined (CONFIG_DRIVER_AX88180_16BIT) static inline unsigned short READ_RXBUF (struct eth_device *dev) { return le16_to_cpu (*(volatile unsigned short *) (RXBUFFER_START + dev->iobase)); @@ -376,6 +376,11 @@ static inline void WRITE_TXBUF (struct eth_device *dev, unsigned short data) *(volatile unsigned short *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le16 (data); } #else +static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr) +{ + *(volatile unsigned long *) ((addr + dev->iobase)) = cpu_to_le32 (command); +} + static inline unsigned long READ_RXBUF (struct eth_device *dev) { return le32_to_cpu (*(volatile unsigned long *) (RXBUFFER_START + dev->iobase)); -- cgit v1.1 From cafb14fecb2085299b1b06beb93d27d46efdfe52 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 2 Jun 2010 21:03:50 -0400 Subject: AX88180: use standard I/O accessors The current dm9000x driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on Blackfin systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros. Signed-off-by: Mike Frysinger Tested-by: Hoan Hoang Signed-off-by: Ben Warren --- drivers/net/ax88180.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'drivers/net/ax88180.h') diff --git a/drivers/net/ax88180.h b/drivers/net/ax88180.h index 9a324bd..daf18e0 100644 --- a/drivers/net/ax88180.h +++ b/drivers/net/ax88180.h @@ -19,6 +19,7 @@ #ifndef _AX88180_H_ #define _AX88180_H_ +#include #include #include @@ -354,7 +355,7 @@ struct ax88180_private { static inline unsigned short INW (struct eth_device *dev, unsigned long addr) { - return le16_to_cpu (*(volatile unsigned short *) (addr + dev->iobase)); + return le16_to_cpu(readw(addr + (void *)dev->iobase)); } /* @@ -363,32 +364,32 @@ static inline unsigned short INW (struct eth_device *dev, unsigned long addr) #if defined (CONFIG_DRIVER_AX88180_16BIT) static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr) { - *(volatile unsigned short *) ((addr + dev->iobase)) = cpu_to_le16 (command); + writew(cpu_to_le16(command), addr + (void *)dev->iobase); } static inline unsigned short READ_RXBUF (struct eth_device *dev) { - return le16_to_cpu (*(volatile unsigned short *) (RXBUFFER_START + dev->iobase)); + return le16_to_cpu(readw(RXBUFFER_START + (void *)dev->iobase)); } static inline void WRITE_TXBUF (struct eth_device *dev, unsigned short data) { - *(volatile unsigned short *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le16 (data); + writew(cpu_to_le16(data), TXBUFFER_START + (void *)dev->iobase); } #else static inline void OUTW (struct eth_device *dev, unsigned short command, unsigned long addr) { - *(volatile unsigned long *) ((addr + dev->iobase)) = cpu_to_le32 (command); + writel(cpu_to_le32(command), addr + (void *)dev->iobase); } static inline unsigned long READ_RXBUF (struct eth_device *dev) { - return le32_to_cpu (*(volatile unsigned long *) (RXBUFFER_START + dev->iobase)); + return le32_to_cpu(readl(RXBUFFER_START + (void *)dev->iobase)); } static inline void WRITE_TXBUF (struct eth_device *dev, unsigned long data) { - *(volatile unsigned long *) ((TXBUFFER_START + dev->iobase)) = cpu_to_le32 (data); + writel(cpu_to_le32(data), TXBUFFER_START + (void *)dev->iobase); } #endif -- cgit v1.1