net: usb: ax88179_178a: write mac to hardware in get_mac_addr
authorPeter Fink <pfink@christ-es.de>
Thu, 10 Oct 2019 13:00:22 +0000 (15:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 12 Oct 2019 03:50:37 +0000 (20:50 -0700)
When the MAC address is supplied via device tree or a random
MAC is generated it has to be written to the asix chip in
order to receive any data.

Previously in 9fb137aef34e ("net: usb: ax88179_178a: allow
optionally getting mac address from device tree") this line was
omitted because it seemed to work perfectly fine without it.

But it was simply not detected because the chip keeps the mac
stored even beyond a reset and it was tested on a hardware
with an integrated UPS where the asix chip was permanently
powered on even throughout power cycles.

Fixes: 9fb137aef34e ("net: usb: ax88179_178a: allow optionally getting mac address from device tree")
Signed-off-by: Peter Fink <pfink@christ-es.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/ax88179_178a.c

index 5a587663e7dc529409842d1b4c1378ae880d1c45..c5a6e75c24e3adce4b81cc7cf161b8e5888f1ca6 100644 (file)
@@ -1235,6 +1235,9 @@ static void ax88179_get_mac_addr(struct usbnet *dev)
                netdev_info(dev->net, "invalid MAC address, using random\n");
                eth_hw_addr_random(dev->net);
        }
+
+       ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, ETH_ALEN,
+                         dev->net->dev_addr);
 }
 
 static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)