net: phy: marvell: Fix problem with phy_reset() clearing BMCR
[oweals/u-boot.git] / drivers / net / lpc32xx_eth.c
index e76e9bc2b5bdee62116ac3246e5d04520115293c..6cc273c33c81f046b1ce4f555d590213eddaa77a 100644 (file)
@@ -304,6 +304,13 @@ static int mii_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
                return -EFAULT;
        }
 
+       /* write the phy and reg addressse into the MII address reg */
+       writel((phy_adr << MADR_PHY_OFFSET) | (reg_ofs << MADR_REG_OFFSET),
+              &regs->madr);
+
+       /* write data to the MII write register */
+       writel(data, &regs->mwtd);
+
        /* wait till the MII is not busy */
        timeout = MII_TIMEOUT;
        do {
@@ -319,13 +326,6 @@ static int mii_reg_write(const char *devname, u8 phy_adr, u8 reg_ofs, u16 data)
                return -EFAULT;
        }
 
-       /* write the phy and reg addressse into the MII address reg */
-       writel((phy_adr << MADR_PHY_OFFSET) | (reg_ofs << MADR_REG_OFFSET),
-              &regs->madr);
-
-       /* write data to the MII write register */
-       writel(data, &regs->mwtd);
-
        /*debug("%s:(adr %d, off %d) <= %04x\n", __func__, phy_adr,
                reg_ofs, data);*/
 
@@ -582,7 +582,7 @@ int lpc32xx_eth_phylib_init(struct eth_device *dev, int phyid)
        }
        bus->read = lpc32xx_eth_phy_read;
        bus->write = lpc32xx_eth_phy_write;
-       sprintf(bus->name, dev->name);
+       strcpy(bus->name, dev->name);
 
        ret = mdio_register(bus);
        if (ret) {