From 1212a71d9daffaf5788b12bed1e7ef4769dc89d7 Mon Sep 17 00:00:00 2001 From: hwg Date: Mon, 20 Apr 2015 16:07:18 +0800 Subject: [PATCH] wifi driver: rtl8723bs, rtl8723bs-vq0, rtl8723bu, rtl8812au, modify custom mac addr error problem --- .../rtl8723bs-vq0/core/rtw_ieee80211.c | 29 ++++++++-------- .../rtl8723bs/core/rtw_ieee80211.c | 34 ++++++++----------- .../rtl8723bu/core/rtw_ieee80211.c | 18 +++++++--- .../rtl8812au/core/rtw_ieee80211.c | 18 +++++++--- 4 files changed, 58 insertions(+), 41 deletions(-) diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723bs-vq0/core/rtw_ieee80211.c b/drivers/net/wireless/rockchip_wlan/rtl8723bs-vq0/core/rtw_ieee80211.c index 6240b5306060..bc6b5fb2879b 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8723bs-vq0/core/rtw_ieee80211.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8723bs-vq0/core/rtw_ieee80211.c @@ -1383,7 +1383,7 @@ int rtw_get_mac_addr_intel(unsigned char *buf) #endif //CONFIG_PLATFORM_INTEL_BYT extern char* rtw_initmac; -extern int rockchip_wifi_mac_addr(unsigned char *buf); +#include void rtw_macaddr_cfg(u8 *mac_addr) { u8 mac[ETH_ALEN]; @@ -1399,19 +1399,20 @@ void rtw_macaddr_cfg(u8 *mac_addr) } _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_addr)) { - printk("Use flash 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]); - } else { - // Use the mac address stored in the Efuse - _rtw_memcpy(mac, mac_addr, 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) && diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723bs/core/rtw_ieee80211.c b/drivers/net/wireless/rockchip_wlan/rtl8723bs/core/rtw_ieee80211.c index 424e917c3962..3a7ad41a0b98 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8723bs/core/rtw_ieee80211.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8723bs/core/rtw_ieee80211.c @@ -1383,11 +1383,11 @@ int rtw_get_mac_addr_intel(unsigned char *buf) #endif //CONFIG_PLATFORM_INTEL_BYT extern char* rtw_initmac; -extern int rockchip_wifi_mac_addr(unsigned char *buf); +#include void rtw_macaddr_cfg(u8 *mac_addr) { - u8 mac[ETH_ALEN]; - u8 macbuf[30] = {0}; + u8 mac[ETH_ALEN]; + if(mac_addr == NULL) return; if ( rtw_initmac ) @@ -1407,23 +1407,19 @@ void rtw_macaddr_cfg(u8 *mac_addr) } #endif //CONFIG_PLATFORM_INTEL_BYT else - { // Use the mac address stored in the Efuse - printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", mac_addr[0], mac_addr[1], + { + 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]); - } - _rtw_memcpy(mac_addr, mac, ETH_ALEN); - }else{ - // Use the mac address stored in the Efuse - _rtw_memcpy(mac, mac_addr, ETH_ALEN); - }; - } - + 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) && diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ieee80211.c b/drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ieee80211.c index eabc91f58e16..ba6cad26514b 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ieee80211.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8723bu/core/rtw_ieee80211.c @@ -1383,6 +1383,7 @@ int rtw_get_mac_addr_intel(unsigned char *buf) #endif //CONFIG_PLATFORM_INTEL_BYT extern char* rtw_initmac; +#include void rtw_macaddr_cfg(u8 *mac_addr) { u8 mac[ETH_ALEN]; @@ -1405,10 +1406,19 @@ void rtw_macaddr_cfg(u8 *mac_addr) } #endif //CONFIG_PLATFORM_INTEL_BYT else - { // Use the mac address stored in the Efuse - _rtw_memcpy(mac, mac_addr, ETH_ALEN); - } - + { + 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) && diff --git a/drivers/net/wireless/rockchip_wlan/rtl8812au/core/rtw_ieee80211.c b/drivers/net/wireless/rockchip_wlan/rtl8812au/core/rtw_ieee80211.c index 354e7fcee8e9..65ee37c27b83 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8812au/core/rtw_ieee80211.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8812au/core/rtw_ieee80211.c @@ -1347,6 +1347,7 @@ u8 convert_ip_addr(u8 hch, u8 mch, u8 lch) } extern char* rtw_initmac; +#include void rtw_macaddr_cfg(u8 *mac_addr) { u8 mac[ETH_ALEN]; @@ -1363,10 +1364,19 @@ void rtw_macaddr_cfg(u8 *mac_addr) _rtw_memcpy(mac_addr, mac, ETH_ALEN); } else - { // Use the mac address stored in the Efuse - _rtw_memcpy(mac, mac_addr, ETH_ALEN); - } - + { + 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) && -- 2.34.1