diff options
author | Tom Rini <trini@konsulko.com> | 2016-08-15 16:38:39 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-08-15 16:38:39 -0400 |
commit | 2ef98d33166e5c22a61eba29c20e236b72f1e8a2 (patch) | |
tree | 288afa85ba7134787f5c7146b0d87aaeb07d9b78 /arch | |
parent | b064c9124acddbcdc70843f62fda13a2d7d7a392 (diff) | |
parent | cc2593128f7ad1b879e9e5bd3097f6c717cf4c9a (diff) | |
download | u-boot-imx-2ef98d33166e5c22a61eba29c20e236b72f1e8a2.zip u-boot-imx-2ef98d33166e5c22a61eba29c20e236b72f1e8a2.tar.gz u-boot-imx-2ef98d33166e5c22a61eba29c20e236b72f1e8a2.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'arch')
-rw-r--r-- | arch/m68k/include/asm/fec.h | 9 | ||||
-rw-r--r-- | arch/mips/mach-au1x00/au1x00_eth.c | 25 | ||||
-rw-r--r-- | arch/powerpc/cpu/mpc8260/ether_fcc.c | 13 | ||||
-rw-r--r-- | arch/powerpc/cpu/mpc85xx/ether_fcc.c | 13 | ||||
-rw-r--r-- | arch/powerpc/cpu/mpc8xx/fec.c | 40 | ||||
-rw-r--r-- | arch/powerpc/cpu/ppc4xx/miiphy.c | 11 |
6 files changed, 73 insertions, 38 deletions
diff --git a/arch/m68k/include/asm/fec.h b/arch/m68k/include/asm/fec.h index 6856aac..2799293 100644 --- a/arch/m68k/include/asm/fec.h +++ b/arch/m68k/include/asm/fec.h @@ -15,6 +15,8 @@ #ifndef fec_h #define fec_h +#include <phy.h> + /* Buffer descriptors used FEC. */ typedef struct cpm_buf_desc { @@ -341,10 +343,9 @@ int fecpin_setclear(struct eth_device *dev, int setclear); void __mii_init(void); uint mii_send(uint mii_cmd); int mii_discover_phy(struct eth_device *dev); -int mcffec_miiphy_read(const char *devname, unsigned char addr, - unsigned char reg, unsigned short *value); -int mcffec_miiphy_write(const char *devname, unsigned char addr, - unsigned char reg, unsigned short value); +int mcffec_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg); +int mcffec_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, + u16 value); #endif #endif /* fec_h */ diff --git a/arch/mips/mach-au1x00/au1x00_eth.c b/arch/mips/mach-au1x00/au1x00_eth.c index 9216860..67f4953 100644 --- a/arch/mips/mach-au1x00/au1x00_eth.c +++ b/arch/mips/mach-au1x00/au1x00_eth.c @@ -73,9 +73,9 @@ mac_fifo_t mac_fifo[NO_OF_FIFOS]; #define MAX_WAIT 1000 #if defined(CONFIG_CMD_MII) -int au1x00_miiphy_read(const char *devname, unsigned char addr, - unsigned char reg, unsigned short * value) +int au1x00_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) { + unsigned short value = 0; volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA); u32 mii_control; @@ -102,12 +102,12 @@ int au1x00_miiphy_read(const char *devname, unsigned char addr, return -1; } } - *value = *mii_data_reg; - return 0; + value = *mii_data_reg; + return value; } -int au1x00_miiphy_write(const char *devname, unsigned char addr, - unsigned char reg, unsigned short value) +int au1x00_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, + u16 value) { volatile u32 *mii_control_reg = (volatile u32*)(ETH0_BASE+MAC_MII_CNTRL); volatile u32 *mii_data_reg = (volatile u32*)(ETH0_BASE+MAC_MII_DATA); @@ -290,8 +290,17 @@ int au1x00_enet_initialize(bd_t *bis){ eth_register(dev); #if defined(CONFIG_CMD_MII) - miiphy_register(dev->name, - au1x00_miiphy_read, au1x00_miiphy_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = au1x00_miiphy_read; + mdiodev->write = au1x00_miiphy_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif return 1; diff --git a/arch/powerpc/cpu/mpc8260/ether_fcc.c b/arch/powerpc/cpu/mpc8260/ether_fcc.c index a11ad1e..072eb76 100644 --- a/arch/powerpc/cpu/mpc8260/ether_fcc.c +++ b/arch/powerpc/cpu/mpc8260/ether_fcc.c @@ -379,8 +379,17 @@ int fec_initialize(bd_t *bis) #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) \ && defined(CONFIG_BITBANGMII) - miiphy_register(dev->name, - bb_miiphy_read, bb_miiphy_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = bb_miiphy_read; + mdiodev->write = bb_miiphy_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif } diff --git a/arch/powerpc/cpu/mpc85xx/ether_fcc.c b/arch/powerpc/cpu/mpc85xx/ether_fcc.c index 51f1bee..7708f05 100644 --- a/arch/powerpc/cpu/mpc85xx/ether_fcc.c +++ b/arch/powerpc/cpu/mpc85xx/ether_fcc.c @@ -441,8 +441,17 @@ int fec_initialize(bd_t *bis) #if (defined(CONFIG_MII) || defined(CONFIG_CMD_MII)) \ && defined(CONFIG_BITBANGMII) - miiphy_register(dev->name, - bb_miiphy_read, bb_miiphy_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = bb_miiphy_read; + mdiodev->write = bb_miiphy_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif } diff --git a/arch/powerpc/cpu/mpc8xx/fec.c b/arch/powerpc/cpu/mpc8xx/fec.c index f1ae358..0940906 100644 --- a/arch/powerpc/cpu/mpc8xx/fec.c +++ b/arch/powerpc/cpu/mpc8xx/fec.c @@ -6,10 +6,12 @@ */ #include <common.h> -#include <malloc.h> +#include <command.h> #include <commproc.h> +#include <malloc.h> #include <net.h> -#include <command.h> + +#include <phy.h> DECLARE_GLOBAL_DATA_PTR; @@ -47,10 +49,9 @@ DECLARE_GLOBAL_DATA_PTR; static int mii_discover_phy(struct eth_device *dev); #endif -int fec8xx_miiphy_read(const char *devname, unsigned char addr, - unsigned char reg, unsigned short *value); -int fec8xx_miiphy_write(const char *devname, unsigned char addr, - unsigned char reg, unsigned short value); +int fec8xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg); +int fec8xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, + u16 value); static struct ether_fcc_info_s { @@ -170,8 +171,17 @@ int fec_initialize(bd_t *bis) eth_register(dev); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) - miiphy_register(dev->name, - fec8xx_miiphy_read, fec8xx_miiphy_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = fec8xx_miiphy_read; + mdiodev->write = fec8xx_miiphy_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif } return 1; @@ -894,9 +904,9 @@ void mii_init (void) * Otherwise they hang in mii_send() !!! Sorry! *****************************************************************************/ -int fec8xx_miiphy_read(const char *devname, unsigned char addr, - unsigned char reg, unsigned short *value) +int fec8xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) { + unsigned short value = 0; short rdreg; /* register working value */ #ifdef MII_DEBUG @@ -904,15 +914,15 @@ int fec8xx_miiphy_read(const char *devname, unsigned char addr, #endif rdreg = mii_send(mk_mii_read(addr, reg)); - *value = rdreg; + value = rdreg; #ifdef MII_DEBUG - printf ("0x%04x\n", *value); + printf ("0x%04x\n", value); #endif - return 0; + return value; } -int fec8xx_miiphy_write(const char *devname, unsigned char addr, - unsigned char reg, unsigned short value) +int fec8xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, + u16 value) { #ifdef MII_DEBUG printf ("miiphy_write(0x%x) @ 0x%x = ", reg, addr); diff --git a/arch/powerpc/cpu/ppc4xx/miiphy.c b/arch/powerpc/cpu/ppc4xx/miiphy.c index 10147de..f0fc098 100644 --- a/arch/powerpc/cpu/ppc4xx/miiphy.c +++ b/arch/powerpc/cpu/ppc4xx/miiphy.c @@ -318,8 +318,7 @@ static int emac_miiphy_command(u8 addr, u8 reg, int cmd, u16 value) return 0; } -int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char reg, - unsigned short *value) +int emac4xx_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) { unsigned long sta_reg; unsigned long emac_reg; @@ -330,17 +329,15 @@ int emac4xx_miiphy_read (const char *devname, unsigned char addr, unsigned char return -1; sta_reg = in_be32((void *)EMAC0_STACR + emac_reg); - *value = sta_reg >> 16; - - return 0; + return sta_reg >> 16; } /***********************************************************/ /* write a phy reg and return the value with a rc */ /***********************************************************/ -int emac4xx_miiphy_write (const char *devname, unsigned char addr, unsigned char reg, - unsigned short value) +int emac4xx_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, + u16 value) { return emac_miiphy_command(addr, reg, EMAC_STACR_WRITE, value); } |