From bb8a336276b4c836f62ef3c12d6fd4415acbb3be Mon Sep 17 00:00:00 2001 From: gwl Date: Thu, 20 Mar 2014 16:32:32 +0800 Subject: [PATCH] Wifi:8188eu: modify to support rtl8188eu. --- .../wireless/rockchip_wlan/rtl8188eu/Makefile | 7 ++-- .../rockchip_wlan/rtl8188eu/core/rtw_mp.c | 8 ++--- .../rtl8188eu/include/autoconf.h | 2 +- .../rtl8188eu/include/rtw_version.h | 2 +- .../rtl8188eu/os_dep/linux/ioctl_linux.c | 36 +++++++++++++++---- .../rtl8188eu/os_dep/linux/usb_intf.c | 14 +++----- 6 files changed, 41 insertions(+), 28 deletions(-) diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188eu/Makefile b/drivers/net/wireless/rockchip_wlan/rtl8188eu/Makefile index 505be66b616e..184bc27421a0 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8188eu/Makefile +++ b/drivers/net/wireless/rockchip_wlan/rtl8188eu/Makefile @@ -84,9 +84,9 @@ CONFIG_PLATFORM_TEGRA4_DALMORE = n CONFIG_PLATFORM_ARM_TCC8900 = n CONFIG_PLATFORM_ARM_TCC8920 = n CONFIG_PLATFORM_ARM_TCC8920_JB42 = n -CONFIG_PLATFORM_ARM_RK2818 = n +CONFIG_PLATFORM_ARM_RK2818 = y CONFIG_PLATFORM_ARM_RK3066 = n -CONFIG_PLATFORM_ARM_RK3188 = y +CONFIG_PLATFORM_ARM_RK3188 = n CONFIG_PLATFORM_ARM_URBETTER = n CONFIG_PLATFORM_ARM_TI_PANDA = n CONFIG_PLATFORM_MIPS_JZ4760 = n @@ -996,12 +996,11 @@ EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFO ARCH := arm CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi- KSRC := /usr/src/release_fae_version/kernel25_A7_281x -MODULE_NAME := wlan +MODULE_NAME := 8188eu endif ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y) EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS -DCONFIG_MINIMAL_MEMORY_USAGE -#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN EXTRA_CFLAGS += -DRTW_USE_CFG80211_STA_EVENT ARCH := arm diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188eu/core/rtw_mp.c b/drivers/net/wireless/rockchip_wlan/rtl8188eu/core/rtw_mp.c index 91372d0baff0..484b520acd8f 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8188eu/core/rtw_mp.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8188eu/core/rtw_mp.c @@ -560,6 +560,8 @@ MPT_InitializeAdapter( #ifdef CONFIG_RTL8188E pMptCtx->backup0x52_RF_A = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); pMptCtx->backup0x52_RF_B = (u1Byte)PHY_QueryRFReg(pAdapter, RF_PATH_A, RF_0x52, 0x000F0); + rtw_write32(pAdapter, REG_MACID_NO_LINK_0, 0x0); + rtw_write32(pAdapter, REG_MACID_NO_LINK_1, 0x0); #endif //set ant to wifi side in mp mode @@ -779,12 +781,6 @@ u32 mp_join(PADAPTER padapter,u8 mode) RT_TRACE(_module_mp_, _drv_notice_, ("+start mp in normal mode\n")); } #endif - _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); - _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING); - _clr_fwstate_(pmlmepriv, _FW_LINKED); - _clr_fwstate_(pbuddymlmepriv, _FW_UNDER_SURVEY); - _clr_fwstate_(pbuddymlmepriv, _FW_UNDER_LINKING); - _clr_fwstate_(pbuddymlmepriv, _FW_LINKED); set_fwstate(pmlmepriv, _FW_UNDER_LINKING); set_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE); diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/autoconf.h b/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/autoconf.h index f76ae9fa5c2b..4d193cf727fd 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/autoconf.h +++ b/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/autoconf.h @@ -46,7 +46,7 @@ #endif #ifdef CONFIG_IOCTL_CFG80211 - //#define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */ + #define RTW_USE_CFG80211_STA_EVENT /* Indecate new sta asoc through cfg80211_new_sta */ #define CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER //#define CONFIG_DEBUG_CFG80211 //#define CONFIG_DRV_ISSUE_PROV_REQ // IOT FOR S2 diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/rtw_version.h b/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/rtw_version.h index 0f0030cf48ad..b64c859c5ea8 100644 --- a/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/rtw_version.h +++ b/drivers/net/wireless/rockchip_wlan/rtl8188eu/include/rtw_version.h @@ -1 +1 @@ -#define DRIVERVERSION "v4.3.0_10600.20140220" +#define DRIVERVERSION "v4.3.0.2_10792.20140318" diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/ioctl_linux.c b/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/ioctl_linux.c index 184420c9934e..145d61b499cf 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/ioctl_linux.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/ioctl_linux.c @@ -11200,8 +11200,7 @@ static int rtw_mp_arx(struct net_device *dev, else if(bQueryPhy) { - //if (IS_HARDWARE_TYPE_JAGUAR(padapter)) - #ifdef CONFIG_RTL8188A + if (IS_HARDWARE_TYPE_JAGUAR(padapter)) { cckok = PHY_QueryBBReg(padapter, 0xF04, 0x3FFF); // [13:0] ofdmok = PHY_QueryBBReg(padapter, 0xF14, 0x3FFF); // [13:0] @@ -11212,8 +11211,11 @@ static int rtw_mp_arx(struct net_device *dev, ofdmcrc = PHY_QueryBBReg(padapter, 0xF14, 0x3FFF0000); // [29:16] htcrc = PHY_QueryBBReg(padapter, 0xF10, 0x3FFF0000); // [29:16] vht_err = PHY_QueryBBReg(padapter, 0xF0C, 0x3FFF0000); // [29:16] + + CCK_FA = PHY_QueryBBReg(padapter, 0xa5c, bMaskLWord); + OFDM_FA = PHY_QueryBBReg(padapter, 0xF48, bMaskLWord); } - #else + else { cckok = PHY_QueryBBReg(padapter, 0xF88, bMaskDWord); ofdmok = PHY_QueryBBReg(padapter, 0xF94, bMaskLWord); @@ -11224,9 +11226,15 @@ static int rtw_mp_arx(struct net_device *dev, ofdmcrc = PHY_QueryBBReg(padapter, 0xF94, bMaskHWord); htcrc = PHY_QueryBBReg(padapter, 0xF90, bMaskHWord); vht_err = 0; - } - #endif + + OFDM_FA = PHY_QueryBBReg(padapter, 0xCF0, bMaskLWord) + PHY_QueryBBReg(padapter, 0xCF2, bMaskLWord) + + PHY_QueryBBReg(padapter, 0xDA2, bMaskLWord)+ PHY_QueryBBReg(padapter, 0xDA4, bMaskLWord) + + PHY_QueryBBReg(padapter, 0xDA6, bMaskLWord) + PHY_QueryBBReg(padapter, 0xDA8, bMaskLWord); + CCK_FA=(rtw_read8(padapter, 0xa5b )<<8 ) | (rtw_read8(padapter, 0xa5c)); + } + DBG_871X("%s: OFDM_FA =%d\n", __FUNCTION__, OFDM_FA); + DBG_871X("%s: CCK_FA =%d\n", __FUNCTION__, CCK_FA); sprintf( extra, "Phy Received packet OK:%d CRC error:%d FA Counter: %d",cckok+ofdmok+htok+vht_ok,cckcrc+ofdmcrc+htcrc+vht_err,OFDM_FA+CCK_FA); } else if(bQueryMac) @@ -11253,8 +11261,8 @@ static int rtw_mp_arx(struct net_device *dev, DropPacket = rtw_read32(padapter, 0x664)& 0x0000FFFF; } - sprintf( extra, "Mac Received packet OK: %d , CRC error: %d , FA Counter: %d , Drop Packets: %d\n", - mac_cck_ok+mac_ofdm_ok+mac_ht_ok+mac_vht_ok,mac_cck_err+mac_ofdm_err+mac_ht_err+mac_vht_err,OFDM_FA+CCK_FA,DropPacket); + sprintf( extra, "Mac Received packet OK: %d , CRC error: %d , Drop Packets: %d\n", + mac_cck_ok+mac_ofdm_ok+mac_ht_ok+mac_vht_ok,mac_cck_err+mac_ofdm_err+mac_ht_err+mac_vht_err,DropPacket); } wrqu->length = strlen(extra) + 1; @@ -11435,12 +11443,26 @@ static int rtw_mp_reset_stats(struct net_device *dev, { write_bbreg(padapter, 0xB58, BIT0, 0x1); write_bbreg(padapter, 0xB58, BIT0, 0x0); + + write_bbreg(padapter, 0x9A4, BIT17, 0x1);//reset OFDA FA counter + write_bbreg(padapter, 0x9A4, BIT17, 0x0); + + write_bbreg(padapter, 0xA5C, BIT15, 0x0);//reset CCK FA counter + write_bbreg(padapter, 0xA5C, BIT15, 0x1); } else { write_bbreg(padapter, 0xF14, BIT16, 0x1); rtw_msleep_os(10); write_bbreg(padapter, 0xF14, BIT16, 0x0); + + write_bbreg(padapter, 0xD00, BIT27, 0x1);//reset OFDA FA counter + write_bbreg(padapter, 0xC0C, BIT31, 0x1);//reset OFDA FA counter + write_bbreg(padapter, 0xD00, BIT27, 0x0); + write_bbreg(padapter, 0xC0C, BIT31, 0x0); + + write_bbreg(padapter, 0xA2C, BIT15, 0x0);//reset CCK FA counter + write_bbreg(padapter, 0xA2C, BIT15, 0x1); } //reset mac counter PHY_SetMacReg(padapter, 0x664, BIT27, 0x1); diff --git a/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/usb_intf.c b/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/usb_intf.c index cf43875cca70..6a3276b033b8 100755 --- a/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/usb_intf.c +++ b/drivers/net/wireless/rockchip_wlan/rtl8188eu/os_dep/linux/usb_intf.c @@ -1939,23 +1939,21 @@ static void rtw_drv_halt(void) } #include "wifi_version.h" -extern int rockchip_wifi_power(int on); +#include -static int __init rockchip_wifi_init_module(void) +int rockchip_wifi_init_module(void) { printk("\n"); printk("=======================================================\n"); printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n"); printk("=======================================================\n"); printk("Realtek 8188EU USB WiFi driver (Powered by Rockchip,Ver %s) init.\n", RTL8192_DRV_VERSION); - rockchip_wifi_power(0); - msleep(100); rockchip_wifi_power(1); return rtw_drv_entry(); } -static void __exit rockchip_wifi_exit_module(void) +void rockchip_wifi_exit_module(void) { printk("\n"); printk("=======================================================\n"); @@ -1966,10 +1964,8 @@ static void __exit rockchip_wifi_exit_module(void) rockchip_wifi_power(0); } -late_initcall(rockchip_wifi_init_module); -module_exit(rockchip_wifi_exit_module); -//module_init(rtw_drv_entry); -//module_exit(rtw_drv_halt); +EXPORT_SYMBOL(rockchip_wifi_init_module); +EXPORT_SYMBOL(rockchip_wifi_exit_module); #ifdef CONFIG_INTEL_PROXIM _adapter *rtw_usb_get_sw_pointer(void) -- 2.34.1