net/designware: Fix to restore hw mac address
authorVipin KUMAR <vipin.kumar@st.com>
Mon, 26 Mar 2012 00:09:52 +0000 (00:09 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 4 Apr 2012 15:46:39 +0000 (10:46 -0500)
The network controller mac resets hardware address stored in MAC_HI and MAC_LO
registers if mac is resetted. So, hw mac address needs to be restored in case
mac is explicitly resetted from driver.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Amit Virdi <amit.virdi@st.com>
drivers/net/designware.c

index 1e34436772d3018403c7615331b600dc3595e660..ea8a40612e7aeaeaa791418912ecac3c537ae595 100644 (file)
@@ -148,6 +148,9 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
        if (mac_reset(dev) < 0)
                return -1;
 
+       /* Resore the HW MAC address as it has been lost during MAC reset */
+       dw_write_hwaddr(dev);
+
        writel(FIXEDBURST | PRIORXTX_41 | BURST_16,
                        &dma_p->busmode);
 
@@ -300,8 +303,10 @@ static int eth_mdio_write(struct eth_device *dev, u8 addr, u8 reg, u16 val)
        writel(miiaddr | MII_CLKRANGE_150_250M | MII_BUSY, &mac_p->miiaddr);
 
        do {
-               if (!(readl(&mac_p->miiaddr) & MII_BUSY))
+               if (!(readl(&mac_p->miiaddr) & MII_BUSY)) {
                        ret = 0;
+                       break;
+               }
                udelay(1000);
        } while (timeout--);