summaryrefslogtreecommitdiff
path: root/drivers/net/armada100_fec.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-08-15 16:38:39 -0400
committerTom Rini <trini@konsulko.com>2016-08-15 16:38:39 -0400
commit2ef98d33166e5c22a61eba29c20e236b72f1e8a2 (patch)
tree288afa85ba7134787f5c7146b0d87aaeb07d9b78 /drivers/net/armada100_fec.c
parentb064c9124acddbcdc70843f62fda13a2d7d7a392 (diff)
parentcc2593128f7ad1b879e9e5bd3097f6c717cf4c9a (diff)
downloadu-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 'drivers/net/armada100_fec.c')
-rw-r--r--drivers/net/armada100_fec.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c
index e6a6252..ba2cb1a 100644
--- a/drivers/net/armada100_fec.c
+++ b/drivers/net/armada100_fec.c
@@ -57,18 +57,19 @@ static int armdfec_phy_timeout(u32 *reg, u32 flag, int cond)
return !timeout;
}
-static int smi_reg_read(const char *devname, u8 phy_addr, u8 phy_reg,
- u16 *value)
+static int smi_reg_read(struct mii_dev *bus, int phy_addr, int devad,
+ int phy_reg)
{
- struct eth_device *dev = eth_get_dev_by_name(devname);
+ u16 value = 0;
+ struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct armdfec_device *darmdfec = to_darmdfec(dev);
struct armdfec_reg *regs = darmdfec->regs;
u32 val;
if (phy_addr == PHY_ADR_REQ && phy_reg == PHY_ADR_REQ) {
val = readl(&regs->phyadr);
- *value = val & 0x1f;
- return 0;
+ value = val & 0x1f;
+ return value;
}
/* check parameters */
@@ -99,15 +100,15 @@ static int smi_reg_read(const char *devname, u8 phy_addr, u8 phy_reg,
return -1;
}
val = readl(&regs->smi);
- *value = val & 0xffff;
+ value = val & 0xffff;
- return 0;
+ return value;
}
-static int smi_reg_write(const char *devname,
- u8 phy_addr, u8 phy_reg, u16 value)
+static int smi_reg_write(struct mii_dev *bus, int phy_addr, int devad,
+ int phy_reg, u16 value)
{
- struct eth_device *dev = eth_get_dev_by_name(devname);
+ struct eth_device *dev = eth_get_dev_by_name(bus->name);
struct armdfec_device *darmdfec = to_darmdfec(dev);
struct armdfec_reg *regs = darmdfec->regs;
@@ -711,7 +712,17 @@ int armada100_fec_register(unsigned long base_addr)
eth_register(dev);
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
- miiphy_register(dev->name, smi_reg_read, smi_reg_write);
+ int retval;
+ struct mii_dev *mdiodev = mdio_alloc();
+ if (!mdiodev)
+ return -ENOMEM;
+ strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN);
+ mdiodev->read = smi_reg_read;
+ mdiodev->write = smi_reg_write;
+
+ retval = mdio_register(mdiodev);
+ if (retval < 0)
+ return retval;
#endif
return 0;