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 /drivers/qe/uec.c | |
parent | b064c9124acddbcdc70843f62fda13a2d7d7a392 (diff) | |
parent | cc2593128f7ad1b879e9e5bd3097f6c717cf4c9a (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'drivers/qe/uec.c')
-rw-r--r-- | drivers/qe/uec.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c index 40cccc2406..468c92ebce 100644 --- a/drivers/qe/uec.c +++ b/drivers/qe/uec.c @@ -623,20 +623,20 @@ static int uec_miiphy_find_dev_by_name(const char *devname) * Returns: * 0 on success */ -static int uec_miiphy_read(const char *devname, unsigned char addr, - unsigned char reg, unsigned short *value) +static int uec_miiphy_read(struct mii_dev *bus, int addr, int devad, int reg) { + unsigned short value = 0; int devindex = 0; - if (devname == NULL || value == NULL) { + if (bus->name == NULL) { debug("%s: NULL pointer given\n", __FUNCTION__); } else { - devindex = uec_miiphy_find_dev_by_name(devname); + devindex = uec_miiphy_find_dev_by_name(bus->name); if (devindex >= 0) { - *value = uec_read_phy_reg(devlist[devindex], addr, reg); + value = uec_read_phy_reg(devlist[devindex], addr, reg); } } - return 0; + return value; } /* @@ -645,15 +645,15 @@ static int uec_miiphy_read(const char *devname, unsigned char addr, * Returns: * 0 on success */ -static int uec_miiphy_write(const char *devname, unsigned char addr, - unsigned char reg, unsigned short value) +static int uec_miiphy_write(struct mii_dev *bus, int addr, int devad, int reg, + u16 value) { int devindex = 0; - if (devname == NULL) { + if (bus->name == NULL) { debug("%s: NULL pointer given\n", __FUNCTION__); } else { - devindex = uec_miiphy_find_dev_by_name(devname); + devindex = uec_miiphy_find_dev_by_name(bus->name); if (devindex >= 0) { uec_write_phy_reg(devlist[devindex], addr, reg, value); } @@ -1399,7 +1399,17 @@ int uec_initialize(bd_t *bis, uec_info_t *uec_info) } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) - miiphy_register(dev->name, uec_miiphy_read, uec_miiphy_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = uec_miiphy_read; + mdiodev->write = uec_miiphy_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif return 1; |