[U-Boot] [PATCH] rpi: set ethaddr as well

Let's set "ethaddr" when we get the ethernet address too, so that fdt_fixup_ethernet() sets the address in the device tree and the Linux driver can pick it up.
Signed-off-by: Lubomir Rintel lkundrak@v3.sk --- The related Linux kernel change submitted here: http://lists.infradead.org/pipermail/linux-rpi-kernel/2016-February/003207.h...
board/raspberrypi/rpi/rpi.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index b344362..d7ad79d 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -254,6 +254,9 @@ static void set_usbethaddr(void)
eth_setenv_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
+ if (!getenv("ethaddr")) + setenv("ethaddr", getenv("usbethaddr")); + return; }

On 02/03/2016 08:08 AM, Lubomir Rintel wrote:
Let's set "ethaddr" when we get the ethernet address too, so that fdt_fixup_ethernet() sets the address in the device tree and the Linux driver can pick it up.
You need to Cc the maintainer who will apply this (Tom Rini).
This seems OK, but ...
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index b344362..d7ad79d 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -254,6 +254,9 @@ static void set_usbethaddr(void)
eth_setenv_enetaddr("usbethaddr", msg->get_mac_address.body.resp.mac);
- if (!getenv("ethaddr"))
setenv("ethaddr", getenv("usbethaddr"));
Rather than setting duplicate environment variables, wouldn't it be better to modify the code that copies ethaddr into the DT so that it used the correct environment variable for the platform? Perhaps that's not worth it though.
Why use setenv() directly rather than just calling eth_setenv_enetaddr() in both places? In the current code, I wonder what happens if eth_setenv_enetaddr() fails, so presumably getenv() returns NULL or whatever random value usbethaddr had since it wasn't over-written?
Tested-by: Stephen Warren swarren@wwwdotorg.org

On Wed, Feb 03, 2016 at 04:08:09PM +0100, Lubomir Rintel wrote:
Let's set "ethaddr" when we get the ethernet address too, so that fdt_fixup_ethernet() sets the address in the device tree and the Linux driver can pick it up.
Signed-off-by: Lubomir Rintel lkundrak@v3.sk Tested-by: Stephen Warren swarren@wwwdotorg.org
Applied to u-boot/master, thanks!
participants (3)
-
Lubomir Rintel
-
Stephen Warren
-
Tom Rini