From: Luciano Coelho Date: Wed, 8 May 2013 09:54:56 +0000 (+0300) Subject: wl18xx: use locally administered MAC address if not available from fuse X-Git-Tag: firefly_0821_release~176^2~5751^2~78^2^2~65^2~7 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bc2ab3b850a8c563b3910f396e5f0753ce855134;p=firefly-linux-kernel-4.4.55.git wl18xx: use locally administered MAC address if not available from fuse In some R&D chips, the device may be left untrimmed and with the MAC address missing from fuse ROM. In order to support those devices, apply a random locally administered MAC address instead. Signed-off-by: Luciano Coelho --- diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index ae85ae46c61b..7aa0eb848c5a 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "../wlcore/wlcore.h" #include "../wlcore/debug.h" @@ -1318,6 +1319,16 @@ static int wl18xx_get_mac(struct wl1271 *wl) ((mac1 & 0xff000000) >> 24); wl->fuse_nic_addr = (mac1 & 0xffffff); + if (!wl->fuse_oui_addr && !wl->fuse_nic_addr) { + u8 mac[ETH_ALEN]; + + eth_random_addr(mac); + + wl->fuse_oui_addr = (mac[0] << 16) + (mac[1] << 8) + mac[2]; + wl->fuse_nic_addr = (mac[3] << 16) + (mac[4] << 8) + mac[5]; + wl1271_warning("MAC address from fuse not available, using random locally administered addresses."); + } + ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); out: