[U-Boot] [PATCH] net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall back

Eric Miao eric.miao at linaro.org
Mon Jan 16 08:03:42 CET 2012


On Sat, Jan 14, 2012 at 3:19 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Eric Miao,
>
> In message <1313559224-4627-1-git-send-email-eric.miao at linaro.org> you wrote:
>> 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.
>
> I'm not going to pull that patch.
>
> Please explain which actual problem you're trying to fix.

Hi Wolfgang,

The problem was with the current code, if there is no eth<n>addr
in the environment variables, eth_write_hwaddr() will fail immediately,
and it's going to use the default reset MAC address in the FEC controller
which is likely all 0.

To make it worse, the current kernel driver actually depends on
the MAC address registers being programmed correctly.

If traced back to the last commit to this file, which added this
eth_getenv_enetaddr_by_index(), that commit actually modified
the original behavior of this eth_write_hwaddr() function.


More information about the U-Boot mailing list