net: mvpp2: support setting hardware addresses from ethernet core
authorMatt Pelland <mpelland@starry.com>
Tue, 30 Jul 2019 13:40:24 +0000 (09:40 -0400)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 4 Sep 2019 16:37:19 +0000 (11:37 -0500)
mvpp2 already has support for setting MAC addresses but this
functionality was not exposed to the ethernet core. This commit exposes
this functionality so that MAC address assignments stored in U-Boot's
environment are correctly applied before Linux boots.

Signed-off-by: Matt Pelland <mpelland@starry.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/mvpp2.c

index bcc6fe92a9f9de9d24c557ff5b33d54e2330f5af..bd89725e777cf9415394356e4d7cf154b13d1d95 100644 (file)
@@ -5321,6 +5321,13 @@ static void mvpp2_stop(struct udevice *dev)
        mvpp2_cleanup_txqs(port);
 }
 
+static int mvpp2_write_hwaddr(struct udevice *dev)
+{
+       struct mvpp2_port *port = dev_get_priv(dev);
+
+       return mvpp2_prs_update_mac_da(port, port->dev_addr);
+}
+
 static int mvpp22_smi_phy_addr_cfg(struct mvpp2_port *port)
 {
        writel(port->phyaddr, port->priv->iface_base +
@@ -5525,6 +5532,7 @@ static const struct eth_ops mvpp2_ops = {
        .send           = mvpp2_send,
        .recv           = mvpp2_recv,
        .stop           = mvpp2_stop,
+       .write_hwaddr   = mvpp2_write_hwaddr
 };
 
 static struct driver mvpp2_driver = {