[PATCH v2] rpi: Copy eth MAC address from fw DT to loaded DT

Peter Robinson pbrobinson at gmail.com
Wed Mar 20 13:24:00 CET 2024


Hi Martin,

> I reworked the commit message because I noticed the upstream Linux kernel has a
> difference with the Raspberry Pi fork of the kernel regarding the algorithm
> used to determine the MAC address of the smsc95xx.

So looking at this on an original 3B because that's what I had booted
for other testing.

> There is no smsc95xx.macaddr in the upstream kernel, and using the upstream
> kernel is actually the real use case for the patch.

In most cases in device tree this is dealt with aliases [1] to
ethernet0, 1 etc. In the U-Boot env I have two env set, ethaddr and
usbethaddr both to the same MAC address with b8:27:eb prefix which is
assigned to RPi foundation [2]. When I boot Linux I get that MAC
address on the interface as expected.

> I'm now wondering whether some users are using the module parameter
> smsc95xx.macaddr of the Raspberry Pi fork of the kernel to try to change the
> MAC, and put one which is not the factory default?

I would have thought that the recent RPi kernels would also fall back
to the upstream variation too if their fork option wasn't available.

> Does this use case exists? If this is the case, the current algorithm in the
> forked kernel would mean that, the FDT-provided MAC would have priority over
> anything set in the module parameter.
> This is already the case anyway when people give to the forked kernel the
> firmware-provided FDT (smsc95xx.macaddr is ignored). So this patch aligns
> behaviors.
> But we should be aware that applying this patch would change the behavior in
> the following situation (all conditions need to be true):
> - Forked kernel is used
> - Fresh FDT (not firmware one) is provided to the kernel
> - Custom (not factory) MAC was set in smsc95xx.macaddr parameter

Can we take a step back, I'm still unsure what you're trying to
resolve here. For me with the upstream U-Boot and the upstream kernel
I get the vendor MAC address as I would expect. It should work on any
kernel/DT combo as long as the ether ethernet alias is present in the
DT.

Peter

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi#n3
[2] https://maclookup.app/search/result?mac=b8:27:eb:


More information about the U-Boot mailing list