Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 688cbaf2 authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller
Browse files

net: mvpp2: fallback using h/w and random mac if the dt one isn't valid



When using a mac address described in the device tree, a check is made
to see if it is valid. When it's not, no fallback is defined. This
patches tries to get the mac address from h/w (or use a random one if
the h/w one isn't valid) when the dt mac address isn't valid.

Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d2a6e48e
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -7477,7 +7477,9 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
	if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) {
		*mac_from = "device tree";
		ether_addr_copy(dev->dev_addr, dt_mac_addr);
	} else {
		return;
	}

	if (priv->hw_version == MVPP21) {
		mvpp21_get_mac_address(port, hw_mac_addr);
		if (is_valid_ether_addr(hw_mac_addr)) {
@@ -7490,7 +7492,6 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv,
	*mac_from = "random";
	eth_hw_addr_random(dev);
}
}

/* Ports initialization */
static int mvpp2_port_probe(struct platform_device *pdev,