net: mvneta: support setting hardware address
authorMatt Pelland <mpelland@starry.com>
Tue, 27 Mar 2018 17:18:25 +0000 (13:18 -0400)
committerJoe Hershberger <joe.hershberger@ni.com>
Fri, 13 Apr 2018 20:47:31 +0000 (15:47 -0500)
mvneta already supports setting the MAC address but this was only done
internally when some other part of U-Boot tries to actually use the
interface. This commit exposes this functionality to the ethernet core
code so that the MAC addresses of all interfaces are configured
correctly even if they are not used before loading Linux.

Signed-off-by: Matt Pelland <mpelland@starry.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/mvneta.c

index 83e31537688163a155e97687e7706570c5e5c7e0..f2e9acfd1f3a95114a563a8ce67f3e0cde1e7141 100644 (file)
@@ -890,6 +890,15 @@ static void mvneta_mac_addr_set(struct mvneta_port *pp, unsigned char *addr,
        mvneta_set_ucast_addr(pp, addr[5], queue);
 }
 
+static int mvneta_write_hwaddr(struct udevice *dev)
+{
+       mvneta_mac_addr_set(dev_get_priv(dev),
+               ((struct eth_pdata *)dev_get_platdata(dev))->enetaddr,
+               rxq_def);
+
+       return 0;
+}
+
 /* Handle rx descriptor fill by setting buf_cookie and buf_phys_addr */
 static void mvneta_rx_desc_fill(struct mvneta_rx_desc *rx_desc,
                                u32 phys_addr, u32 cookie)
@@ -1753,6 +1762,7 @@ static const struct eth_ops mvneta_ops = {
        .send           = mvneta_send,
        .recv           = mvneta_recv,
        .stop           = mvneta_stop,
+       .write_hwaddr   = mvneta_write_hwaddr,
 };
 
 static int mvneta_ofdata_to_platdata(struct udevice *dev)