Commit 5575cf13 authored by Daniel Romell's avatar Daniel Romell Committed by David S. Miller

net: xilinx: emaclite: Fallback to random MAC address.

If the address configured in the device tree is invalid, the
driver will fallback to using a random address from the locally
administered range.
Signed-off-by: default avatarDaniel Romell <daro@hms.se>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff2e7d5d
...@@ -1131,11 +1131,13 @@ static int xemaclite_of_probe(struct platform_device *ofdev) ...@@ -1131,11 +1131,13 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong"); lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
mac_address = of_get_mac_address(ofdev->dev.of_node); mac_address = of_get_mac_address(ofdev->dev.of_node);
if (mac_address) if (mac_address) {
/* Set the MAC address. */ /* Set the MAC address. */
memcpy(ndev->dev_addr, mac_address, ETH_ALEN); memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
else } else {
dev_warn(dev, "No MAC address found\n"); dev_warn(dev, "No MAC address found, using random\n");
eth_hw_addr_random(ndev);
}
/* Clear the Tx CSR's in case this is a restart */ /* Clear the Tx CSR's in case this is a restart */
__raw_writel(0, lp->base_addr + XEL_TSR_OFFSET); __raw_writel(0, lp->base_addr + XEL_TSR_OFFSET);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment