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/net/ftmac110.c | |
parent | b064c9124acddbcdc70843f62fda13a2d7d7a392 (diff) | |
parent | cc2593128f7ad1b879e9e5bd3097f6c717cf4c9a (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'drivers/net/ftmac110.c')
-rw-r--r-- | drivers/net/ftmac110.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c index 4f17015bc5..8fa767a1fe 100644 --- a/drivers/net/ftmac110.c +++ b/drivers/net/ftmac110.c @@ -364,32 +364,35 @@ static int ftmac110_recv(struct eth_device *dev) #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) -static int ftmac110_mdio_read( - const char *devname, uint8_t addr, uint8_t reg, uint16_t *value) +static int ftmac110_mdio_read(struct mii_dev *bus, int addr, int devad, + int reg) { + uint16_t value = 0; int ret = 0; struct eth_device *dev; - dev = eth_get_dev_by_name(devname); + dev = eth_get_dev_by_name(bus->name); if (dev == NULL) { - printf("%s: no such device\n", devname); + printf("%s: no such device\n", bus->name); ret = -1; } else { - *value = mdio_read(dev, addr, reg); + value = mdio_read(dev, addr, reg); } - return ret; + if (ret < 0) + return ret; + return value; } -static int ftmac110_mdio_write( - const char *devname, uint8_t addr, uint8_t reg, uint16_t value) +static int ftmac110_mdio_write(struct mii_dev *bus, int addr, int devad, + int reg, u16 value) { int ret = 0; struct eth_device *dev; - dev = eth_get_dev_by_name(devname); + dev = eth_get_dev_by_name(bus->name); if (dev == NULL) { - printf("%s: no such device\n", devname); + printf("%s: no such device\n", bus->name); ret = -1; } else { mdio_write(dev, addr, reg, value); @@ -468,7 +471,17 @@ int ftmac110_initialize(bd_t *bis) eth_register(dev); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) - miiphy_register(dev->name, ftmac110_mdio_read, ftmac110_mdio_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = ftmac110_mdio_read; + mdiodev->write = ftmac110_mdio_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif card_nr++; |