[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <60547e0f-f1ef-46e1-a7ce-ea302ab08584@lunn.ch>
Date: Thu, 4 Sep 2025 20:54:31 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Stefan Wahren <wahrenst@....net>
Cc: Parthiban Veerasooran <parthiban.veerasooran@...rochip.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH RFC 2/2 next] microchip: lan865x: Allow to fetch MAC from
NVMEM
On Thu, Sep 04, 2025 at 12:09:16PM +0200, Stefan Wahren wrote:
> A lot of modern SoC have the ability to store MAC addresses in
> their NVMEM. The generic function device_get_ethdev_address()
> doesn't provide this feature. So try to fetch the MAC from
> NVMEM if the generic function fails.
I notice this is RFC. What comments would you like?
> - if (device_get_ethdev_address(&spi->dev, netdev))
> - eth_hw_addr_random(netdev);
> + if (device_get_ethdev_address(&spi->dev, netdev)) {
> + /* Get the MAC address from NVMEM */
> + if (of_get_ethdev_address(spi->dev.of_node, netdev))
> + eth_hw_addr_random(netdev);
> + }
Maybe chain this onto the end of device_get_ethdev_address() ? Looking
at the current users of device_get_ethdev_address(), bcmgenet,
enc28j60, and emac are all likely to be DT systems which could benefit
from this. You just need to make sure ACPI don't dereference a NULL
pointer.
Andrew
Powered by blists - more mailing lists