mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
ethernet: Extend device_get_mac_address() to use NVMEM
[ Upstream commit d2d3f529e7 ]
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: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250912140332.35395-3-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3671a07759
commit
689ca6be7e
@@ -613,7 +613,10 @@ EXPORT_SYMBOL(fwnode_get_mac_address);
|
|||||||
*/
|
*/
|
||||||
int device_get_mac_address(struct device *dev, char *addr)
|
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);
|
EXPORT_SYMBOL(device_get_mac_address);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user