]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
driver: net: ldpaa_eth: Set MAC address during interface open
authorPrabhakar Kushwaha <prabhakar@freescale.com>
Wed, 7 Oct 2015 10:59:58 +0000 (16:29 +0530)
committerYork Sun <yorksun@freescale.com>
Thu, 29 Oct 2015 17:33:57 +0000 (10:33 -0700)
Currently ldpaa ethernet driver rely on DPL file to statically configure
mac address for the DPNIs. It is not a correct approach.

Add support setting MAC address from env variable or Random MAC address.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
drivers/net/ldpaa_eth/ldpaa_eth.c

index 4de7586408e48171ab030e5bad711c3d15c93a90..99acb7a0c972420d8b50928d6a565a6c79a6bf12 100644 (file)
@@ -220,7 +220,6 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
 {
        struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;
        struct dpni_queue_attr rx_queue_attr;
-       uint8_t mac_addr[6];
        int err;
 
        if (net_dev->state == ETH_STATE_ACTIVE)
@@ -240,21 +239,13 @@ static int ldpaa_eth_open(struct eth_device *net_dev, bd_t *bd)
        if (err)
                goto err_bind;
 
-       err = dpni_get_primary_mac_addr(dflt_mc_io, MC_CMD_NO_FLAGS,
-                                       priv->dpni_handle, mac_addr);
+       err = dpni_add_mac_addr(dflt_mc_io, MC_CMD_NO_FLAGS,
+                               priv->dpni_handle, net_dev->enetaddr);
        if (err) {
-               printf("dpni_get_primary_mac_addr() failed\n");
+               printf("dpni_add_mac_addr() failed\n");
                return err;
        }
 
-       memcpy(net_dev->enetaddr, mac_addr, 0x6);
-
-       /* setup the MAC address */
-       if (net_dev->enetaddr[0] & 0x01) {
-               printf("%s: MacAddress is multcast address\n",  __func__);
-               return 1;
-       }
-
 #ifdef CONFIG_PHYLIB
        /* TODO Check this path */
        err = phy_startup(priv->phydev);