Patchwork [U-Boot,V2,1/8] net/designware: Fix to restore hw mac address

login
register
mail settings
Submitter Amit Virdi
Date March 26, 2012, 10:09 a.m.
Message ID <1332756599-19304-2-git-send-email-amit.virdi@st.com>
Download mbox | patch
Permalink /patch/148685/
State Accepted
Commit c7f6dbe736f3f57436ba162f986691f7e862eb4d
Delegated to: Joe Hershberger
Headers show

Comments

Amit Virdi - March 26, 2012, 10:09 a.m.
From: Vipin KUMAR <vipin.kumar@st.com>

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 |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
Joe Hershberger - April 4, 2012, 5:31 p.m.
On Mon, Mar 26, 2012 at 5:09 AM, Amit Virdi <amit.virdi@st.com> wrote:
> From: Vipin KUMAR <vipin.kumar@st.com>
>
> 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>

Applied.

Thanks,
-Joe

Patch

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 1e34436..ea8a406 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -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--);