netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux mvneta driver unable to read MAC address from HW
@ 2020-10-10 16:41 Ezra Buehler
  2020-10-13  6:35 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Ezra Buehler @ 2020-10-10 16:41 UTC (permalink / raw)
  To: netdev; +Cc: thomas.petazzoni, Stefan Roese, linux-arm-kernel, u-boot

Hello,

sorry for bothering you, but I am kinda stuck here.

I am running Debian buster (Linux 4.19.146) on a Synology DS214+ NAS
(Marvell ARMADA XP). Unfortunately, I end up with random MAC addresses
for the two Ethernet interfaces after boot. (Also with Debian sid, Linux
5.4.0.)

Since commit 8cc3e439ab92 ("net: mvneta: read MAC address from hardware
when available") the mvneta Linux driver reads the MVNETA_MAC_ADDR_*
registers when no MAC address is provided by the DT. In my case, only
zeros are read, causing the driver to fall back to a random address. I
was able to verify that the registers are correctly written by the
bootloader by reading out the registers in the U-Boot prompt.

As a workaround, I now specify the MAC addresses in the DT. However, I
would prefer not to do that. Also, it would be nice to get to the bottom
of this.

Could it be, that for some reason, the clock of the MAC is removed
either by U-Boot or Linux during boot?

Any hints that could help me investigate this further would be highly
appreciated.

Cheers,
Ezra.


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

* Re: Linux mvneta driver unable to read MAC address from HW
  2020-10-10 16:41 Linux mvneta driver unable to read MAC address from HW Ezra Buehler
@ 2020-10-13  6:35 ` Thomas Petazzoni
  2020-10-13  8:20   ` Ezra Buehler
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2020-10-13  6:35 UTC (permalink / raw)
  To: Ezra Buehler; +Cc: netdev, Stefan Roese, linux-arm-kernel, u-boot

Hello Ezra,

On Sat, 10 Oct 2020 18:41:24 +0200
Ezra Buehler <ezra@easyb.ch> wrote:

> I am running Debian buster (Linux 4.19.146) on a Synology DS214+ NAS
> (Marvell ARMADA XP). Unfortunately, I end up with random MAC addresses
> for the two Ethernet interfaces after boot. (Also with Debian sid, Linux
> 5.4.0.)
> 
> Since commit 8cc3e439ab92 ("net: mvneta: read MAC address from hardware
> when available") the mvneta Linux driver reads the MVNETA_MAC_ADDR_*
> registers when no MAC address is provided by the DT. In my case, only
> zeros are read, causing the driver to fall back to a random address. I
> was able to verify that the registers are correctly written by the
> bootloader by reading out the registers in the U-Boot prompt.
> 
> As a workaround, I now specify the MAC addresses in the DT. However, I
> would prefer not to do that. Also, it would be nice to get to the bottom
> of this.
> 
> Could it be, that for some reason, the clock of the MAC is removed
> either by U-Boot or Linux during boot?

I suspect you have the mvneta driver as a module ? If this is the case,
then indeed, the MAC address is lost because Linux turns of all unused
clocks at the end of the boot. When the driver is built-in, there is a
driver adding a reference to the clock before all unused clocks are
disabled. When the driver is compiled as a module, this does not
happen. So indeed, the correct solution here is to have U-Boot pass the
MAC address in the Device Tree.

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: Linux mvneta driver unable to read MAC address from HW
  2020-10-13  6:35 ` Thomas Petazzoni
@ 2020-10-13  8:20   ` Ezra Buehler
  0 siblings, 0 replies; 3+ messages in thread
From: Ezra Buehler @ 2020-10-13  8:20 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: netdev, Stefan Roese, linux-arm-kernel, u-boot

Hi Thomas,

On 13 Oct 2020, at 08:35, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:
> I suspect you have the mvneta driver as a module ? If this is the case,
> then indeed, the MAC address is lost because Linux turns of all unused
> clocks at the end of the boot. When the driver is built-in, there is a
> driver adding a reference to the clock before all unused clocks are
> disabled. When the driver is compiled as a module, this does not
> happen. So indeed, the correct solution here is to have U-Boot pass the
> MAC address in the Device Tree.

Yes, you are right, the driver is compiled as module. This explains
everything, thank you very much for the clarification.

Have a nice day!

Cheers,
Ezra.


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

end of thread, other threads:[~2020-10-13  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 16:41 Linux mvneta driver unable to read MAC address from HW Ezra Buehler
2020-10-13  6:35 ` Thomas Petazzoni
2020-10-13  8:20   ` Ezra Buehler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).