mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 06:00:43 +00:00
fdt_support: Fixup 'ethernet' aliases not ending in digits
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() only looks at ethernet aliases ending in digits. As the spec doesn't mandate that aliases must end in numbers and there have been much older uses of an "ethernet" aliases in the wild (according to Tom Rini), change the code to accept "ethernet" as well. Without this Linux isn't told of the MAC address provided by the RPI firmware and the ethernet interface is always assigned a random MAC address. Signed-off-by: Tuomas Tynkkynen <tuomas@tuxera.com> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
27a0f038a7
commit
f8e57c650d
1 changed files with 7 additions and 3 deletions
|
@ -482,7 +482,6 @@ void fdt_fixup_ethernet(void *fdt)
|
||||||
/* Cycle through all aliases */
|
/* Cycle through all aliases */
|
||||||
for (prop = 0; ; prop++) {
|
for (prop = 0; ; prop++) {
|
||||||
const char *name;
|
const char *name;
|
||||||
int len = strlen("ethernet");
|
|
||||||
|
|
||||||
/* FDT might have been edited, recompute the offset */
|
/* FDT might have been edited, recompute the offset */
|
||||||
offset = fdt_first_property_offset(fdt,
|
offset = fdt_first_property_offset(fdt,
|
||||||
|
@ -495,8 +494,13 @@ void fdt_fixup_ethernet(void *fdt)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
|
path = fdt_getprop_by_offset(fdt, offset, &name, NULL);
|
||||||
if (!strncmp(name, "ethernet", len)) {
|
if (!strncmp(name, "ethernet", 8)) {
|
||||||
i = trailing_strtol(name);
|
/* Treat plain "ethernet" same as "ethernet0". */
|
||||||
|
if (!strcmp(name, "ethernet"))
|
||||||
|
i = 0;
|
||||||
|
else
|
||||||
|
i = trailing_strtol(name);
|
||||||
|
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
strcpy(mac, "ethaddr");
|
strcpy(mac, "ethaddr");
|
||||||
|
|
Loading…
Reference in a new issue