diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/staging/rtl8192u | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/staging/rtl8192u')
21 files changed, 1291 insertions, 405 deletions
diff --git a/drivers/staging/rtl8192u/dot11d.h b/drivers/staging/rtl8192u/dot11d.h new file mode 100644 index 0000000..92e7a00 --- /dev/null +++ b/drivers/staging/rtl8192u/dot11d.h @@ -0,0 +1,100 @@ +#ifndef __INC_DOT11D_H +#define __INC_DOT11D_H + +#include "ieee80211/ieee80211.h" + + +typedef struct _CHNL_TXPOWER_TRIPLE { + u8 FirstChnl; + u8 NumChnls; + u8 MaxTxPowerInDbm; +} CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; + +typedef enum _DOT11D_STATE { + DOT11D_STATE_NONE = 0, + DOT11D_STATE_LEARNED, + DOT11D_STATE_DONE, +} DOT11D_STATE; + +typedef struct _RT_DOT11D_INFO { + /* DECLARE_RT_OBJECT(RT_DOT11D_INFO); */ + + bool bEnabled; /* dot11MultiDomainCapabilityEnabled */ + + u16 CountryIeLen; /* > 0 if CountryIeBuf[] contains valid country information element. */ + u8 CountryIeBuf[MAX_IE_LEN]; + u8 CountryIeSrcAddr[6]; /* Source AP of the country IE. */ + u8 CountryIeWatchdog; + + u8 channel_map[MAX_CHANNEL_NUMBER+1]; /* !Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) */ + u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; + + DOT11D_STATE State; +} RT_DOT11D_INFO, *PRT_DOT11D_INFO; +#define eqMacAddr(a, b) (((a)[0] == (b)[0] && \ + (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && \ + (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) +#define cpMacAddr(des, src) ((des)[0] = (src)[0], \ + (des)[1] = (src)[1], (des)[2] = (src)[2], \ + (des)[3] = (src)[3], (des)[4] = (src)[4], \ + (des)[5] = (src)[5]) +#define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) + +#define IS_DOT11D_ENABLE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->bEnabled) +#define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) + +#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) +#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) + +#define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ + (((__Ie).Length == 0 || (__Ie).Length != GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ + FALSE : \ + (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) + +#define CIE_WATCHDOG_TH 1 +#define GET_CIE_WATCHDOG(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) +#define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 +#define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) + +#define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) + + +void +Dot11d_Init( + struct ieee80211_device *dev + ); + +void +Dot11d_Reset( + struct ieee80211_device *dev + ); + +void +Dot11d_UpdateCountryIe( + struct ieee80211_device *dev, + u8 *pTaddr, + u16 CoutryIeLen, + u8 *pCoutryIe + ); + +u8 +DOT11D_GetMaxTxPwrInDbm( + struct ieee80211_device *dev, + u8 Channel + ); + +void +DOT11D_ScanComplete( + struct ieee80211_device *dev + ); + +int IsLegalChannel( + struct ieee80211_device *dev, + u8 channel +); + +int ToLegalChannel( + struct ieee80211_device *dev, + u8 channel +); +#endif /* #ifndef __INC_DOT11D_H */ diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.h b/drivers/staging/rtl8192u/ieee80211/dot11d.h index bd75e29..6aa8c15 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.h +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.h @@ -4,43 +4,42 @@ #include "ieee80211.h" +//#define DOT11D_MAX_CHNL_NUM 83 + typedef struct _CHNL_TXPOWER_TRIPLE { u8 FirstChnl; u8 NumChnls; u8 MaxTxPowerInDbm; -} CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; +}CHNL_TXPOWER_TRIPLE, *PCHNL_TXPOWER_TRIPLE; typedef enum _DOT11D_STATE { DOT11D_STATE_NONE = 0, DOT11D_STATE_LEARNED, DOT11D_STATE_DONE, -} DOT11D_STATE; +}DOT11D_STATE; typedef struct _RT_DOT11D_INFO { - /* DECLARE_RT_OBJECT(RT_DOT11D_INFO); */ + //DECLARE_RT_OBJECT(RT_DOT11D_INFO); - bool bEnabled; /* dot11MultiDomainCapabilityEnabled */ + bool bEnabled; // dot11MultiDomainCapabilityEnabled - u16 CountryIeLen; /* > 0 if CountryIeBuf[] contains valid country information element. */ + u16 CountryIeLen; // > 0 if CountryIeBuf[] contains valid country information element. u8 CountryIeBuf[MAX_IE_LEN]; - u8 CountryIeSrcAddr[6]; /* Source AP of the country IE. */ + u8 CountryIeSrcAddr[6]; // Source AP of the country IE. u8 CountryIeWatchdog; - u8 channel_map[MAX_CHANNEL_NUMBER+1]; /* !Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) */ + u8 channel_map[MAX_CHANNEL_NUMBER+1]; //!!!Value 0: Invalid, 1: Valid (active scan), 2: Valid (passive scan) + //u8 ChnlListLen; // #Bytes valid in ChnlList[]. + //u8 ChnlList[DOT11D_MAX_CHNL_NUM]; u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; DOT11D_STATE State; -} RT_DOT11D_INFO, *PRT_DOT11D_INFO; -#define eqMacAddr(a, b) (((a)[0] == (b)[0] && \ - (a)[1] == (b)[1] && (a)[2] == (b)[2] && (a)[3] == (b)[3] && \ - (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0) -#define cpMacAddr(des, src) ((des)[0] = (src)[0], \ - (des)[1] = (src)[1], (des)[2] = (src)[2], \ - (des)[3] = (src)[3], (des)[4] = (src)[4], \ - (des)[5] = (src)[5]) +}RT_DOT11D_INFO, *PRT_DOT11D_INFO; +#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 ) +#define cpMacAddr(des,src) ((des)[0]=(src)[0],(des)[1]=(src)[1],(des)[2]=(src)[2],(des)[3]=(src)[3],(des)[4]=(src)[4],(des)[5]=(src)[5]) #define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO)((__pIeeeDev)->pDot11dInfo)) -#define IS_DOT11D_ENABLE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->bEnabled) +#define IS_DOT11D_ENABLE(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->bEnabled #define IS_COUNTRY_IE_VALID(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) @@ -52,9 +51,9 @@ typedef struct _RT_DOT11D_INFO { (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, (__Ie).Octet, (__Ie).Length))) #define CIE_WATCHDOG_TH 1 -#define GET_CIE_WATCHDOG(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) +#define GET_CIE_WATCHDOG(__pIeeeDev) GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog #define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 -#define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) +#define UPDATE_CIE_WATCHDOG(__pIeeeDev) ++GET_CIE_WATCHDOG(__pIeeeDev) #define IS_DOT11D_STATE_DONE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) @@ -73,7 +72,7 @@ void Dot11d_UpdateCountryIe( struct ieee80211_device *dev, u8 *pTaddr, - u16 CoutryIeLen, + u16 CoutryIeLen, u8 *pCoutryIe ); @@ -97,4 +96,4 @@ int ToLegalChannel( struct ieee80211_device *dev, u8 channel ); -#endif /* #ifndef __INC_DOT11D_H */ +#endif // #ifndef __INC_DOT11D_H diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 4b036a8..434c431 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -241,7 +241,7 @@ static int debug = \ //IEEE80211_DL_DATA | IEEE80211_DL_ERR //awayls open this flags to show error out ; -static struct proc_dir_entry *ieee80211_proc; +struct proc_dir_entry *ieee80211_proc; static int show_debug_level(struct seq_file *m, void *v) { diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index e730ed6..59900bf 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -2166,8 +2166,7 @@ static inline u8 ieee80211_SignalStrengthTranslate( return RetSS; } -/* 0-100 index */ -static long ieee80211_translate_todbm(u8 signal_strength_index) +long ieee80211_translate_todbm(u8 signal_strength_index )// 0-100 index. { long signal_power; // in dBm. diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 662c7e4..5fd6969 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -3150,9 +3150,14 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin goto out; } - param = memdup_user(p->pointer, p->length); - if (IS_ERR(param)) { - ret = PTR_ERR(param); + param = kmalloc(p->length, GFP_KERNEL); + if (param == NULL){ + ret = -ENOMEM; + goto out; + } + if (copy_from_user(param, p->pointer, p->length)) { + kfree(param); + ret = -EFAULT; goto out; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 157b2d7..a7bcc64f 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -237,8 +237,8 @@ void ieee80211_txb_free(struct ieee80211_txb *txb) { kfree(txb); } -static struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, - gfp_t gfp_mask) +struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size, + int gfp_mask) { struct ieee80211_txb *txb; int i; @@ -303,8 +303,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network) } #define SN_LESS(a, b) (((a-b)&0x800)!=0) -static void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, - struct sk_buff *skb, cb_desc *tcb_desc) +void ieee80211_tx_query_agg_cap(struct ieee80211_device *ieee, struct sk_buff *skb, cb_desc *tcb_desc) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; PTX_TS_RECORD pTxTs = NULL; @@ -413,8 +412,7 @@ ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, cb_desc *tcb_desc) tcb_desc->bUseShortGI = true; } -static void ieee80211_query_BandwidthMode(struct ieee80211_device *ieee, - cb_desc *tcb_desc) +void ieee80211_query_BandwidthMode(struct ieee80211_device *ieee, cb_desc *tcb_desc) { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; @@ -434,9 +432,7 @@ static void ieee80211_query_BandwidthMode(struct ieee80211_device *ieee, return; } -static void ieee80211_query_protectionmode(struct ieee80211_device *ieee, - cb_desc *tcb_desc, - struct sk_buff *skb) +void ieee80211_query_protectionmode(struct ieee80211_device *ieee, cb_desc *tcb_desc, struct sk_buff *skb) { // Common Settings tcb_desc->bRTSSTBC = false; @@ -547,8 +543,7 @@ NO_PROTECTION: } -static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, - cb_desc *tcb_desc) +void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, cb_desc *tcb_desc) { #ifdef TO_DO_LIST if(!IsDataFrame(pFrame)) @@ -578,8 +573,7 @@ static void ieee80211_txrate_selectmode(struct ieee80211_device *ieee, } } -static void ieee80211_query_seqnum(struct ieee80211_device *ieee, - struct sk_buff *skb, u8 *dst) +void ieee80211_query_seqnum(struct ieee80211_device *ieee, struct sk_buff *skb, u8 *dst) { if (is_multicast_ether_addr(dst)) return; diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 3684da3..db0db93 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -251,8 +251,7 @@ static struct sk_buff *ieee80211_DELBA( * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does ********************************************************************************************************************/ -static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, - u8 *dst, PBA_RECORD pBA) +void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA) { struct sk_buff *skb = NULL; skb = ieee80211_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); //construct ACT_ADDBAREQ frames so set statuscode zero. @@ -279,8 +278,7 @@ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, * output: none * notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does ********************************************************************************************************************/ -static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, - PBA_RECORD pBA, u16 StatusCode) +void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, u16 StatusCode) { struct sk_buff *skb = NULL; skb = ieee80211_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); //construct ACT_ADDBARSP frames diff --git a/drivers/staging/rtl8192u/ieee80211_crypt.h b/drivers/staging/rtl8192u/ieee80211_crypt.h new file mode 100644 index 0000000..0b4ea43 --- /dev/null +++ b/drivers/staging/rtl8192u/ieee80211_crypt.h @@ -0,0 +1,86 @@ +/* + * Original code based on Host AP (software wireless LAN access point) driver + * for Intersil Prism2/2.5/3. + * + * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen + * <jkmaline@cc.hut.fi> + * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> + * + * Adaption to a generic IEEE 802.11 stack by James Ketrenos + * <jketreno@linux.intel.com> + * + * Copyright (c) 2004, Intel Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. See README and COPYING for + * more details. + */ + +/* + * This file defines the interface to the ieee80211 crypto module. + */ +#ifndef IEEE80211_CRYPT_H +#define IEEE80211_CRYPT_H + +#include <linux/skbuff.h> + +struct ieee80211_crypto_ops { + const char *name; + + /* init new crypto context (e.g., allocate private data space, + * select IV, etc.); returns NULL on failure or pointer to allocated + * private data on success */ + void * (*init)(int keyidx); + + /* deinitialize crypto context and free allocated private data */ + void (*deinit)(void *priv); + + /* encrypt/decrypt return < 0 on error or >= 0 on success. The return + * value from decrypt_mpdu is passed as the keyidx value for + * decrypt_msdu. skb must have enough head and tail room for the + * encryption; if not, error will be returned; these functions are + * called for all MPDUs (i.e., fragments). + */ + int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); + int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); + + /* These functions are called for full MSDUs, i.e. full frames. + * These can be NULL if full MSDU operations are not needed. */ + int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); + int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, + void *priv); + + int (*set_key)(void *key, int len, u8 *seq, void *priv); + int (*get_key)(void *key, int len, u8 *seq, void *priv); + + /* procfs handler for printing out key information and possible + * statistics */ + char * (*print_stats)(char *p, void *priv); + + /* maximum number of bytes added by encryption; encrypt buf is + * allocated with extra_prefix_len bytes, copy of in_buf, and + * extra_postfix_len; encrypt need not use all this space, but + * the result must start at the beginning of the buffer and correct + * length must be returned */ + int extra_prefix_len, extra_postfix_len; + + struct module *owner; +}; + +struct ieee80211_crypt_data { + struct list_head list; /* delayed deletion list */ + struct ieee80211_crypto_ops *ops; + void *priv; + atomic_t refcnt; +}; + +int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); +int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); +struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); +void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); +void ieee80211_crypt_deinit_handler(unsigned long); +void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, + struct ieee80211_crypt_data **crypt); + +#endif diff --git a/drivers/staging/rtl8192u/r8180_pm.c b/drivers/staging/rtl8192u/r8180_pm.c new file mode 100644 index 0000000..999968d --- /dev/null +++ b/drivers/staging/rtl8192u/r8180_pm.c @@ -0,0 +1,48 @@ +/* + Power management interface routines. + Written by Mariusz Matuszek. + This code is currently just a placeholder for later work and + does not do anything useful. + + This is part of rtl8180 OpenSource driver. + Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> + Released under the terms of GPL (General Public Licence) +*/ + +#ifdef CONFIG_RTL8180_PM + + +#include "r8180_hw.h" +#include "r8180_pm.h" + +int rtl8180_save_state (struct pci_dev *dev, u32 state) +{ + printk(KERN_NOTICE "r8180 save state call (state %u).\n", state); + return(-EAGAIN); +} + + +int rtl8180_suspend (struct pci_dev *dev, u32 state) +{ + printk(KERN_NOTICE "r8180 suspend call (state %u).\n", state); + return(-EAGAIN); +} + + +int rtl8180_resume (struct pci_dev *dev) +{ + printk(KERN_NOTICE "r8180 resume call.\n"); + return(-EAGAIN); +} + + +int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable) +{ + printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n", + state, enable); + return(-EAGAIN); +} + + + +#endif //CONFIG_RTL8180_PM diff --git a/drivers/staging/rtl8192u/r8180_pm.h b/drivers/staging/rtl8192u/r8180_pm.h new file mode 100644 index 0000000..4be63da --- /dev/null +++ b/drivers/staging/rtl8192u/r8180_pm.h @@ -0,0 +1,28 @@ +/* + Power management interface routines. + Written by Mariusz Matuszek. + This code is currently just a placeholder for later work and + does not do anything useful. + + This is part of rtl8180 OpenSource driver. + Copyright (C) Andrea Merello 2004 <andrea.merello@gmail.com> + Released under the terms of GPL (General Public Licence) + +*/ + +#ifdef CONFIG_RTL8180_PM + +#ifndef R8180_PM_H +#define R8180_PM_H + +#include <linux/types.h> +#include <linux/pci.h> + +int rtl8180_save_state (struct pci_dev *dev, u32 state); +int rtl8180_suspend (struct pci_dev *dev, u32 state); +int rtl8180_resume (struct pci_dev *dev); +int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable); + +#endif //R8180_PM_H + +#endif // CONFIG_RTL8180_PM diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index fa6dd37..592e780 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -13,7 +13,11 @@ #ifndef RTL8225H #define RTL8225H +#ifdef RTL8190P +#define RTL819X_TOTAL_RF_PATH 4 //for 90P +#else #define RTL819X_TOTAL_RF_PATH 2 //for 8192U +#endif extern void PHY_SetRF8256Bandwidth(struct net_device *dev , HT_CHANNEL_WIDTH Bandwidth); extern void PHY_RF8256_Config(struct net_device *dev); extern void phy_RF8256_Config_ParaFile(struct net_device *dev); diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h index ad3bc56..b484ee1 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -409,11 +409,15 @@ typedef struct rx_drvinfo_819x_usb { #define USB_HWDESC_HEADER_LEN sizeof(tx_desc_819x_usb) #define TX_PACKET_SHIFT_BYTES (USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb)) #define MAX_FRAGMENT_COUNT 8 +#ifdef RTL8192U #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE #define MAX_TRANSMIT_BUFFER_SIZE 32000 #else #define MAX_TRANSMIT_BUFFER_SIZE 8000 #endif +#else +#define MAX_TRANSMIT_BUFFER_SIZE (1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT) +#endif #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE #define TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES (sizeof(tx_desc_819x_usb_aggr_subframe) + sizeof(tx_fwinfo_819x_usb)) #endif @@ -1154,6 +1158,14 @@ typedef enum { NIC_8192E = 3, } nic_t; + +#ifdef JOHN_HWSEC +struct ssid_thread { + struct net_device *dev; + u8 name[IW_ESSID_MAX_SIZE + 1]; +}; +#endif + bool init_firmware(struct net_device *dev); short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb); short rtl8192_tx(struct net_device *dev, struct sk_buff *skb); diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index c2bcbe2..cd0946d 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -392,7 +392,7 @@ int read_nic_word(struct net_device *dev, int indx, u16 *data) return 0; } -static int read_nic_word_E(struct net_device *dev, int indx, u16 *data) +int read_nic_word_E(struct net_device *dev, int indx, u16 *data) { int status; struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); @@ -585,7 +585,7 @@ static int proc_get_stats_rx(struct seq_file *m, void *v) return 0; } -static void rtl8192_proc_module_init(void) +void rtl8192_proc_module_init(void) { RT_TRACE(COMP_INIT, "Initializing proc filesystem"); rtl8192_proc = proc_mkdir(RTL819xU_MODULE_NAME, init_net.proc_net); @@ -631,7 +631,7 @@ static const struct rtl8192_proc_file rtl8192_proc_files[] = { { "" } }; -static void rtl8192_proc_init_one(struct net_device *dev) +void rtl8192_proc_init_one(struct net_device *dev) { const struct rtl8192_proc_file *f; struct proc_dir_entry *dir; @@ -656,7 +656,7 @@ static void rtl8192_proc_init_one(struct net_device *dev) } } -static void rtl8192_proc_remove_one(struct net_device *dev) +void rtl8192_proc_remove_one(struct net_device *dev) { remove_proc_subtree(dev->name, rtl8192_proc); } @@ -755,7 +755,7 @@ void rtl8192_set_chan(struct net_device *dev, short ch) static void rtl8192_rx_isr(struct urb *urb); -static u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) +u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) { #ifdef USB_RX_AGGREGATION_SUPPORT @@ -998,8 +998,8 @@ static void rtl8192_rx_isr(struct urb *urb) netdev_err(dev, "can not submit rxurb, err is %x, URB status is %x\n", err, urb->status); } -static u32 rtl819xusb_rx_command_packet(struct net_device *dev, - struct ieee80211_rx_stats *pstats) +u32 rtl819xusb_rx_command_packet(struct net_device *dev, + struct ieee80211_rx_stats *pstats) { u32 status; @@ -1609,6 +1609,13 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) #else idx_pipe = 0x04; #endif +#ifdef JOHN_DUMP_TXDESC + int i; + printk("<Tx descriptor>--rate %x---", rate); + for (i = 0; i < 8; i++) + printk("%8x ", tx[i]); + printk("\n"); +#endif usb_fill_bulk_urb(tx_urb, priv->udev, usb_sndbulkpipe(priv->udev, idx_pipe), skb->data, skb->len, rtl8192_tx_isr, skb); @@ -1629,7 +1636,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) * * \param QUEUEID Software Queue */ -static u8 MapHwQueueToFirmwareQueue(u8 QueueID) +u8 MapHwQueueToFirmwareQueue(u8 QueueID) { u8 QueueSelect = 0x0; //defualt set to @@ -1716,7 +1723,7 @@ u8 MRateToHwRate8190Pci(u8 rate) } -static u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) +u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc) { u8 tmp_Short; @@ -1927,7 +1934,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) } } -static short rtl8192_usb_initendpoints(struct net_device *dev) +short rtl8192_usb_initendpoints(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -1985,7 +1992,7 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) } #ifdef THOMAS_BEACON -static void rtl8192_usb_deleteendpoints(struct net_device *dev) +void rtl8192_usb_deleteendpoints(struct net_device *dev) { int i; struct r8192_priv *priv = ieee80211_priv(dev); @@ -2002,7 +2009,7 @@ static void rtl8192_usb_deleteendpoints(struct net_device *dev) priv->oldaddr = NULL; if (priv->pp_rxskb) { kfree(priv->pp_rxskb); - priv->pp_rxskb = NULL; + priv->pp_rxskb = 0; } } #else @@ -2285,7 +2292,7 @@ void rtl8192_update_ratr_table(struct net_device *dev) static u8 ccmp_ie[4] = {0x00, 0x50, 0xf2, 0x04}; static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; -static bool GetNmodeSupportBySecCfg8192(struct net_device *dev) +bool GetNmodeSupportBySecCfg8192(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device *ieee = priv->ieee80211; @@ -3160,7 +3167,7 @@ static struct net_device_stats *rtl8192_stats(struct net_device *dev) return &priv->ieee80211->stats; } -static bool HalTxCheckStuck819xUsb(struct net_device *dev) +bool HalTxCheckStuck819xUsb(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); u16 RegTxCounter; @@ -3210,7 +3217,7 @@ RESET_TYPE TxCheckStuck(struct net_device *dev) return RESET_TYPE_NORESET; } -static bool HalRxCheckStuck819xUsb(struct net_device *dev) +bool HalRxCheckStuck819xUsb(struct net_device *dev) { u16 RegRxCounter; struct r8192_priv *priv = ieee80211_priv(dev); @@ -3252,7 +3259,7 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev) return bStuck; } -static RESET_TYPE RxCheckStuck(struct net_device *dev) +RESET_TYPE RxCheckStuck(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); bool bRxCheck = FALSE; @@ -3789,9 +3796,14 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) goto out; } - ipw = memdup_user(p->pointer, p->length); - if (IS_ERR(ipw)) { - ret = PTR_ERR(ipw); + ipw = kmalloc(p->length, GFP_KERNEL); + if (ipw == NULL) { + ret = -ENOMEM; + goto out; + } + if (copy_from_user(ipw, p->pointer, p->length)) { + kfree(ipw); + ret = -EFAULT; goto out; } @@ -3847,6 +3859,15 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) } } } +#ifdef JOHN_HWSEC_DEBUG + //john's test 0711 + printk("@@ wrq->u pointer = "); + for (i = 0; i < wrq->u.data.length; i++) { + if (i%10 == 0) printk("\n"); + printk("%8x|", ((u32 *)wrq->u.data.pointer)[i]); + } + printk("\n"); +#endif /*JOHN_HWSEC_DEBUG*/ ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data); break; @@ -3931,8 +3952,7 @@ u8 HwRateToMRate90(bool bIsHT, u8 rate) * Return: * None */ -static void UpdateRxPktTimeStamp8190(struct net_device *dev, - struct ieee80211_rx_stats *stats) +void UpdateRxPktTimeStamp8190(struct net_device *dev, struct ieee80211_rx_stats *stats) { struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); @@ -4189,7 +4209,7 @@ static u8 rtl819x_evm_dbtopercentage(char value) // We want good-looking for signal strength/quality // 2007/7/19 01:09, by cosa. // -static long rtl819x_signal_scale_mapping(long currsig) +long rtl819x_signal_scale_mapping(long currsig) { long retsig; @@ -4458,9 +4478,9 @@ void rtl8192_record_rxdesc_forlateruse(struct ieee80211_rx_stats *psrc_stats, } -static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, - struct ieee80211_rx_stats *pstats, - rx_drvinfo_819x_usb *pdrvinfo) +void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, + struct ieee80211_rx_stats *pstats, + rx_drvinfo_819x_usb *pdrvinfo) { // TODO: We must only check packet for current MAC address. Not finish rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; @@ -4529,9 +4549,8 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, * Return: * None */ -static void -UpdateReceivedRateHistogramStatistics8190(struct net_device *dev, - struct ieee80211_rx_stats *stats) +void UpdateReceivedRateHistogramStatistics8190(struct net_device *dev, + struct ieee80211_rx_stats *stats) { struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); u32 rcvType = 1; //0: Total, 1:OK, 2:CRC, 3:ICV @@ -4595,9 +4614,7 @@ UpdateReceivedRateHistogramStatistics8190(struct net_device *dev, } -static void query_rxdesc_status(struct sk_buff *skb, - struct ieee80211_rx_stats *stats, - bool bIsRxAggrSubframe) +void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats, bool bIsRxAggrSubframe) { rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb; struct net_device *dev = info->dev; @@ -4913,8 +4930,7 @@ void rtl819xusb_process_received_packet(struct net_device *dev, } -static void query_rx_cmdpkt_desc_status(struct sk_buff *skb, - struct ieee80211_rx_stats *stats) +void query_rx_cmdpkt_desc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats) { rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 41fb67b..a6e4c37 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -100,6 +100,14 @@ static void dm_check_txpower_tracking(struct net_device *dev); //static void dm_txpower_reset_recovery(struct net_device *dev); +// DM --> BB init gain restore +#ifndef RTL8192U +static void dm_bb_initialgain_restore(struct net_device *dev); + + +// DM --> BB init gain backup +static void dm_bb_initialgain_backup(struct net_device *dev); +#endif // DM --> Dynamic Init Gain by RSSI static void dm_dig_init(struct net_device *dev); static void dm_ctrl_initgain_byrssi(struct net_device *dev); @@ -114,7 +122,12 @@ static void dm_init_ctstoself(struct net_device *dev); // DM --> EDCA turbo mode control static void dm_check_edca_turbo(struct net_device *dev); +// DM --> HW RF control +static void dm_check_rfctrl_gpio(struct net_device *dev); + +#ifndef RTL8190P //static void dm_gpio_change_rf(struct net_device *dev); +#endif // DM --> Check PBC static void dm_check_pbc_gpio(struct net_device *dev); @@ -256,6 +269,7 @@ extern void hal_dm_watchdog(struct net_device *dev) dm_ctrl_initgain_byrssi(dev); dm_check_edca_turbo(dev); dm_bandwidth_autoswitch(dev); + dm_check_rfctrl_gpio(dev); dm_check_rx_path_selection(dev); dm_check_fsync(dev); @@ -606,11 +620,16 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING; tx_cmd.Length = 4; tx_cmd.Value = Value; +#ifdef RTL8192U rtStatus = SendTxCommandPacket(dev, &tx_cmd, 12); if (rtStatus == RT_STATUS_FAILURE) { RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n"); } +#else + cmpk_message_handle_tx(dev, (u8 *)&tx_cmd, + DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T)); +#endif mdelay(1); //DbgPrint("hi, vivi, strange\n"); for(i = 0;i <= 30; i++) @@ -622,7 +641,11 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) mdelay(1); continue; } +#ifdef RTL8190P + read_nic_word(dev, 0x1bc, &Avg_TSSI_Meas); +#else read_nic_word(dev, 0x13c, &Avg_TSSI_Meas); +#endif if(Avg_TSSI_Meas == 0) { write_nic_byte(dev, 0x1ba, 0); @@ -631,10 +654,14 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) for(k = 0;k < 5; k++) { +#ifdef RTL8190P + read_nic_byte(dev, 0x1d8+k, &tmp_report[k]); +#else if(k !=4) read_nic_byte(dev, 0x134+k, &tmp_report[k]); else read_nic_byte(dev, 0x13e, &tmp_report[k]); +#endif RT_TRACE(COMP_POWER_TRACKING, "TSSI_report_value = %d\n", tmp_report[k]); } @@ -681,6 +708,10 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) RT_TRACE(COMP_POWER_TRACKING, "tx power track is done\n"); RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex); RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex_real = %d\n", priv->rfa_txpowertrackingindex_real); +#ifdef RTL8190P + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex = %d\n", priv->rfc_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex_real = %d\n", priv->rfc_txpowertrackingindex_real); +#endif RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference); RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation); return; @@ -689,7 +720,11 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) { if(Avg_TSSI_Meas_from_driver < TSSI_13dBm - E_FOR_TX_POWER_TRACK) { - if (priv->rfa_txpowertrackingindex > 0) + if((priv->rfa_txpowertrackingindex > 0) +#ifdef RTL8190P + &&(priv->rfc_txpowertrackingindex > 0) +#endif + ) { priv->rfa_txpowertrackingindex--; if(priv->rfa_txpowertrackingindex_real > 4) @@ -697,16 +732,33 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) priv->rfa_txpowertrackingindex_real--; rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); } +#ifdef RTL8190P + priv->rfc_txpowertrackingindex--; + if(priv->rfc_txpowertrackingindex_real > 4) + { + priv->rfc_txpowertrackingindex_real--; + rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); + } +#endif } } else { - if (priv->rfa_txpowertrackingindex < 36) + if((priv->rfa_txpowertrackingindex < 36) +#ifdef RTL8190P + &&(priv->rfc_txpowertrackingindex < 36) +#endif + ) { priv->rfa_txpowertrackingindex++; priv->rfa_txpowertrackingindex_real++; rtl8192_setBBreg(dev, rOFDM0_XATxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfa_txpowertrackingindex_real].txbbgain_value); +#ifdef RTL8190P + priv->rfc_txpowertrackingindex++; + priv->rfc_txpowertrackingindex_real++; + rtl8192_setBBreg(dev, rOFDM0_XCTxIQImbalance, bMaskDWord, priv->txbbgain_table[priv->rfc_txpowertrackingindex_real].txbbgain_value); +#endif } } priv->cck_present_attentuation_difference @@ -736,6 +788,10 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) } RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex = %d\n", priv->rfa_txpowertrackingindex); RT_TRACE(COMP_POWER_TRACKING, "priv->rfa_txpowertrackingindex_real = %d\n", priv->rfa_txpowertrackingindex_real); +#ifdef RTL8190P + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex = %d\n", priv->rfc_txpowertrackingindex); + RT_TRACE(COMP_POWER_TRACKING, "priv->rfc_txpowertrackingindex_real = %d\n", priv->rfc_txpowertrackingindex_real); +#endif RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation_difference = %d\n", priv->cck_present_attentuation_difference); RT_TRACE(COMP_POWER_TRACKING, "priv->cck_present_attentuation = %d\n", priv->cck_present_attentuation); @@ -881,10 +937,14 @@ extern void dm_txpower_trackingcallback(struct work_struct *work) struct r8192_priv *priv = container_of(dwork,struct r8192_priv,txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; +#ifdef RTL8190P + dm_TXPowerTrackingCallback_TSSI(dev); +#else if(priv->bDcut == TRUE) dm_TXPowerTrackingCallback_TSSI(dev); else dm_TXPowerTrackingCallback_ThermalMeter(dev); +#endif } @@ -1412,10 +1472,14 @@ static void dm_InitializeTXPowerTracking_ThermalMeter(struct net_device *dev) void dm_initialize_txpower_tracking(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef RTL8190P + dm_InitializeTXPowerTracking_TSSI(dev); +#else if(priv->bDcut == TRUE) dm_InitializeTXPowerTracking_TSSI(dev); else dm_InitializeTXPowerTracking_ThermalMeter(dev); +#endif }// dm_InitializeTXPowerTracking @@ -1613,10 +1677,14 @@ extern void dm_cck_txpower_adjust( { // dm_CCKTxPowerAdjust struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef RTL8190P + dm_CCKTxPowerAdjust_TSSI(dev, binch14); +#else if(priv->bDcut == TRUE) dm_CCKTxPowerAdjust_TSSI(dev, binch14); else dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14); +#endif } @@ -2126,7 +2194,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( { /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + #endif /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(pAdapter, rOFDM0_RxDetector1, 0x40); */ @@ -2193,7 +2265,11 @@ static void dm_ctrl_initgain_byrssi_by_fwfalse_alarm( { /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #endif /* else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); @@ -2266,7 +2342,11 @@ static void dm_ctrl_initgain_byrssi_highpwr( // 3.1 Higher PD_TH for OFDM for high power state. if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + #endif /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); @@ -2290,7 +2370,11 @@ static void dm_ctrl_initgain_byrssi_highpwr( // 3.2 Recover PD_TH for OFDM for normal power region. if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #endif /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); */ @@ -2432,7 +2516,11 @@ static void dm_pd_th( { /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x00); + #endif /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(dev, rOFDM0_RxDetector1, 0x40); */ @@ -2447,7 +2535,11 @@ static void dm_pd_th( { /* 2008/01/11 MH 40MHZ 90/92 register are not the same. */ // 2008/02/05 MH SD3-Jerry 92U/92E PD_TH are the same. - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x20); + #endif /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(dev, rOFDM0_RxDetector1, 0x42); */ @@ -2460,7 +2552,11 @@ static void dm_pd_th( // Higher PD_TH for OFDM for high power state. if (priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20) { - write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); + #else + write_nic_byte(dev, (rOFDM0_XATxAFE+3), 0x10); + #endif /*else if (priv->card_8192 == HARDWARE_TYPE_RTL8190P) write_nic_byte(dev, rOFDM0_RxDetector1, 0x41); */ @@ -2727,6 +2823,44 @@ static void dm_ctstoself(struct net_device *dev) } } + +/*----------------------------------------------------------------------------- + * Function: dm_check_rfctrl_gpio() + * + * Overview: Copy 8187B template for 9xseries. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/28/2008 amy Create Version 0 porting from windows code. + * + *---------------------------------------------------------------------------*/ +static void dm_check_rfctrl_gpio(struct net_device *dev) +{ + //struct r8192_priv *priv = ieee80211_priv(dev); + + // Work around for DTM test, we will not enable HW - radio on/off because r/w + // page 1 register before extra bus is enabled causing system failures when resuming + // from S4. 20080218, Emily + + // Stop to execute workitem to prevent S3/S4 bug. +#ifdef RTL8190P + return; +#endif +#ifdef RTL8192U + return; +#endif +#ifdef RTL8192E + queue_delayed_work(priv->priv_wq,&priv->gpio_change_rf_wq,0); +#endif + +} /* dm_CheckRfCtrlGPIO */ + /*----------------------------------------------------------------------------- * Function: dm_check_pbc_gpio() * @@ -2745,6 +2879,7 @@ static void dm_ctstoself(struct net_device *dev) *---------------------------------------------------------------------------*/ static void dm_check_pbc_gpio(struct net_device *dev) { +#ifdef RTL8192U struct r8192_priv *priv = ieee80211_priv(dev); u8 tmp1byte; @@ -2760,9 +2895,83 @@ static void dm_check_pbc_gpio(struct net_device *dev) RT_TRACE(COMP_IO, "CheckPbcGPIO - PBC is pressed\n"); priv->bpbc_pressed = true; } +#endif } +#ifdef RTL8192E + +/*----------------------------------------------------------------------------- + * Function: dm_GPIOChangeRF + * Overview: PCI will not support workitem call back HW radio on-off control. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 02/21/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ +extern void dm_gpio_change_rf_callback(struct work_struct *work) +{ + struct delayed_work *dwork = container_of(work,struct delayed_work,work); + struct r8192_priv *priv = container_of(dwork,struct r8192_priv,gpio_change_rf_wq); + struct net_device *dev = priv->ieee80211->dev; + u8 tmp1byte; + RT_RF_POWER_STATE eRfPowerStateToSet; + bool bActuallySet = false; + + do{ + bActuallySet=false; + + if(!priv->up) + { + RT_TRACE((COMP_INIT | COMP_POWER | COMP_RF),"dm_gpio_change_rf_callback(): Callback function breaks out!!\n"); + } + else + { + // 0x108 GPIO input register is read only + //set 0x108 B1= 1: RF-ON; 0: RF-OFF. + read_nic_byte(dev, GPI, &tmp1byte); + + eRfPowerStateToSet = (tmp1byte&BIT1) ? eRfOn : eRfOff; + + if((priv->bHwRadioOff == true) && (eRfPowerStateToSet == eRfOn)) + { + RT_TRACE(COMP_RF, "gpiochangeRF - HW Radio ON\n"); + + priv->bHwRadioOff = false; + bActuallySet = true; + } + else if ((priv->bHwRadioOff == false) && (eRfPowerStateToSet == eRfOff)) + { + RT_TRACE(COMP_RF, "gpiochangeRF - HW Radio OFF\n"); + priv->bHwRadioOff = true; + bActuallySet = true; + } + + if(bActuallySet) + { + #ifdef TO_DO + MgntActSet_RF_State(dev, eRfPowerStateToSet, RF_CHANGE_BY_HW); + //DrvIFIndicateCurrentPhyStatus(pAdapter); + #endif + } + else + { + msleep(2000); + } + + } + }while(TRUE) + +} /* dm_GPIOChangeRF */ + +#endif /*----------------------------------------------------------------------------- * Function: DM_RFPathCheckWorkItemCallBack() * @@ -3120,7 +3329,11 @@ static void dm_init_fsync (struct net_device *dev) priv->ieee80211->fsync_time_interval = 500; priv->ieee80211->fsync_rate_bitmap = 0x0f000800; priv->ieee80211->fsync_rssi_threshold = 30; +#ifdef RTL8190P + priv->ieee80211->bfsync_enable = true; +#else priv->ieee80211->bfsync_enable = false; +#endif priv->ieee80211->fsync_multiple_timeinterval = 3; priv->ieee80211->fsync_firstdiff_ratethreshold= 100; priv->ieee80211->fsync_seconddiff_ratethreshold= 200; @@ -3203,12 +3416,20 @@ extern void dm_fsync_timer_callback(unsigned long data) priv->bswitch_fsync = !priv->bswitch_fsync; if(priv->bswitch_fsync) { + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x00); + #else write_nic_byte(dev,0xC36, 0x1c); + #endif write_nic_byte(dev, 0xC3e, 0x90); } else { + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else write_nic_byte(dev, 0xC36, 0x5c); + #endif write_nic_byte(dev, 0xC3e, 0x96); } } @@ -3217,7 +3438,11 @@ extern void dm_fsync_timer_callback(unsigned long data) if(priv->bswitch_fsync) { priv->bswitch_fsync = false; + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else write_nic_byte(dev, 0xC36, 0x5c); + #endif write_nic_byte(dev, 0xC3e, 0x96); } } @@ -3240,11 +3465,19 @@ extern void dm_fsync_timer_callback(unsigned long data) if(priv->bswitch_fsync) { priv->bswitch_fsync = false; + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else write_nic_byte(dev, 0xC36, 0x5c); + #endif write_nic_byte(dev, 0xC3e, 0x96); } priv->ContinueDiffCount = 0; + #ifdef RTL8190P + write_nic_dword(dev, rOFDM0_RxDetector2, 0x164052cd); + #else write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); + #endif } RT_TRACE(COMP_HALDM, "ContinueDiffCount %d\n", priv->ContinueDiffCount); RT_TRACE(COMP_HALDM, "rateRecord %d rateCount %d, rateCountdiff %d bSwitchFsync %d\n", priv->rate_record, rate_count, rate_count_diff , priv->bswitch_fsync); @@ -3269,13 +3502,19 @@ static void dm_EndSWFsync(struct net_device *dev) { priv->bswitch_fsync = false; - write_nic_byte(dev, 0xC36, 0x5c); + #ifdef RTL8190P + write_nic_byte(dev, 0xC36, 0x40); + #else + write_nic_byte(dev, 0xC36, 0x5c); + #endif write_nic_byte(dev, 0xC3e, 0x96); } priv->ContinueDiffCount = 0; +#ifndef RTL8190P write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c52cd); +#endif } @@ -3314,7 +3553,9 @@ static void dm_StartSWFsync(struct net_device *dev) priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); add_timer(&priv->fsync_timer); +#ifndef RTL8190P write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); +#endif } @@ -3383,7 +3624,11 @@ void dm_check_fsync(struct net_device *dev) { if(reg_c38_State != RegC38_Fsync_AP_BCM) { //For broadcom AP we write different default value - write_nic_byte(dev, rOFDM0_RxDetector3, 0x95); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector3, 0x15); + #else + write_nic_byte(dev, rOFDM0_RxDetector3, 0x95); + #endif reg_c38_State = RegC38_Fsync_AP_BCM; } @@ -3414,7 +3659,11 @@ void dm_check_fsync(struct net_device *dev) { if(reg_c38_State != RegC38_NonFsync_Other_AP) { - write_nic_byte(dev, rOFDM0_RxDetector3, 0x90); + #ifdef RTL8190P + write_nic_byte(dev, rOFDM0_RxDetector3, 0x10); + #else + write_nic_byte(dev, rOFDM0_RxDetector3, 0x90); + #endif reg_c38_State = RegC38_NonFsync_Other_AP; } @@ -3596,8 +3845,10 @@ static void dm_dynamic_txpower(struct net_device *dev) SetTxPowerLevel8190(Adapter,pHalData->CurrentChannel); #endif +#ifdef RTL8192U rtl8192_phy_setTxPower(dev,priv->ieee80211->current_network.channel); //pHalData->bStartTxCtrlByTPCNFR = FALSE; //Clear th flag of Set TX Power from Sitesurvey +#endif } priv->bLastDTPFlag_High = priv->bDynamicTxHighPower; priv->bLastDTPFlag_Low = priv->bDynamicTxLowPower; @@ -3634,6 +3885,9 @@ static void dm_send_rssi_tofw(struct net_device *dev) tx_cmd.Op = TXCMD_SET_RX_RSSI; tx_cmd.Length = 4; tx_cmd.Value = priv->undecorated_smoothed_pwdb; + + cmpk_message_handle_tx(dev, (u8 *)&tx_cmd, + DESC_PACKET_TYPE_INIT, sizeof(DCMD_TXCMD_T)); } /*---------------------------Define function prototype------------------------*/ diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index c70af01..61f6620 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -127,6 +127,156 @@ static int r8192_wx_get_power(struct net_device *dev, return ieee80211_wx_get_power(priv->ieee80211,info,wrqu,extra); } +#ifdef JOHN_IOCTL +u16 read_rtl8225(struct net_device *dev, u8 addr); +void write_rtl8225(struct net_device *dev, u8 adr, u16 data); +u32 john_read_rtl8225(struct net_device *dev, u8 adr); +void _write_rtl8225(struct net_device *dev, u8 adr, u16 data); + +static int r8192_wx_read_regs(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 addr; + u16 data1; + + down(&priv->wx_sem); + + + get_user(addr,(u8 *)wrqu->data.pointer); + data1 = read_rtl8225(dev, addr); + wrqu->data.length = data1; + + up(&priv->wx_sem); + return 0; + +} + +static int r8192_wx_write_regs(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 addr; + + down(&priv->wx_sem); + + get_user(addr, (u8 *)wrqu->data.pointer); + write_rtl8225(dev, addr, wrqu->data.length); + + up(&priv->wx_sem); + return 0; + +} + +void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); +u8 rtl8187_read_phy(struct net_device *dev,u8 adr, u32 data); + +static int r8192_wx_read_bb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 databb; + + down(&priv->wx_sem); + + databb = rtl8187_read_phy(dev, (u8)wrqu->data.length, 0x00000000); + wrqu->data.length = databb; + + up(&priv->wx_sem); + return 0; +} + +void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data); +static int r8192_wx_write_bb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u8 databb; + + down(&priv->wx_sem); + + get_user(databb, (u8 *)wrqu->data.pointer); + rtl8187_write_phy(dev, wrqu->data.length, databb); + + up(&priv->wx_sem); + return 0; + +} + + +static int r8192_wx_write_nicb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 addr; + + down(&priv->wx_sem); + + get_user(addr, (u32 *)wrqu->data.pointer); + write_nic_byte(dev, addr, wrqu->data.length); + + up(&priv->wx_sem); + return 0; + +} +static int r8192_wx_read_nicb(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + u32 addr; + u16 data1; + + down(&priv->wx_sem); + + get_user(addr,(u32 *)wrqu->data.pointer); + read_nic_byte(dev, addr, &data1); + wrqu->data.length = data1; + + up(&priv->wx_sem); + return 0; +} + +static int r8192_wx_get_ap_status(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); + struct ieee80211_device *ieee = priv->ieee80211; + struct ieee80211_network *target; + int name_len; + + down(&priv->wx_sem); + + //count the length of input ssid + for(name_len=0 ; ((char *)wrqu->data.pointer)[name_len]!='\0' ; name_len++); + + //search for the corresponding info which is received + list_for_each_entry(target, &ieee->network_list, list) { + if ( (target->ssid_len == name_len) && + (strncmp(target->ssid, (char *)wrqu->data.pointer, name_len)==0)){ + if(target->wpa_ie_len>0 || target->rsn_ie_len>0 ) + //set flags=1 to indicate this ap is WPA + wrqu->data.flags = 1; + else wrqu->data.flags = 0; + + + break; + } + } + + up(&priv->wx_sem); + return 0; +} + + + +#endif static int r8192_wx_force_reset(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -956,7 +1106,46 @@ static const struct iw_priv_args r8192_private_args[] = { { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" - }, + } +#ifdef JOHN_IOCTL + , + { + SIOCIWFIRSTPRIV + 0x3, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF" + } + , + { + SIOCIWFIRSTPRIV + 0x4, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF" + } + , + { + SIOCIWFIRSTPRIV + 0x5, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB" + } + , + { + SIOCIWFIRSTPRIV + 0x6, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB" + } + , + { + SIOCIWFIRSTPRIV + 0x7, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb" + } + , + { + SIOCIWFIRSTPRIV + 0x8, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb" + } + , + { + SIOCIWFIRSTPRIV + 0x9, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo" + } + +#endif + , { SIOCIWFIRSTPRIV + 0x3, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" @@ -974,6 +1163,15 @@ static iw_handler r8192_private_handler[] = { // r8192_wx_set_monitor_type, r8192_wx_set_scan_type, r8192_wx_set_rawtx, +#ifdef JOHN_IOCTL + r8192_wx_read_regs, + r8192_wx_write_regs, + r8192_wx_read_bb, + r8192_wx_write_bb, + r8192_wx_read_nicb, + r8192_wx_write_nicb, + r8192_wx_get_ap_status, +#endif //r8192_wx_null, r8192_wx_force_reset, }; diff --git a/drivers/staging/rtl8192u/r819xU_HTType.h b/drivers/staging/rtl8192u/r819xU_HTType.h index 2cbb8e6..19a7bdd 100644 --- a/drivers/staging/rtl8192u/r819xU_HTType.h +++ b/drivers/staging/rtl8192u/r819xU_HTType.h @@ -2,36 +2,41 @@ #define _R819XU_HTTYPE_H_ -/*---------------------------------------------------------------------- - * The HT Capability element is present in beacons, association request, - * reassociation request and probe response frames - *----------------------------------------------------------------------*/ - -/* Operation mode value */ +//------------------------------------------------------------ +// The HT Capability element is present in beacons, association request, +// reassociation request and probe response frames +//------------------------------------------------------------ + +// +// Operation mode value +// #define HT_OPMODE_NO_PROTECT 0 #define HT_OPMODE_OPTIONAL 1 -#define HT_OPMODE_40MHZ_PROTECT 2 +#define HT_OPMODE_40MHZ_PROTECT 2 #define HT_OPMODE_MIXED 3 -/* MIMO Power Save Settings */ -#define MIMO_PS_STATIC 0 +// +// MIMO Power Save Settings +// +#define MIMO_PS_STATIC 0 #define MIMO_PS_DYNAMIC 1 #define MIMO_PS_NOLIMIT 3 -/* There should be 128 bits to cover all of the MCS rates. However, since - * 8190 does not support too much rates, one integer is quite enough. */ +// +// There should be 128 bits to cover all of the MCS rates. However, since +// 8190 does not support too much rates, one integer is quite enough. +// -#define sHTCLng 4 +#define sHTCLng 4 -#define HT_SUPPORTED_MCS_1SS_BITMAP 0x000000ff -#define HT_SUPPORTED_MCS_2SS_BITMAP 0x0000ff00 -#define HT_SUPPORTED_MCS_1SS_2SS_BITMAP \ - (HT_MCS_1SS_BITMAP | HT_MCS_1SS_2SS_BITMAP) +#define HT_SUPPORTED_MCS_1SS_BITMAP 0x000000ff +#define HT_SUPPORTED_MCS_2SS_BITMAP 0x0000ff00 +#define HT_SUPPORTED_MCS_1SS_2SS_BITMAP HT_MCS_1SS_BITMAP|HT_MCS_1SS_2SS_BITMAP -typedef enum _HT_MCS_RATE { +typedef enum _HT_MCS_RATE{ HT_MCS0 = 0x00000001, HT_MCS1 = 0x00000002, HT_MCS2 = 0x00000004, @@ -42,67 +47,71 @@ typedef enum _HT_MCS_RATE { HT_MCS7 = 0x00000080, HT_MCS8 = 0x00000100, HT_MCS9 = 0x00000200, - HT_MCS10 = 0x00000400, - HT_MCS11 = 0x00000800, - HT_MCS12 = 0x00001000, - HT_MCS13 = 0x00002000, - HT_MCS14 = 0x00004000, - HT_MCS15 = 0x00008000, - /* Do not define MCS32 here although 8190 support MCS32 */ -} HT_MCS_RATE, *PHT_MCS_RATE; - -/* Represent Channel Width in HT Capabilities */ -typedef enum _HT_CHANNEL_WIDTH { - HT_CHANNEL_WIDTH_20 = 0, + HT_MCS10 = 0x00000400, + HT_MCS11 = 0x00000800, + HT_MCS12 = 0x00001000, + HT_MCS13 = 0x00002000, + HT_MCS14 = 0x00004000, + HT_MCS15 = 0x00008000, + // Do not define MCS32 here although 8190 support MCS32 +}HT_MCS_RATE,*PHT_MCS_RATE; + +// +// Represent Channel Width in HT Capabilities +// +typedef enum _HT_CHANNEL_WIDTH{ + HT_CHANNEL_WIDTH_20 = 0, HT_CHANNEL_WIDTH_20_40 = 1, -} HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; +}HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; -/* Represent Extension Channel Offset in HT Capabilities - * This is available only in 40Mhz mode. */ -typedef enum _HT_EXTCHNL_OFFSET { +// +// Represent Extension Channel Offset in HT Capabilities +// This is available only in 40Mhz mode. +// +typedef enum _HT_EXTCHNL_OFFSET{ HT_EXTCHNL_OFFSET_NO_EXT = 0, - HT_EXTCHNL_OFFSET_UPPER = 1, + HT_EXTCHNL_OFFSET_UPPER = 1, HT_EXTCHNL_OFFSET_NO_DEF = 2, - HT_EXTCHNL_OFFSET_LOWER = 3, -} HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET; - -typedef enum _CHNLOP { - CHNLOP_NONE = 0, /* No Action now */ - CHNLOP_SCAN = 1, /* Scan in progress */ - CHNLOP_SWBW = 2, /* Bandwidth switching in progress */ - CHNLOP_SWCHNL = 3, /* Software Channel switching in progress */ + HT_EXTCHNL_OFFSET_LOWER = 3, +}HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET; + +typedef enum _CHNLOP{ + CHNLOP_NONE = 0, // No Action now + CHNLOP_SCAN = 1, // Scan in progress + CHNLOP_SWBW = 2, // Bandwidth switching in progress + CHNLOP_SWCHNL = 3, // Software Channel switching in progress } CHNLOP, *PCHNLOP; -/* Determine if the Channel Operation is in progress */ +// Determine if the Channel Operation is in progress #define CHHLOP_IN_PROGRESS(_pHTInfo) \ - (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? TRUE : FALSE) + ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? TRUE : FALSE -typedef enum _HT_ACTION { +typedef enum _HT_ACTION{ ACT_RECOMMAND_WIDTH = 0, ACT_MIMO_PWR_SAVE = 1, - ACT_PSMP = 2, + ACT_PSMP = 2, ACT_SET_PCO_PHASE = 3, - ACT_MIMO_CHL_MEASURE = 4, - ACT_RECIPROCITY_CORRECT = 5, + ACT_MIMO_CHL_MEASURE = 4, + ACT_RECIPROCITY_CORRECT = 5, ACT_MIMO_CSI_MATRICS = 6, - ACT_MIMO_NOCOMPR_STEER = 7, + ACT_MIMO_NOCOMPR_STEER = 7, ACT_MIMO_COMPR_STEER = 8, ACT_ANTENNA_SELECT = 9, } HT_ACTION, *PHT_ACTION; -/* Define sub-carrier mode for 40MHZ. */ -typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier { +/* 2007/06/07 MH Define sub-carrier mode for 40MHZ. */ +typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier{ SC_MODE_DUPLICATE = 0, - SC_MODE_LOWER = 1, - SC_MODE_UPPER = 2, + SC_MODE_LOWER = 1, + SC_MODE_UPPER = 2, SC_MODE_FULL40MHZ = 3, -} HT_BW40_SC_E; +}HT_BW40_SC_E; -typedef struct _HT_CAPABILITY_ELE { +typedef struct _HT_CAPABILITY_ELE{ - /* HT capability info */ + //HT capability info u8 AdvCoding:1; u8 ChlWidth:1; u8 MimoPwrSave:2; @@ -118,32 +127,32 @@ typedef struct _HT_CAPABILITY_ELE { u8 Rsvd1:1; u8 LSigTxopProtect:1; - /* MAC HT parameters info */ + //MAC HT parameters info u8 MaxRxAMPDUFactor:2; u8 MPDUDensity:3; u8 Rsvd2:3; - /* Supported MCS set */ + //Supported MCS set u8 MCS[16]; - /* Extended HT Capability Info */ + //Extended HT Capability Info u16 ExtHTCapInfo; - /* TXBF Capabilities */ + //TXBF Capabilities u8 TxBFCap[4]; - /* Antenna Selection Capabilities */ + //Antenna Selection Capabilities u8 ASCap; -} __packed HT_CAPABILITY_ELE, *PHT_CAPABILITY_ELE; +}__attribute__((packed)) HT_CAPABILITY_ELE, *PHT_CAPABILITY_ELE; -/*------------------------------------------------------------ - * The HT Information element is present in beacons - * Only AP is required to include this element - *------------------------------------------------------------*/ +//------------------------------------------------------------ +// The HT Information element is present in beacons +// Only AP is required to include this element +//------------------------------------------------------------ -typedef struct _HT_INFORMATION_ELE { +typedef struct _HT_INFORMATION_ELE{ u8 ControlChl; u8 ExtChlOffset:2; @@ -168,146 +177,146 @@ typedef struct _HT_INFORMATION_ELE { u8 Rsvd4:4; u8 BasicMSC[16]; -} __packed HT_INFORMATION_ELE, *PHT_INFORMATION_ELE; +}__attribute__((packed)) HT_INFORMATION_ELE, *PHT_INFORMATION_ELE; -/* MIMO Power Save control field. - * This is appear in MIMO Power Save Action Frame */ -typedef struct _MIMOPS_CTRL { +// +// MIMO Power Save control field. +// This is appear in MIMO Power Save Action Frame +// +typedef struct _MIMOPS_CTRL{ u8 MimoPsEnable:1; u8 MimoPsMode:1; u8 Reserved:6; } MIMOPS_CTRL, *PMIMOPS_CTRL; -typedef enum _HT_SPEC_VER { +typedef enum _HT_SPEC_VER{ HT_SPEC_VER_IEEE = 0, HT_SPEC_VER_EWC = 1, -} HT_SPEC_VER, *PHT_SPEC_VER; +}HT_SPEC_VER, *PHT_SPEC_VER; -typedef enum _HT_AGGRE_MODE_E { +typedef enum _HT_AGGRE_MODE_E{ HT_AGG_AUTO = 0, HT_AGG_FORCE_ENABLE = 1, HT_AGG_FORCE_DISABLE = 2, -} HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E; +}HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E; -/*---------------------------------------------------------------------------- - * The Data structure is used to keep HT related variables when card is - * configured as non-AP STA mode. - * **Note** Current_xxx should be set to default value in HTInitializeHTInfo() - *----------------------------------------------------------------------------*/ +//------------------------------------------------------------ +// The Data structure is used to keep HT related variables when card is +// configured as non-AP STA mode. **Note** Current_xxx should be set +// to default value in HTInitializeHTInfo() +//------------------------------------------------------------ -typedef struct _RT_HIGH_THROUGHPUT { - u8 bEnableHT; - u8 bCurrentHTSupport; - /* Tx 40MHz channel capability */ - u8 bRegBW40MHz; - u8 bCurBW40MHz; - /* Tx Short GI for 40Mhz */ - u8 bRegShortGI40MHz; - u8 bCurShortGI40MHz; - /* Tx Short GI for 20MHz */ - u8 bRegShortGI20MHz; - u8 bCurShortGI20MHz; - /* Tx CCK rate capability */ - u8 bRegSuppCCK; - u8 bCurSuppCCK; - - /* 802.11n spec version for "peer" */ - HT_SPEC_VER ePeerHTSpecVer; - - - /* HT related information for "Self" */ - /* This is HT cap element sent to peer STA, which also indicate - * HT Rx capabilities. */ - HT_CAPABILITY_ELE SelfHTCap; - HT_INFORMATION_ELE SelfHTInfo; - - /* HT related information for "Peer" */ - u8 PeerHTCapBuf[32]; - u8 PeerHTInfoBuf[32]; - - - /* A-MSDU related */ - /* This indicates Tx A-MSDU capability */ - u8 bAMSDU_Support; - u16 nAMSDU_MaxSize; - u8 bCurrent_AMSDU_Support; - u16 nCurrent_AMSDU_MaxSize; - - - /* A-MPDU related */ - /* This indicate Tx A-MPDU capability */ - u8 bAMPDUEnable; - u8 bCurrentAMPDUEnable; - u8 AMPDU_Factor; - u8 CurrentAMPDUFactor; - u8 MPDU_Density; - u8 CurrentMPDUDensity; +typedef struct _RT_HIGH_THROUGHPUT{ +// DECLARE_RT_OBJECT(_RT_HIGH_THROUGHPUT); + u8 bEnableHT; + u8 bCurrentHTSupport; + + u8 bRegBW40MHz; // Tx 40MHz channel capability + u8 bCurBW40MHz; // Tx 40MHz channel capability + + u8 bRegShortGI40MHz; // Tx Short GI for 40Mhz + u8 bCurShortGI40MHz; // Tx Short GI for 40MHz + + u8 bRegShortGI20MHz; // Tx Short GI for 20MHz + u8 bCurShortGI20MHz; // Tx Short GI for 20MHz + + u8 bRegSuppCCK; // Tx CCK rate capability + u8 bCurSuppCCK; // Tx CCK rate capability + + // 802.11n spec version for "peer" + HT_SPEC_VER ePeerHTSpecVer; - /* Forced A-MPDU enable */ - HT_AGGRE_MODE_E ForcedAMPDUMode; - u8 ForcedAMPDUFactor; - u8 ForcedMPDUDensity; - /* Forced A-MSDU enable */ - HT_AGGRE_MODE_E ForcedAMSDUMode; - u16 ForcedAMSDUMaxSize; + // HT related information for "Self" + HT_CAPABILITY_ELE SelfHTCap; // This is HT cap element sent to peer STA, which also indicate HT Rx capabilities. + HT_INFORMATION_ELE SelfHTInfo; // This is HT info element sent to peer STA, which also indicate HT Rx capabilities. - u8 bForcedShortGI; + // HT related information for "Peer" + u8 PeerHTCapBuf[32]; + u8 PeerHTInfoBuf[32]; - u8 CurrentOpMode; - /* MIMO PS related */ - u8 SelfMimoPs; - u8 PeerMimoPs; + // A-MSDU related + u8 bAMSDU_Support; // This indicates Tx A-MSDU capability + u16 nAMSDU_MaxSize; // This indicates Tx A-MSDU capability + u8 bCurrent_AMSDU_Support; // This indicates Tx A-MSDU capability + u16 nCurrent_AMSDU_MaxSize; // This indicates Tx A-MSDU capability - /* 40MHz Channel Offset settings. */ + + // AMPDU related <2006.08.10 Emily> + u8 bAMPDUEnable; // This indicate Tx A-MPDU capability + u8 bCurrentAMPDUEnable; // This indicate Tx A-MPDU capability + u8 AMPDU_Factor; // This indicate Tx A-MPDU capability + u8 CurrentAMPDUFactor; // This indicate Tx A-MPDU capability + u8 MPDU_Density; // This indicate Tx A-MPDU capability + u8 CurrentMPDUDensity; // This indicate Tx A-MPDU capability + + // Forced A-MPDU enable + HT_AGGRE_MODE_E ForcedAMPDUMode; + u8 ForcedAMPDUFactor; + u8 ForcedMPDUDensity; + + // Forced A-MSDU enable + HT_AGGRE_MODE_E ForcedAMSDUMode; + u16 ForcedAMSDUMaxSize; + + u8 bForcedShortGI; + + u8 CurrentOpMode; + + // MIMO PS related + u8 SelfMimoPs; + u8 PeerMimoPs; + + // 40MHz Channel Offset settings. HT_EXTCHNL_OFFSET CurSTAExtChnlOffset; - u8 bCurTxBW40MHz; /* If we use 40 MHz to Tx */ - u8 PeerBandwidth; - - /* For Bandwidth Switching */ - u8 bSwBwInProgress; - CHNLOP ChnlOp; /* sw switching channel in progress. */ - u8 SwBwStep; - struct timer_list SwBwTimer; - - /* For Realtek proprietary A-MPDU factor for aggregation */ - u8 bRegRT2RTAggregation; - u8 bCurrentRT2RTAggregation; - u8 bCurrentRT2RTLongSlotTime; - u8 szRT2RTAggBuffer[10]; - - /* Rx Reorder control */ - u8 bRegRxReorderEnable; - u8 bCurRxReorderEnable; - u8 RxReorderWinSize; - u8 RxReorderPendingTime; - u16 RxReorderDropCounter; + u8 bCurTxBW40MHz; // If we use 40 MHz to Tx + u8 PeerBandwidth; + + // For Bandwidth Switching + u8 bSwBwInProgress; + CHNLOP ChnlOp; // software switching channel in progress. By Bruce, 2008-02-15. + u8 SwBwStep; + //RT_TIMER SwBwTimer; + struct timer_list SwBwTimer; + + // For Realtek proprietary A-MPDU factor for aggregation + u8 bRegRT2RTAggregation; + u8 bCurrentRT2RTAggregation; + u8 bCurrentRT2RTLongSlotTime; + u8 szRT2RTAggBuffer[10]; + + // Rx Reorder control + u8 bRegRxReorderEnable; + u8 bCurRxReorderEnable; + u8 RxReorderWinSize; + u8 RxReorderPendingTime; + u16 RxReorderDropCounter; #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE - u8 UsbTxAggrNum; + u8 UsbTxAggrNum; #endif #ifdef USB_RX_AGGREGATION_SUPPORT - u8 UsbRxFwAggrEn; - u8 UsbRxFwAggrPageNum; - u8 UsbRxFwAggrPacketNum; - u8 UsbRxFwAggrTimeout; + u8 UsbRxFwAggrEn; + u8 UsbRxFwAggrPageNum; + u8 UsbRxFwAggrPacketNum; + u8 UsbRxFwAggrTimeout; #endif - /* Add for Broadcom(Linksys) IOT. */ - u8 bIsPeerBcm; + // Add for Broadcom(Linksys) IOT. Joseph + u8 bIsPeerBcm; - /* For IOT issue. */ - u32 IOTAction; -} RT_HIGH_THROUGHPUT, *PRT_HIGH_THROUGHPUT; + // For IOT issue. + u32 IOTAction; +}RT_HIGH_THROUGHPUT, *PRT_HIGH_THROUGHPUT; -/*---------------------------------------------------------------------- - * The Data structure is used to keep HT related variable for "each Sta" - * when card is configured as "AP mode" - *----------------------------------------------------------------------*/ +//------------------------------------------------------------ +// The Data structure is used to keep HT related variable for "each Sta" +// when card is configured as "AP mode" +//------------------------------------------------------------ -typedef struct _RT_HTINFO_STA_ENTRY { +typedef struct _RT_HTINFO_STA_ENTRY{ u8 bEnableHT; u8 bSupportCck; @@ -326,54 +335,56 @@ typedef struct _RT_HTINFO_STA_ENTRY { u8 McsRateSet[16]; -} RT_HTINFO_STA_ENTRY, *PRT_HTINFO_STA_ENTRY; +}RT_HTINFO_STA_ENTRY, *PRT_HTINFO_STA_ENTRY; -/*--------------------------------------------------------------------- - * The Data structure is used to keep HT related variable for "each AP" - * when card is configured as "STA mode" - *---------------------------------------------------------------------*/ +//------------------------------------------------------------ +// The Data structure is used to keep HT related variable for "each AP" +// when card is configured as "STA mode" +//------------------------------------------------------------ -typedef struct _BSS_HT { +typedef struct _BSS_HT{ u8 bdSupportHT; - /* HT related elements */ - u8 bdHTCapBuf[32]; - u16 bdHTCapLen; - u8 bdHTInfoBuf[32]; - u16 bdHTInfoLen; + // HT related elements + u8 bdHTCapBuf[32]; + u16 bdHTCapLen; + u8 bdHTInfoBuf[32]; + u16 bdHTInfoLen; - HT_SPEC_VER bdHTSpecVer; + HT_SPEC_VER bdHTSpecVer; + //HT_CAPABILITY_ELE bdHTCapEle; + //HT_INFORMATION_ELE bdHTInfoEle; - u8 bdRT2RTAggregation; - u8 bdRT2RTLongSlotTime; -} BSS_HT, *PBSS_HT; + u8 bdRT2RTAggregation; + u8 bdRT2RTLongSlotTime; +}BSS_HT, *PBSS_HT; -typedef struct _MIMO_RSSI { +typedef struct _MIMO_RSSI{ u32 EnableAntenna; u32 AntennaA; u32 AntennaB; u32 AntennaC; u32 AntennaD; u32 Average; -} MIMO_RSSI, *PMIMO_RSSI; +}MIMO_RSSI, *PMIMO_RSSI; -typedef struct _MIMO_EVM { +typedef struct _MIMO_EVM{ u32 EVM1; - u32 EVM2; -} MIMO_EVM, *PMIMO_EVM; + u32 EVM2; +}MIMO_EVM, *PMIMO_EVM; -typedef struct _FALSE_ALARM_STATISTICS { +typedef struct _FALSE_ALARM_STATISTICS{ u32 Cnt_Parity_Fail; - u32 Cnt_Rate_Illegal; + u32 Cnt_Rate_Illegal; u32 Cnt_Crc8_fail; u32 Cnt_all; -} FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; +}FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS; -#endif +#endif //__INC_HTTYPE_H diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c index 7bdcbd3..5614401 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c @@ -62,6 +62,105 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen) } /*----------------------------------------------------------------------------- + * Function: cmpk_message_handle_tx() + * + * Overview: Driver internal module can call the API to send message to + * firmware side. For example, you can send a debug command packet. + * Or you can send a request for FW to modify RLX4181 LBUS HW bank. + * Otherwise, you can change MAC/PHT/RF register by firmware at + * run time. We do not support message more than one segment now. + * + * Input: NONE + * + * Output: NONE + * + * Return: NONE + * + * Revised History: + * When Who Remark + * 05/06/2008 amy porting from windows code. + * + *---------------------------------------------------------------------------*/ +extern rt_status cmpk_message_handle_tx(struct net_device *dev, + u8 *codevirtualaddress, + u32 packettype, u32 buffer_len) +{ + + bool rt_status = true; +#ifdef RTL8192U + return rt_status; +#else + struct r8192_priv *priv = ieee80211_priv(dev); + u16 frag_threshold; + u16 frag_length, frag_offset = 0; + + rt_firmware *pfirmware = priv->pFirmware; + struct sk_buff *skb; + unsigned char *seg_ptr; + cb_desc *tcb_desc; + u8 bLastIniPkt; + + firmware_init_param(dev); + /* Fragmentation might be required */ + frag_threshold = pfirmware->cmdpacket_frag_thresold; + do { + if ((buffer_len - frag_offset) > frag_threshold) { + frag_length = frag_threshold; + bLastIniPkt = 0; + + } else { + frag_length = buffer_len - frag_offset; + bLastIniPkt = 1; + + } + + /* Allocate skb buffer to contain firmware info and tx + descriptor info add 4 to avoid packet appending overflow. */ +#ifdef RTL8192U + skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); +#else + skb = dev_alloc_skb(frag_length + 4); +#endif + memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev)); + tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + tcb_desc->queue_index = TXCMD_QUEUE; + tcb_desc->bCmdOrInit = packettype; + tcb_desc->bLastIniPkt = bLastIniPkt; + +#ifdef RTL8192U + skb_reserve(skb, USB_HWDESC_HEADER_LEN); +#endif + + seg_ptr = skb_put(skb, buffer_len); + /* + * Transform from little endian to big endian + * and pending zero + */ + memcpy(seg_ptr, codevirtualaddress, buffer_len); + tcb_desc->txbuf_size = (u16)buffer_len; + + + if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) || + (!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index])) || + (priv->ieee80211->queue_stop)) { + RT_TRACE(COMP_FIRMWARE, "======> tx full!\n"); + skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb); + } else { + priv->ieee80211->softmac_hard_start_xmit(skb, dev); + } + + codevirtualaddress += frag_length; + frag_offset += frag_length; + + } while (frag_offset < buffer_len); + + return rt_status; + + +#endif +} + +/*----------------------------------------------------------------------------- * Function: cmpk_counttxstatistic() * * Overview: @@ -494,8 +593,8 @@ static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg) * 05/06/2008 amy Create Version 0 porting from windows code. * *---------------------------------------------------------------------------*/ -u32 cmpk_message_handle_rx(struct net_device *dev, - struct ieee80211_rx_stats *pstats) +extern u32 cmpk_message_handle_rx(struct net_device *dev, + struct ieee80211_rx_stats *pstats) { int total_length; u8 cmd_length, exe_cnt = 0; diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h index 52cd437..ebe4032 100644 --- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h +++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h @@ -1,17 +1,17 @@ #ifndef R819XUSB_CMDPKT_H #define R819XUSB_CMDPKT_H /* Different command packet have dedicated message length and definition. */ -#define CMPK_RX_TX_FB_SIZE sizeof(cmpk_txfb_t) /* 20 */ -#define CMPK_TX_SET_CONFIG_SIZE sizeof(cmpk_set_cfg_t) /* 16 */ -#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(cmpk_set_cfg_t) /* 16 */ -#define CMPK_RX_TX_STS_SIZE sizeof(cmpk_tx_status_t) -#define CMPK_RX_DBG_MSG_SIZE sizeof(cmpk_rx_dbginfo_t) -#define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t) +#define CMPK_RX_TX_FB_SIZE sizeof(cmpk_txfb_t) //20 +#define CMPK_TX_SET_CONFIG_SIZE sizeof(cmpk_set_cfg_t) //16 +#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(cmpk_set_cfg_t) //16 +#define CMPK_RX_TX_STS_SIZE sizeof(cmpk_tx_status_t)// +#define CMPK_RX_DBG_MSG_SIZE sizeof(cmpk_rx_dbginfo_t)// +#define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t) /* 2008/05/08 amy For USB constant. */ -#define ISR_TxBcnOk BIT27 /* Transmit Beacon OK */ -#define ISR_TxBcnErr BIT26 /* Transmit Beacon Error */ -#define ISR_BcnTimerIntr BIT13 /* Beacon Timer Interrupt */ +#define ISR_TxBcnOk BIT27 // Transmit Beacon OK +#define ISR_TxBcnErr BIT26 // Transmit Beacon Error +#define ISR_BcnTimerIntr BIT13 // Beacon Timer Interrupt /* Define element ID of command packet. */ @@ -20,172 +20,182 @@ /* Define different command packet structure. */ /* 1. RX side: TX feedback packet. */ typedef struct tag_cmd_pkt_tx_feedback { - /* DWORD 0 */ + // DWORD 0 u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ - /* Change tx feedback info field. */ + /* 2007/07/05 MH Change tx feedback info field. */ /*------TX Feedback Info Field */ - u8 TID:4; - u8 fail_reason:3; + u8 TID:4; /* */ + u8 fail_reason:3; /* */ u8 tok:1; /* Transmit ok. */ - u8 reserve1:4; - u8 pkt_type:2; - u8 bandwidth:1; - u8 qos_pkt:1; + u8 reserve1:4; /* */ + u8 pkt_type:2; /* */ + u8 bandwidth:1; /* */ + u8 qos_pkt:1; /* */ - /* DWORD 1 */ - u8 reserve2; + // DWORD 1 + u8 reserve2; /* */ /*------TX Feedback Info Field */ - u8 retry_cnt; - u16 pkt_id; + u8 retry_cnt; /* */ + u16 pkt_id; /* */ - /* DWORD 3 */ - u16 seq_num; + // DWORD 3 + u16 seq_num; /* */ u8 s_rate; /* Start rate. */ u8 f_rate; /* Final rate. */ - /* DWORD 4 */ - u8 s_rts_rate; - u8 f_rts_rate; - u16 pkt_length; + // DWORD 4 + u8 s_rts_rate; /* */ + u8 f_rts_rate; /* */ + u16 pkt_length; /* */ - /* DWORD 5 */ - u16 reserve3; - u16 duration; -} cmpk_txfb_t; + // DWORD 5 + u16 reserve3; /* */ + u16 duration; /* */ +}cmpk_txfb_t; /* 2. RX side: Interrupt status packet. It includes Beacon State, - * Beacon Timer Interrupt and other useful informations in MAC ISR Reg. */ + Beacon Timer Interrupt and other useful informations in MAC ISR Reg. */ typedef struct tag_cmd_pkt_interrupt_status { u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ u16 reserve; - u32 interrupt_status; /* Interrupt Status. */ -} cmpk_intr_sta_t; + u32 interrupt_status; /* Interrupt Status. */ +}cmpk_intr_sta_t; /* 3. TX side: Set configuration packet. */ typedef struct tag_cmd_pkt_set_configuration { u8 element_id; /* Command packet type. */ u8 length; /* Command packet length. */ - u16 reserve1; - /* Configuration info. */ + u16 reserve1; /* */ u8 cfg_reserve1:3; - u8 cfg_size:2; - u8 cfg_type:2; - u8 cfg_action:1; - u8 cfg_reserve2; - u8 cfg_page:4; - u8 cfg_reserve3:4; - u8 cfg_offset; - u32 value; - u32 mask; -} cmpk_set_cfg_t; + u8 cfg_size:2; /* Configuration info. */ + u8 cfg_type:2; /* Configuration info. */ + u8 cfg_action:1; /* Configuration info. */ + u8 cfg_reserve2; /* Configuration info. */ + u8 cfg_page:4; /* Configuration info. */ + u8 cfg_reserve3:4; /* Configuration info. */ + u8 cfg_offset; /* Configuration info. */ + u32 value; /* */ + u32 mask; /* */ +}cmpk_set_cfg_t; /* 4. Both side : TX/RX query configuraton packet. The query structure is the same as set configuration. */ #define cmpk_query_cfg_t cmpk_set_cfg_t /* 5. Multi packet feedback status. */ -typedef struct tag_tx_stats_feedback { - /* For endian transfer --> Driver will not the same as - firmware structure. */ - /* DW 0 */ +typedef struct tag_tx_stats_feedback { // PJ quick rxcmd 09042007 + // For endian transfer --> Driver will not the same as firmware structure. + // DW 0 u16 reserve1; - u8 length; /* Command packet length */ - u8 element_id; /* Command packet type */ + u8 length; // Command packet length + u8 element_id; // Command packet type - /* DW 1 */ - u16 txfail; /* Tx fail count */ - u16 txok; /* Tx ok count */ + // DW 1 + u16 txfail; // Tx Fail count + u16 txok; // Tx ok count - /* DW 2 */ - u16 txmcok; /* Tx multicast */ - u16 txretry; /* Tx retry count */ + // DW 2 + u16 txmcok; // tx multicast + u16 txretry; // Tx Retry count - /* DW 3 */ - u16 txucok; /* Tx unicast */ - u16 txbcok; /* Tx broadcast */ + // DW 3 + u16 txucok; // tx unicast + u16 txbcok; // tx broadcast - /* DW 4 */ - u16 txbcfail; - u16 txmcfail; + // DW 4 + u16 txbcfail; // + u16 txmcfail; // - /* DW 5 */ - u16 reserve2; - u16 txucfail; + // DW 5 + u16 reserve2; // + u16 txucfail; // - /* DW 6-8 */ + // DW 6-8 u32 txmclength; u32 txbclength; u32 txuclength; - /* DW 9 */ + // DW 9 u16 reserve3_23; u8 reserve3_1; u8 rate; -} __packed cmpk_tx_status_t; +}__attribute__((packed)) cmpk_tx_status_t; /* 6. Debug feedback message. */ -/* Define RX debug message */ +/* 2007/10/23 MH Define RX debug message */ typedef struct tag_rx_debug_message_feedback { - /* For endian transfer --> for driver */ - /* DW 0 */ + // For endian transfer --> for driver + // DW 0 u16 reserve1; - u8 length; /* Command packet length */ - u8 element_id; /* Command packet type */ + u8 length; // Command packet length + u8 element_id; // Command packet type - /* DW 1-?? */ - /* Variable debug message. */ + // DW 1-?? + // Variable debug message. -} cmpk_rx_dbginfo_t; +}cmpk_rx_dbginfo_t; -/* Define transmit rate history. For big endian format. */ +/* 2008/03/20 MH Define transmit rate history. For big endian format. */ typedef struct tag_tx_rate_history { - /* For endian transfer --> for driver */ - /* DW 0 */ - u8 element_id; /* Command packet type */ - u8 length; /* Command packet length */ + // For endian transfer --> for driver + // DW 0 + u8 element_id; // Command packet type + u8 length; // Command packet length u16 reserved1; - /* DW 1-2 CCK rate counter */ + // DW 1-2 CCK rate counter u16 cck[4]; - /* DW 3-6 */ + // DW 3-6 u16 ofdm[8]; - /* DW 7-14 BW=0 SG=0 - * DW 15-22 BW=1 SG=0 - * DW 23-30 BW=0 SG=1 - * DW 31-38 BW=1 SG=1 - */ + // DW 7-14 + //UINT16 MCS_BW0_SG0[16]; + + // DW 15-22 + //UINT16 MCS_BW1_SG0[16]; + + // DW 23-30 + //UINT16 MCS_BW0_SG1[16]; + + // DW 31-38 + //UINT16 MCS_BW1_SG1[16]; + + // DW 7-14 BW=0 SG=0 + // DW 15-22 BW=1 SG=0 + // DW 23-30 BW=0 SG=1 + // DW 31-38 BW=1 SG=1 u16 ht_mcs[4][16]; -} __packed cmpk_tx_rahis_t; - -typedef enum tag_command_packet_directories { - RX_TX_FEEDBACK = 0, - RX_INTERRUPT_STATUS = 1, - TX_SET_CONFIG = 2, - BOTH_QUERY_CONFIG = 3, - RX_TX_STATUS = 4, - RX_DBGINFO_FEEDBACK = 5, - RX_TX_PER_PKT_FEEDBACK = 6, - RX_TX_RATE_HISTORY = 7, - RX_CMD_ELE_MAX -} cmpk_element_e; - -typedef enum _rt_status { +}__attribute__((packed)) cmpk_tx_rahis_t; + +typedef enum tag_command_packet_directories +{ + RX_TX_FEEDBACK = 0, + RX_INTERRUPT_STATUS = 1, + TX_SET_CONFIG = 2, + BOTH_QUERY_CONFIG = 3, + RX_TX_STATUS = 4, + RX_DBGINFO_FEEDBACK = 5, + RX_TX_PER_PKT_FEEDBACK = 6, + RX_TX_RATE_HISTORY = 7, + RX_CMD_ELE_MAX +}cmpk_element_e; + +typedef enum _rt_status{ RT_STATUS_SUCCESS, RT_STATUS_FAILURE, RT_STATUS_PENDING, RT_STATUS_RESOURCE -} rt_status, *prt_status; +}rt_status,*prt_status; + +extern rt_status cmpk_message_handle_tx(struct net_device *dev, u8 *codevirtualaddress, u32 packettype, u32 buffer_len); -extern u32 cmpk_message_handle_rx(struct net_device *dev, - struct ieee80211_rx_stats *pstats); -extern rt_status SendTxCommandPacket(struct net_device *dev, - void *pData, u32 DataLen); +extern u32 cmpk_message_handle_rx(struct net_device *dev, struct ieee80211_rx_stats *pstats); +extern rt_status SendTxCommandPacket( struct net_device *dev, void *pData, u32 DataLen); #endif diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c index d6a6de3..bb924ac 100644 --- a/drivers/staging/rtl8192u/r819xU_firmware.c +++ b/drivers/staging/rtl8192u/r819xU_firmware.c @@ -61,16 +61,20 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff /* Allocate skb buffer to contain firmware info and tx descriptor info * add 4 to avoid packet appending overflow. * */ + #ifdef RTL8192U skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); - if (!skb) - return false; + #else + skb = dev_alloc_skb(frag_length + 4); + #endif memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev)); tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); tcb_desc->queue_index = TXCMD_QUEUE; tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_INIT; tcb_desc->bLastIniPkt = bLastIniPkt; + #ifdef RTL8192U skb_reserve(skb, USB_HWDESC_HEADER_LEN); + #endif seg_ptr = skb->data; /* * Transform from little endian to big endian @@ -295,10 +299,16 @@ bool init_firmware(struct net_device *dev) mapped_file = pfirmware->firmware_buf; file_length = fw_entry->size; } else { +#ifdef RTL8190P + memcpy(pfirmware->firmware_buf,fw_entry->data,fw_entry->size); + mapped_file = pfirmware->firmware_buf; + file_length = fw_entry->size; +#else memset(pfirmware->firmware_buf,0,128); memcpy(&pfirmware->firmware_buf[128],fw_entry->data,fw_entry->size); mapped_file = pfirmware->firmware_buf; file_length = fw_entry->size + 128; +#endif } pfirmware->firmware_buf_size = file_length; }else if (rst_opt == OPT_FIRMWARE_RESET ) { @@ -330,6 +340,15 @@ bool init_firmware(struct net_device *dev) * will set polling bit when firmware code is also configured */ pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE; +#ifdef RTL8190P + // To initialize IMEM, CPU move code from 0x80000080, hence, we send 0x80 byte packet + rt_status = fwSendNullPacket(dev, RTL8190_CPU_START_OFFSET); + if (rt_status != true) + { + RT_TRACE(COMP_INIT, "fwSendNullPacket() fail ! \n"); + goto download_firmware_fail; + } +#endif //mdelay(1000); /* * To initialize IMEM, CPU move code from 0x80000080, diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 39cd426..a6fac08 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1713,7 +1713,7 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation) queue_delayed_work(priv->priv_wq, &priv->initialgain_operate_wq, 0); } -void InitialGainOperateWorkItemCallBack(struct work_struct *work) +extern void InitialGainOperateWorkItemCallBack(struct work_struct *work) { struct delayed_work *dwork = container_of(work, struct delayed_work, work); @@ -1799,6 +1799,12 @@ void InitialGainOperateWorkItemCallBack(struct work_struct *work) RT_TRACE(COMP_SCAN, "Scan BBInitialGainRestore 0xa0a is %x\n", priv->initgain_backup.cca); +#ifdef RTL8190P + SetTxPowerLevel8190(Adapter, priv->CurrentChannel); +#endif +#ifdef RTL8192E + SetTxPowerLevel8190(Adapter, priv->CurrentChannel); +#endif rtl8192_phy_setTxPower(dev, priv->ieee80211->current_network.channel); if (dm_digtable.dig_algorithm == DIG_ALGO_BY_FALSE_ALARM) diff --git a/drivers/staging/rtl8192u/r819xU_phy.h b/drivers/staging/rtl8192u/r819xU_phy.h index 66cbe3f..f3c352a 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.h +++ b/drivers/staging/rtl8192u/r819xU_phy.h @@ -23,7 +23,7 @@ typedef struct _SwChnlCmd { u32 Para1; u32 Para2; u32 msDelay; -} __packed SwChnlCmd; +} __attribute__ ((packed)) SwChnlCmd; extern u32 rtl819XMACPHY_Array_PG[]; extern u32 rtl819XPHY_REG_1T2RArray[]; |