Commit d2d3f529 authored by Stefan Wahren's avatar Stefan Wahren Committed by Jakub Kicinski
Browse files

ethernet: Extend device_get_mac_address() to use NVMEM



A lot of modern SoC have the ability to store MAC addresses in their
NVMEM. So extend the generic function device_get_mac_address() to
obtain the MAC address from an nvmem cell named 'mac-address' in
case there is no firmware node which contains the MAC address directly.

Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250912140332.35395-3-wahrenst@gmx.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c5b7509d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -613,7 +613,10 @@ EXPORT_SYMBOL(fwnode_get_mac_address);
 */
int device_get_mac_address(struct device *dev, char *addr)
{
	return fwnode_get_mac_address(dev_fwnode(dev), addr);
	if (!fwnode_get_mac_address(dev_fwnode(dev), addr))
		return 0;

	return nvmem_get_mac_address(dev, addr);
}
EXPORT_SYMBOL(device_get_mac_address);