sh_eth: use random MAC address if no valid one supplied
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Mon, 29 Apr 2013 09:49:42 +0000 (09:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Apr 2013 19:37:08 +0000 (15:37 -0400)
On Renesas R-Car based development boards, although a MAC address is printed on
all the Ethernet port labels, U-Boot  doesn't write a valid MAC address  to the
Ether MAHR/MALR registers (there's no storage provided for the Ether MAC address
either), so we have to resort to using a random MAC address...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c

index e46da1e8f98e1a6d88f96b729b014a93c70dbe34..33dc6f2418f2968e23a383e2c0395ed41d832132 100644 (file)
@@ -2735,6 +2735,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 
        /* read and set MAC address */
        read_mac_address(ndev, pd->mac_addr);
+       if (!is_valid_ether_addr(ndev->dev_addr)) {
+               dev_warn(&pdev->dev,
+                        "no valid MAC address supplied, using a random one.\n");
+               eth_hw_addr_random(ndev);
+       }
 
        /* ioremap the TSU registers */
        if (mdp->cd->tsu) {
This page took 0.027526 seconds and 5 git commands to generate.