diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2016-08-08 16:28:38 (GMT) |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2016-08-15 20:26:33 (GMT) |
commit | 5a49f17481bb9dcab1431c663d35cc1cace16825 (patch) | |
tree | 239447b5c4c6da4f9ca2c298f33ed73c39a9020d /drivers/net/mpc5xxx_fec.c | |
parent | 63d985985e383111e082c78398444941a0b9fadf (diff) | |
download | u-boot-fsl-qoriq-5a49f17481bb9dcab1431c663d35cc1cace16825.tar.xz |
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/mpc5xxx_fec.c')
-rw-r--r-- | drivers/net/mpc5xxx_fec.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c index e13b4cf..d75e858 100644 --- a/drivers/net/mpc5xxx_fec.c +++ b/drivers/net/mpc5xxx_fec.c @@ -35,8 +35,10 @@ typedef struct { uint8 head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */ } NBUF; -int fec5xxx_miiphy_read(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 *retVal); -int fec5xxx_miiphy_write(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 data); +int fec5xxx_miiphy_read(struct mii_dev *bus, int phyAddr, int devad, + int regAddr); +int fec5xxx_miiphy_write(struct mii_dev *bus, int phyAddr, int devad, + int regAddr, u16 data); static int mpc5xxx_fec_init_phy(struct eth_device *dev, bd_t * bis); @@ -917,8 +919,17 @@ int mpc5xxx_fec_initialize(bd_t * bis) eth_register(dev); #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) - miiphy_register (dev->name, - fec5xxx_miiphy_read, fec5xxx_miiphy_write); + int retval; + struct mii_dev *mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + strncpy(mdiodev->name, dev->name, MDIO_NAME_LEN); + mdiodev->read = fec5xxx_miiphy_read; + mdiodev->write = fec5xxx_miiphy_write; + + retval = mdio_register(mdiodev); + if (retval < 0) + return retval; #endif /* @@ -941,8 +952,10 @@ int mpc5xxx_fec_initialize(bd_t * bis) /* MII-interface related functions */ /********************************************************************/ -int fec5xxx_miiphy_read(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 * retVal) +int fec5xxx_miiphy_read(struct mii_dev *bus, int phyAddr, int devad, + int regAddr) { + uint16 retVal = 0; ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; uint32 reg; /* convenient holder for the PHY register */ uint32 phy; /* convenient holder for the PHY */ @@ -977,13 +990,14 @@ int fec5xxx_miiphy_read(const char *devname, uint8 phyAddr, uint8 regAddr, uint1 /* * it's now safe to read the PHY's register */ - *retVal = (uint16) eth->mii_data; + retVal = (uint16) eth->mii_data; - return 0; + return retVal; } /********************************************************************/ -int fec5xxx_miiphy_write(const char *devname, uint8 phyAddr, uint8 regAddr, uint16 data) +int fec5xxx_miiphy_write(struct mii_dev *bus, int phyAddr, int devad, + int regAddr, u16 data) { ethernet_regs *eth = (ethernet_regs *)MPC5XXX_FEC; uint32 reg; /* convenient holder for the PHY register */ |