Skip to contentSkip to conversation

microchip: lan865x: Minor improvements

PATCH Applied Stefan Wahren 3 participants 5 messages Sep 12, 2025 – Sep 16, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover microchip: lan865x: Minor improvements

Recently I setup a custom i.MX93 board which contains a LAN8651 chip. These minor improvements were considered as helpful.

The series has been tested with the mentioned i.MX93 board.

Changes in V2:
- add Andrew's RB to Patch #1
- implement fetching of MAC from NVMEM in a generic helper, so lan865x doesn't need any modifications (Patch #2)

Stefan Wahren (2):
microchip: lan865x: Enable MAC address validation
ethernet: Extend device_get_mac_address() to use NVMEM

 drivers/net/ethernet/microchip/lan865x/lan865x.c | 1 +
 net/ethernet/eth.c                               | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/2 microchip: lan865x: Enable MAC address validation

Use the generic eth_validate_addr() function for MAC address validation.

---
 drivers/net/ethernet/microchip/lan865x/lan865x.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/microchip/lan865x/lan865x.c +1 -0
index b428ad6516c5..0277d9737369 100644
@@ -326,6 +326,7 @@ static const struct net_device_ops lan865x_netdev_ops = {
 	.ndo_start_xmit		= lan865x_send_packet,
 	.ndo_set_rx_mode	= lan865x_set_multicast_list,
 	.ndo_set_mac_address	= lan865x_set_mac_address,
+	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_eth_ioctl          = phy_do_ioctl_running,
 };
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 ethernet: Extend device_get_mac_address() to use NVMEM

In reply to Stefan Wahren

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.

---
 net/ethernet/eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/ethernet/eth.c +4 -1
index 4e3651101b86..43e211e611b1 100644
@@ -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);
 
Signature · 1 line
2.34.1
Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH V2 2/2 net-next] ethernet: Extend device_get_mac_address() to use NVMEM

Quoted 6 lines · Stefan Wahren

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.

Andrew

#4 lore raw
In reply to Stefan Wahren
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Fri, 12 Sep 2025 16:03:30 +0200 you wrote:

Recently I setup a custom i.MX93 board which contains a LAN8651 chip. These minor improvements were considered as helpful.

The series has been tested with the mentioned i.MX93 board.

Changes in V2:
- add Andrew's RB to Patch #1
- implement fetching of MAC from NVMEM in a generic helper, so lan865x doesn't need any modifications (Patch #2)

[...]

Here is the summary with links:
- [V2,1/2,net-next] microchip: lan865x: Enable MAC address validation

    https://git.kernel.org/netdev/net-next/c/c5b7509d3a47
  - [V2,2/2,net-next] ethernet: Extend device_get_mac_address() to use NVMEM
    https://git.kernel.org/netdev/net-next/c/d2d3f529e7b6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html