From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tuomas Tynkkynen Date: Fri, 17 Mar 2017 21:44:59 +0200 Subject: [U-Boot] [PATCH] fdt_support: Fixup 'ethernet' aliases not ending in digits Message-ID: <20170317194459.10109-1-tuomas@tuxera.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The Raspberry Pi device tree files since Linux v4.9 have a "ethernet" alias pointing to the on-board Ethernet device node. However, U-Boot's fdt_fixup_ethernet() (and the kernel's of_alias_scan()) only looks at ethernet aliases ending in digits. Make it also check the "ethernet" alias. Without this Linux isn't told of the MAC address provided by the RPI firmware and the ethernet device is always assigned a random MAC address. The device trees themselves can't be fixed as someone is already depending on the "ethernet" alias: https://github.com/raspberrypi/firmware/issues/613 Signed-off-by: Tuomas Tynkkynen --- common/fdt_support.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/fdt_support.c b/common/fdt_support.c index 55d4d6f6d4..6e509b38e5 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -496,7 +496,15 @@ void fdt_fixup_ethernet(void *fdt) path = fdt_getprop_by_offset(fdt, offset, &name, NULL); if (!strncmp(name, "ethernet", len)) { - i = trailing_strtol(name); + /* + * Some device trees (bcm2835) have an alias without + * the number at end. Support that as well. + */ + if (!strcmp(name, "ethernet")) + i = 0; + else + i = trailing_strtol(name); + if (i != -1) { if (i == 0) strcpy(mac, "ethaddr"); -- 2.11.1