diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2016-08-08 11:28:38 -0500 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2016-08-15 15:26:33 -0500 |
commit | 5a49f17481bb9dcab1431c663d35cc1cace16825 (patch) | |
tree | 239447b5c4c6da4f9ca2c298f33ed73c39a9020d /drivers/net/armada100_fec.c | |
parent | 63d985985e383111e082c78398444941a0b9fadf (diff) | |
download | u-boot-5a49f17481bb9dcab1431c663d35cc1cace16825.zip u-boot-5a49f17481bb9dcab1431c663d35cc1cace16825.tar.gz u-boot-5a49f17481bb9dcab1431c663d35cc1cace16825.tar.bz2 |
net: mii: Use spatch to update miiphy_register
Run scripts/coccinelle/net/mdio_register.cocci on the U-Boot code base.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/net/armada100_fec.c')
-rw-r--r-- | drivers/net/armada100_fec.c | 33 |
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(®s->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(®s->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; |