All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] fdt_support: Fixup 'ethernet' aliases not ending in digits
@ 2017-03-17 19:44 Tuomas Tynkkynen
  2017-03-18  1:26 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Tuomas Tynkkynen @ 2017-03-17 19:44 UTC (permalink / raw)
  To: u-boot

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 <tuomas@tuxera.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-18 23:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17 19:44 [U-Boot] [PATCH] fdt_support: Fixup 'ethernet' aliases not ending in digits Tuomas Tynkkynen
2017-03-18  1:26 ` Tom Rini
2017-03-18 18:20   ` Tuomas Tynkkynen
2017-03-18 18:34     ` Tom Rini
2017-03-18 23:17       ` Tuomas Tynkkynen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.