Wifi: add wifi mac address user-defined function.
authorgwl <gwl@rock-chips.com>
Wed, 17 Sep 2014 01:36:44 +0000 (09:36 +0800)
committergwl <gwl@rock-chips.com>
Wed, 17 Sep 2014 01:38:56 +0000 (09:38 +0800)
drivers/net/wireless/rockchip_wlan/rtl8188eu/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8189es/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8192cu/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8192du/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8723au/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8723bs/core/rtw_ieee80211.c
drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ieee80211.c
net/rfkill/rfkill-wlan.c

index 97eba25e0fee0c5c49493d90bd472b936cb7d407..789d30fa4ec00c57907f96577051e5a676ca6a03 100755 (executable)
@@ -1348,43 +1348,54 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 }
 
 extern char* rtw_initmac;
+#include <linux/rfkill-wlan.h>
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
-       u8 mac[ETH_ALEN];
-       if(mac_addr == NULL)    return;
-       
-       if ( rtw_initmac )
-       {       //      Users specify the mac address
-               int jj,kk;
+    u8 mac[ETH_ALEN];
 
-               for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-               {
-                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
-               }
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-       }
-       else
-       {       //      Use the mac address stored in the Efuse
-               _rtw_memcpy(mac, mac_addr, ETH_ALEN);
-       }
-       
-       if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
-            (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
-           ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
-            (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
-       {
-               mac[0] = 0x00;
-               mac[1] = 0xe0;
-               mac[2] = 0x4c;
-               mac[3] = 0x87;
-               mac[4] = 0x00;
-               mac[5] = 0x00;
-               // use default mac addresss
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-               DBG_871X("MAC Address from efuse error, assign default one !!!\n");
-       }       
+    if(mac_addr == NULL)    return;
 
-       DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
+    if ( rtw_initmac )
+    {   //  Users specify the mac address
+        int jj,kk;
+
+        for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
+        {
+            mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
+        }
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+    }
+    else
+    {
+        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
+            mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
+            _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        } else {
+            //  Use the mac address stored in the Efuse
+            _rtw_memcpy(mac, mac_addr, ETH_ALEN);
+        }
+    }
+
+    if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
+         (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
+        ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
+         (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
+    {
+        mac[0] = 0x00;
+        mac[1] = 0xe0;
+        mac[2] = 0x4c;
+        mac[3] = 0x87;
+        mac[4] = 0x00;
+        mac[5] = 0x00;
+        // use default mac addresss
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        DBG_871X("MAC Address from efuse error, assign default one !!!\n");
+    }
+
+    DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
 }
 
 void dump_ies(u8 *buf, u32 buf_len)
index 97eba25e0fee0c5c49493d90bd472b936cb7d407..789d30fa4ec00c57907f96577051e5a676ca6a03 100644 (file)
@@ -1348,43 +1348,54 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 }
 
 extern char* rtw_initmac;
+#include <linux/rfkill-wlan.h>
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
-       u8 mac[ETH_ALEN];
-       if(mac_addr == NULL)    return;
-       
-       if ( rtw_initmac )
-       {       //      Users specify the mac address
-               int jj,kk;
+    u8 mac[ETH_ALEN];
 
-               for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-               {
-                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
-               }
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-       }
-       else
-       {       //      Use the mac address stored in the Efuse
-               _rtw_memcpy(mac, mac_addr, ETH_ALEN);
-       }
-       
-       if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
-            (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
-           ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
-            (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
-       {
-               mac[0] = 0x00;
-               mac[1] = 0xe0;
-               mac[2] = 0x4c;
-               mac[3] = 0x87;
-               mac[4] = 0x00;
-               mac[5] = 0x00;
-               // use default mac addresss
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-               DBG_871X("MAC Address from efuse error, assign default one !!!\n");
-       }       
+    if(mac_addr == NULL)    return;
 
-       DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
+    if ( rtw_initmac )
+    {   //  Users specify the mac address
+        int jj,kk;
+
+        for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
+        {
+            mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
+        }
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+    }
+    else
+    {
+        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
+            mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
+            _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        } else {
+            //  Use the mac address stored in the Efuse
+            _rtw_memcpy(mac, mac_addr, ETH_ALEN);
+        }
+    }
+
+    if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
+         (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
+        ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
+         (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
+    {
+        mac[0] = 0x00;
+        mac[1] = 0xe0;
+        mac[2] = 0x4c;
+        mac[3] = 0x87;
+        mac[4] = 0x00;
+        mac[5] = 0x00;
+        // use default mac addresss
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        DBG_871X("MAC Address from efuse error, assign default one !!!\n");
+    }
+
+    DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
 }
 
 void dump_ies(u8 *buf, u32 buf_len)
index a1c5cba18ee67e94452c49d4547adddea7c71122..a7f2150e947b1ca5c0e5712a9e58517e483ad635 100755 (executable)
@@ -1216,11 +1216,9 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 
 extern char* rtw_initmac;
 #include <linux/rfkill-wlan.h>
-
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
     u8 mac[ETH_ALEN];
-    u8 macbuf[30] = {0};
 
     if(mac_addr == NULL)    return;
 
@@ -1238,13 +1236,9 @@ void rtw_macaddr_cfg(u8 *mac_addr)
     {
         printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
             mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
-        if (!rockchip_wifi_mac_addr(macbuf)) {
-            int jj,kk;
-            printk("=========> get mac address from flash %s\n", macbuf);
-            for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-            {
-                mac[jj] = key_2char2num(macbuf[kk], macbuf[kk+ 1]);
-            }
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
             _rtw_memcpy(mac_addr, mac, ETH_ALEN);
         } else {
             //  Use the mac address stored in the Efuse
index 2edc9a9f385d617b3de76c8fa315d08c2126e29c..d45e5732bdd275b3ff75f1f73f7ad7d1dabb752e 100644 (file)
@@ -1237,43 +1237,54 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 }
 
 extern char* rtw_initmac;
+#include <linux/rfkill-wlan.h>
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
-       u8 mac[ETH_ALEN];
-       if(mac_addr == NULL)    return;
-       
-       if ( rtw_initmac )
-       {       //      Users specify the mac address
-               int jj,kk;
+    u8 mac[ETH_ALEN];
 
-               for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-               {
-                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
-               }
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-       }
-       else
-       {       //      Use the mac address stored in the Efuse
-               _rtw_memcpy(mac, mac_addr, ETH_ALEN);
-       }
-       
-       if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
-            (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
-           ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
-            (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
-       {
-               mac[0] = 0x00;
-               mac[1] = 0xe0;
-               mac[2] = 0x4c;
-               mac[3] = 0x87;
-               mac[4] = 0x00;
-               mac[5] = 0x00;
-               // use default mac addresss
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-               DBG_871X("MAC Address from efuse error, assign default one !!!\n");
-       }       
+    if(mac_addr == NULL)    return;
 
-       DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
+    if ( rtw_initmac )
+    {   //  Users specify the mac address
+        int jj,kk;
+
+        for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
+        {
+            mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
+        }
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+    }
+    else
+    {
+        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
+            mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
+            _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        } else {
+            //  Use the mac address stored in the Efuse
+            _rtw_memcpy(mac, mac_addr, ETH_ALEN);
+        }
+    }
+
+    if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
+         (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
+        ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
+         (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
+    {
+        mac[0] = 0x00;
+        mac[1] = 0xe0;
+        mac[2] = 0x4c;
+        mac[3] = 0x87;
+        mac[4] = 0x00;
+        mac[5] = 0x00;
+        // use default mac addresss
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        DBG_871X("MAC Address from efuse error, assign default one !!!\n");
+    }
+
+    DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
 }
 
 void dump_ies(u8 *buf, u32 buf_len) {
index af32123cbcc02d6450b4efd9840473b9a5383fa8..98c92eedaca0e2a3b2f7c68e6c0af5e5a01622e8 100755 (executable)
@@ -1314,43 +1314,54 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 }
 
 extern char* rtw_initmac;
+#include <linux/rfkill-wlan.h>
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
-       u8 mac[ETH_ALEN];
-       if(mac_addr == NULL)    return;
-       
-       if ( rtw_initmac )
-       {       //      Users specify the mac address
-               int jj,kk;
+    u8 mac[ETH_ALEN];
 
-               for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-               {
-                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
-               }
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-       }
-       else
-       {       //      Use the mac address stored in the Efuse
-               _rtw_memcpy(mac, mac_addr, ETH_ALEN);
-       }
-       
-       if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
-            (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
-           ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
-            (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
-       {
-               mac[0] = 0x00;
-               mac[1] = 0xe0;
-               mac[2] = 0x4c;
-               mac[3] = 0x87;
-               mac[4] = 0x00;
-               mac[5] = 0x00;
-               // use default mac addresss
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-               DBG_871X("MAC Address from efuse error, assign default one !!!\n");
-       }       
+    if(mac_addr == NULL)    return;
 
-       DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
+    if ( rtw_initmac )
+    {   //  Users specify the mac address
+        int jj,kk;
+
+        for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
+        {
+            mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
+        }
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+    }
+    else
+    {
+        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
+            mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
+            _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        } else {
+            //  Use the mac address stored in the Efuse
+            _rtw_memcpy(mac, mac_addr, ETH_ALEN);
+        }
+    }
+
+    if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
+         (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
+        ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
+         (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
+    {
+        mac[0] = 0x00;
+        mac[1] = 0xe0;
+        mac[2] = 0x4c;
+        mac[3] = 0x87;
+        mac[4] = 0x00;
+        mac[5] = 0x00;
+        // use default mac addresss
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        DBG_871X("MAC Address from efuse error, assign default one !!!\n");
+    }
+
+    DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
 }
 
 void dump_ies(u8 *buf, u32 buf_len)
index 4eaf3809bd716dcb8a7ae1f4de2cfc5fcf04f226..7340d469fc426e04707b97c373b890e8ef90d80d 100755 (executable)
@@ -1326,12 +1326,10 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 }
 
 extern char* rtw_initmac;
-extern int rockchip_wifi_mac_addr(unsigned char *buf);
-
+#include <linux/rfkill-wlan.h>
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
     u8 mac[ETH_ALEN];
-    u8 macbuf[30] = {0};
 
     if(mac_addr == NULL)    return;
 
@@ -1349,13 +1347,9 @@ void rtw_macaddr_cfg(u8 *mac_addr)
     {
         printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
             mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
-        if (!rockchip_wifi_mac_addr(macbuf)) {
-            int jj,kk;
-            printk("=========> get mac address from flash %s\n", macbuf);
-            for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-            {
-                mac[jj] = key_2char2num(macbuf[kk], macbuf[kk+ 1]);
-            }
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
             _rtw_memcpy(mac_addr, mac, ETH_ALEN);
         } else {
             //  Use the mac address stored in the Efuse
index 97eba25e0fee0c5c49493d90bd472b936cb7d407..789d30fa4ec00c57907f96577051e5a676ca6a03 100644 (file)
@@ -1348,43 +1348,54 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch)
 }
 
 extern char* rtw_initmac;
+#include <linux/rfkill-wlan.h>
 void rtw_macaddr_cfg(u8 *mac_addr)
 {
-       u8 mac[ETH_ALEN];
-       if(mac_addr == NULL)    return;
-       
-       if ( rtw_initmac )
-       {       //      Users specify the mac address
-               int jj,kk;
+    u8 mac[ETH_ALEN];
 
-               for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
-               {
-                       mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
-               }
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-       }
-       else
-       {       //      Use the mac address stored in the Efuse
-               _rtw_memcpy(mac, mac_addr, ETH_ALEN);
-       }
-       
-       if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
-            (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
-           ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
-            (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
-       {
-               mac[0] = 0x00;
-               mac[1] = 0xe0;
-               mac[2] = 0x4c;
-               mac[3] = 0x87;
-               mac[4] = 0x00;
-               mac[5] = 0x00;
-               // use default mac addresss
-               _rtw_memcpy(mac_addr, mac, ETH_ALEN);
-               DBG_871X("MAC Address from efuse error, assign default one !!!\n");
-       }       
+    if(mac_addr == NULL)    return;
 
-       DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
+    if ( rtw_initmac )
+    {   //  Users specify the mac address
+        int jj,kk;
+
+        for( jj = 0, kk = 0; jj < ETH_ALEN; jj++, kk += 3 )
+        {
+            mac[jj] = key_2char2num(rtw_initmac[kk], rtw_initmac[kk+ 1]);
+        }
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+    }
+    else
+    {
+        printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1],
+            mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+        if (!rockchip_wifi_mac_addr(mac)) {
+            printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
+                mac[2], mac[3], mac[4], mac[5]);
+            _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        } else {
+            //  Use the mac address stored in the Efuse
+            _rtw_memcpy(mac, mac_addr, ETH_ALEN);
+        }
+    }
+
+    if (((mac[0]==0xff) &&(mac[1]==0xff) && (mac[2]==0xff) &&
+         (mac[3]==0xff) && (mac[4]==0xff) &&(mac[5]==0xff)) ||
+        ((mac[0]==0x0) && (mac[1]==0x0) && (mac[2]==0x0) &&
+         (mac[3]==0x0) && (mac[4]==0x0) &&(mac[5]==0x0)))
+    {
+        mac[0] = 0x00;
+        mac[1] = 0xe0;
+        mac[2] = 0x4c;
+        mac[3] = 0x87;
+        mac[4] = 0x00;
+        mac[5] = 0x00;
+        // use default mac addresss
+        _rtw_memcpy(mac_addr, mac, ETH_ALEN);
+        DBG_871X("MAC Address from efuse error, assign default one !!!\n");
+    }
+
+    DBG_871X("rtw_macaddr_cfg MAC Address  = "MAC_FMT"\n", MAC_ARG(mac_addr));
 }
 
 void dump_ies(u8 *buf, u32 buf_len)
index 56c0de199083be0e2e9c9bedbb10becc6ffa2bd7..1ce1da6d79125624cafb5d6549016b2c3a1b98d6 100755 (executable)
@@ -508,8 +508,6 @@ u8 wifi_custom_mac_addr[6] = {0,0,0,0,0,0};
 extern char GetSNSectorInfo(char * pbuf);
 int rockchip_wifi_mac_addr(unsigned char *buf)
 {
-    return -1;
-/*
     char mac_buf[20] = {0};
     LOG("%s: enter.\n", __func__);
 
@@ -541,13 +539,9 @@ int rockchip_wifi_mac_addr(unsigned char *buf)
         return -1;
     }
 
-#if defined(CONFIG_RKWIFI)
     memcpy(buf, wifi_custom_mac_addr, 6);
-#else
-    memcpy(buf, mac_buf, strlen(mac_buf));//realtek's wifi use this branch
-#endif
+
     return 0;
-*/
 }
 EXPORT_SYMBOL(rockchip_wifi_mac_addr);