diff mbox

net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall back

Message ID CAMPhdO_URCqTRUHxpbhy4L6Hp0NRRJx+GGs++3SFO7FxoJRiyA@mail.gmail.com
State New
Headers show

Commit Message

Eric Miao Aug. 17, 2011, 12:40 p.m. UTC
Guys,

The patch below fixed the recent ethernet not working issue due to absence
of MAC address. It's Acked-by the original guilty commit author, please
consider merging into next release of u-boot.

The real problem, however, is that kernel ethernet driver has an incorrect
assumption on a correct configuration of registers of the MAC address by the
boot loader, which isn't always true.

So the next fix would be the kernel driver to be independent of the boot
loader. Still figuring the correct way for this though.


---------- Forwarded message ----------
From: Eric Miao <eric.miao@linaro.org>
Date: Wed, Aug 17, 2011 at 1:33 PM
Subject: [PATCH] net/eth.c: fix eth_write_hwaddr() to use
dev->enetaddr as fall back
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>, Eric Miao <eric.miao@linaro.org>


Ignore the return value of eth_getenv_enetaddr_by_index(), and if it
fails, fall back to use dev->enetaddr, which could be filled up by
the ethernet device driver.

Actually, this is the original behavior, and was later changed by
commit 48506a2cde2458fa1f8c5993afc98e5a4617e1d3.

Signed-off-by: Eric Miao <eric.miao@linaro.org>
---
 net/eth.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

               if (memcmp(dev->enetaddr, "\0\0\0\0\0\0", 6) &&
--
1.7.4.1
diff mbox

Patch

diff --git a/net/eth.c b/net/eth.c
index a34fe59..c4fbe11 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -195,8 +195,7 @@  int eth_write_hwaddr(struct eth_device *dev, const
char *base_name,
       unsigned char env_enetaddr[6];
       int ret = 0;

-       if (!eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr))
-               return -1;
+       eth_getenv_enetaddr_by_index(base_name, eth_number, env_enetaddr);

       if (memcmp(env_enetaddr, "\0\0\0\0\0\0", 6)) {