diff options
Diffstat (limited to 'drivers/staging/winbond')
31 files changed, 1101 insertions, 2097 deletions
diff --git a/drivers/staging/winbond/Kconfig b/drivers/staging/winbond/Kconfig index 132671d96d0..db5b053d9bc 100644 --- a/drivers/staging/winbond/Kconfig +++ b/drivers/staging/winbond/Kconfig @@ -1,6 +1,6 @@ config W35UND tristate "IS89C35 WLAN USB driver" - depends on MAC80211 && WLAN && USB && EXPERIMENTAL + depends on MAC80211 && WLAN && USB default n ---help--- This is highly experimental driver for Winbond WIFI card. @@ -8,4 +8,4 @@ config W35UND Hardware is present in some Kohjinsha subnotebooks, and in some stand-alone USB modules. Chipset name seems to be w89c35d. - Check http://code.google.com/p/winbondport/ for new version. + Check <http://code.google.com/p/winbondport/> for new version. diff --git a/drivers/staging/winbond/Makefile b/drivers/staging/winbond/Makefile index 79fa2271a0c..081d48db04c 100644 --- a/drivers/staging/winbond/Makefile +++ b/drivers/staging/winbond/Makefile @@ -1,6 +1,5 @@ w35und-y := \ mds.o \ - mlmetxrx.o \ mto.o \ phy_calibration.o \ reg.o \ diff --git a/drivers/staging/winbond/core.h b/drivers/staging/winbond/core.h index 2b87a000731..fc0ef24fad3 100644 --- a/drivers/staging/winbond/core.h +++ b/drivers/staging/winbond/core.h @@ -3,8 +3,9 @@ #include <linux/wireless.h> #include <linux/types.h> +#include <linux/delay.h> -#include "wbhal_s.h" +#include "wbhal.h" #include "mto.h" #include "mac_structures.h" @@ -17,8 +18,8 @@ struct mlme_frame { s8 *pMMPDU; u16 len; - u8 DataType; - u8 IsInUsed; + u8 data_type; + u8 is_in_used; u8 TxMMPDU[MAX_NUM_TX_MMPDU][MAX_MMPDU_SIZE]; u8 TxMMPDUInUse[(MAX_NUM_TX_MMPDU + 3) & ~0x03]; @@ -51,13 +52,9 @@ struct wbsoft_priv { struct hw_data sHwData; /*For HAL */ struct wb35_mds Mds; - atomic_t ThreadCount; - u32 RxByteCount; u32 TxByteCount; - u8 LinkName[WB_MAX_LINK_NAME_LEN]; - bool enabled; }; diff --git a/drivers/staging/winbond/localpara.h b/drivers/staging/winbond/localpara.h index d7980575bed..8ca80ddda59 100644 --- a/drivers/staging/winbond/localpara.h +++ b/drivers/staging/winbond/localpara.h @@ -58,9 +58,13 @@ #define LOCAL_11B_BASIC_RATE_BITMAP 0x826 #define LOCAL_11B_OPERATION_RATE_BITMAP 0x826 #define LOCAL_11G_BASIC_RATE_BITMAP 0x826 /* 1, 2, 5.5, 11 */ -#define LOCAL_11G_OPERATION_RATE_BITMAP 0x130c1240 /* 6, 9, 12, 18, 24, 36, 48, 54 */ +#define LOCAL_11G_OPERATION_RATE_BITMAP 0x130c1240 /* 6, 9, 12, 18, + * 24, 36, 48, 54 + */ #define LOCAL_11A_BASIC_RATE_BITMAP 0x01001040 /* 6, 12, 24 */ -#define LOCAL_11A_OPERATION_RATE_BITMAP 0x120c0200 /* 9, 18, 36, 48, 54 */ +#define LOCAL_11A_OPERATION_RATE_BITMAP 0x120c0200 /* 9, 18, 36, + * 48, 54 + */ #define PWR_ACTIVE 0 @@ -137,10 +141,12 @@ struct wb_local_para { u8 iPowerSaveMode; /* 0 indicates on, 1 indicates off */ u8 ATIMmode; u8 ExcludeUnencrypted; - /* Unit ime count for the decision to enter PS mode */ + /* Unit time count for the decision to enter PS mode */ u16 CheckCountForPS; u8 boHasTxActivity;/* tx activity has occurred */ - u8 boMacPsValid; /* Power save mode obtained from H/W is valid or not */ + u8 boMacPsValid; /* Power save mode obtained + * from H/W is valid or not + */ /* Rate */ u8 TxRateMode; /* @@ -162,35 +168,57 @@ struct wb_local_para { u8 NumOfBRate; u8 NumOfSRate; - u8 NumOfDsssRateInSRate; /* number of DSSS rates in supported rate set */ + u8 NumOfDsssRateInSRate; /* number of DSSS rates in + * supported rate set + */ u8 reserved1; u32 dwBasicRateBitmap; /* bit map of basic rates */ - u32 dwSupportRateBitmap; /* bit map of all support rates including basic and operational rates */ + u32 dwSupportRateBitmap; /* bit map of all support rates + * including basic and operational + * rates + */ /* For SME/MLME handler */ - u16 wOldSTAindex; /* valid when boHandover=TRUE, store old connected STA index */ - u16 wConnectedSTAindex; /* Index of peerly connected AP or IBSS in the descriptionset. */ - u16 Association_ID; /* The Association ID in the (Re)Association Response frame. */ - u16 ListenInterval; /* The listen interval when SME invoking MLME_ (Re)Associate_Request(). */ + u16 wOldSTAindex; /* valid when boHandover=TRUE, + * store old connected STA index + */ + u16 wConnectedSTAindex; /* Index of peerly connected AP or + * IBSS in the descriptionset. + */ + u16 Association_ID; /* The Association ID in the + * (Re)Association Response frame. + */ + u16 ListenInterval; /* The listen interval when SME invoking + * MLME_ (Re)Associate_Request(). + */ struct radio_off RadioOffStatus; u8 Reserved0[2]; - u8 boMsRadioOff; /* Ndis demands to be true when set Disassoc. OID and be false when set SSID OID. */ + u8 boMsRadioOff; /* Ndis demands to be true when set + * Disassoc. OID and be false when + * set SSID OID. + */ u8 bAntennaNo; /* which antenna */ - u8 bConnectFlag; /* the connect status flag for roaming task */ + u8 bConnectFlag; /* the connect status flag for + * roaming task + */ u8 RoamStatus; u8 reserved7[3]; - struct chan_info CurrentChan; /* Current channel no. and channel band. It may be changed by scanning. */ - u8 boHandover; /* Roaming, Hnadover to other AP. */ + struct chan_info CurrentChan; /* Current channel no. and channel band. + * It may be changed by scanning. + */ + u8 boHandover; /* Roaming, Handover to other AP. */ u8 boCCAbusy; - u16 CWMax; /* It may not be the real value that H/W used */ + u16 CWMax; /* It may not be the real value + * that H/W used + */ u8 CWMin; /* 255: set according to 802.11 spec. */ u8 reserved2; @@ -200,7 +228,9 @@ struct wb_local_para { u8 bPreambleMode; /* AUTO, s32 */ u8 boNonERPpresent; - u8 boProtectMechanism; /* H/W will take the necessary action based on this variable */ + u8 boProtectMechanism; /* H/W will take the necessary action + * based on this variable + */ u8 boShortPreamble; /* Same here */ u8 boShortSlotTime; /* Same here */ u8 reserved_3; @@ -213,8 +243,12 @@ struct wb_local_para { u32 HwBssidValid; /* For scan list */ - u8 BssListCount; /* Total count of valid descriptor indexes */ - u8 boReceiveUncorrectInfo; /* important settings in beacon/probe resp. have been changed */ + u8 BssListCount; /* Total count of valid + * descriptor indexes + */ + u8 boReceiveUncorrectInfo; /* important settings in beacon/probe + * resp. have been changed + */ u8 NoOfJoinerInIbss; u8 reserved_4; @@ -228,7 +262,9 @@ struct wb_local_para { */ u8 JoinerInIbss[(MAX_BSS_DESCRIPT_ELEMENT + 3) & ~0x03]; - /* General Statistics, count at Rx_handler or Tx_callback interrupt handler */ + /* General Statistics, count at Rx_handler or + * Tx_callback interrupt handler + */ u64 GS_XMIT_OK; /* Good Frames Transmitted */ u64 GS_RCV_OK; /* Good Frames Received */ u32 GS_RCV_ERROR; /* Frames received with crc error */ @@ -248,10 +284,18 @@ struct wb_local_para { u32 _dot11WEPUndecryptableCount; u32 _dot11FrameDuplicateCount; - struct chan_info IbssChanSetting; /* 2B. Start IBSS Channel setting by registry or WWU. */ - u8 reserved_5[2]; /* It may not be used after considering RF type, region and modulation type. */ + struct chan_info IbssChanSetting; /* 2B. Start IBSS Channel + * setting by registry or + * WWU. + */ + u8 reserved_5[2]; /* It may not be used after + * considering RF type, region + * and modulation type. + */ - u8 reserved_6[2]; /* two variables are for wep key error detection */ + u8 reserved_6[2]; /* two variables are for wep + * key error detection + */ u32 bWepKeyError; u32 bToSelfPacketReceived; u32 WepKeyDetectTimerCount; diff --git a/drivers/staging/winbond/mac_structures.h b/drivers/staging/winbond/mac_structures.h index ed3df296406..76c63c74d50 100644 --- a/drivers/staging/winbond/mac_structures.h +++ b/drivers/staging/winbond/mac_structures.h @@ -21,23 +21,11 @@ #ifndef _MAC_Structures_H_ #define _MAC_Structures_H_ -#include <linux/skbuff.h> - -/*========================================================= -// Some miscellaneous definitions -//-----*/ -#define MAX_CHANNELS 30 #define MAC_ADDR_LENGTH 6 -#define MAX_WEP_KEY_SIZE 16 /* 128 bits */ -#define MAX_802_11_FRAGMENT_NUMBER 10 /* By spec */ /* ======================================================== // 802.11 Frame define //----- */ -#define MASK_PROTOCOL_VERSION_TYPE 0x0F -#define MASK_FRAGMENT_NUMBER 0x000F -#define SEQUENCE_NUMBER_SHIFT 4 -#define DIFFER_11_TO_3 18 #define DOT_11_MAC_HEADER_SIZE 24 #define DOT_11_SNAP_SIZE 6 #define DOT_11_DURATION_OFFSET 2 @@ -47,15 +35,9 @@ #define DOT_11_TYPE_OFFSET 30 #define DOT_11_DATA_OFFSET 24 #define DOT_11_DA_OFFSET 4 -#define DOT_3_TYPE_ARP 0x80F3 -#define DOT_3_TYPE_IPX 0x8137 -#define DOT_3_TYPE_OFFSET 12 - -#define ETHERNET_HEADER_SIZE 14 #define MAX_ETHERNET_PACKET_SIZE 1514 - /* ----- management : Type of Bits (2, 3) and Subtype of Bits (4, 5, 6, 7) */ #define MAC_SUBTYPE_MNGMNT_ASSOC_REQUEST 0x00 #define MAC_SUBTYPE_MNGMNT_ASSOC_RESPONSE 0x10 @@ -69,129 +51,6 @@ #define MAC_SUBTYPE_MNGMNT_AUTHENTICATION 0xB0 #define MAC_SUBTYPE_MNGMNT_DEAUTHENTICATION 0xC0 -/* ----- control : Type of Bits (2, 3) and Subtype of Bits (4, 5, 6, 7) */ -#define MAC_SUBTYPE_CONTROL_PSPOLL 0xA4 -#define MAC_SUBTYPE_CONTROL_RTS 0xB4 -#define MAC_SUBTYPE_CONTROL_CTS 0xC4 -#define MAC_SUBTYPE_CONTROL_ACK 0xD4 -#define MAC_SUBTYPE_CONTROL_CFEND 0xE4 -#define MAC_SUBTYPE_CONTROL_CFEND_CFACK 0xF4 - -/* ----- data : Type of Bits (2, 3) and Subtype of Bits (4, 5, 6, 7) */ -#define MAC_SUBTYPE_DATA 0x08 -#define MAC_SUBTYPE_DATA_CFACK 0x18 -#define MAC_SUBTYPE_DATA_CFPOLL 0x28 -#define MAC_SUBTYPE_DATA_CFACK_CFPOLL 0x38 -#define MAC_SUBTYPE_DATA_NULL 0x48 -#define MAC_SUBTYPE_DATA_CFACK_NULL 0x58 -#define MAC_SUBTYPE_DATA_CFPOLL_NULL 0x68 -#define MAC_SUBTYPE_DATA_CFACK_CFPOLL_NULL 0x78 - -/* ----- Frame Type of Bits (2, 3) */ -#define MAC_TYPE_MANAGEMENT 0x00 -#define MAC_TYPE_CONTROL 0x04 -#define MAC_TYPE_DATA 0x08 - -/* ----- definitions for Management Frame Element ID (1 BYTE) */ -#define ELEMENT_ID_SSID 0 -#define ELEMENT_ID_SUPPORTED_RATES 1 -#define ELEMENT_ID_FH_PARAMETER_SET 2 -#define ELEMENT_ID_DS_PARAMETER_SET 3 -#define ELEMENT_ID_CF_PARAMETER_SET 4 -#define ELEMENT_ID_TIM 5 -#define ELEMENT_ID_IBSS_PARAMETER_SET 6 -/* 7~15 reserverd */ -#define ELEMENT_ID_CHALLENGE_TEXT 16 -/* 17~31 reserved for challenge text extension */ -/* 32~255 reserved */ -/*-- 11G -- */ -#define ELEMENT_ID_ERP_INFORMATION 42 -#define ELEMENT_ID_EXTENDED_SUPPORTED_RATES 50 - -/* -- WPA -- */ - -#define ELEMENT_ID_RSN_WPA 221 -#ifdef _WPA2_ -#define ELEMENT_ID_RSN_WPA2 48 -#endif /* endif WPA2 */ - -#define WLAN_MAX_PAIRWISE_CIPHER_SUITE_COUNT ((u16) 6) -#define WLAN_MAX_AUTH_KEY_MGT_SUITE_LIST_COUNT ((u16) 2) - -/* =================================================================== -* Reason Code (Table 18): indicate the reason of DisAssoc, DeAuthen -* length of ReasonCode is 2 Octs. -* =================================================================== */ -#define REASON_REASERED 0 -#define REASON_UNSPECIDIED 1 -#define REASON_PREAUTH_INVALID 2 -#define DEAUTH_REASON_LEFT_BSS 3 -#define DISASS_REASON_AP_INACTIVE 4 -#define DISASS_REASON_AP_BUSY 5 -#define REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6 -#define REASON_CLASS3_FRAME_FROM_NONASSO_STA 7 -#define DISASS_REASON_LEFT_BSS 8 -#define REASON_NOT_AUTH_YET 9 -/* 802.11i define */ -#define REASON_INVALID_IE 13 -#define REASON_MIC_ERROR 14 -#define REASON_4WAY_HANDSHAKE_TIMEOUT 15 -#define REASON_GROUPKEY_UPDATE_TIMEOUT 16 -#define REASON_IE_DIFF_4WAY_ASSOC 17 -#define REASON_INVALID_MULTICAST_CIPHER 18 -#define REASON_INVALID_UNICAST_CIPHER 19 -#define REASON_INVALID_AKMP 20 -#define REASON_UNSUPPORTED_RSNIE_VERSION 21 -#define REASON_INVALID_RSNIE_CAPABILITY 22 -#define REASON_802_1X_AUTH_FAIL 23 -#define REASON_CIPHER_REJECT_PER_SEC_POLICY 14 - -/* -//=========================================================== -// enum_MMPDUResultCode -- -// Status code (2 Octs) in the MMPDU's frame body. Table.19 -// -//=========================================================== -enum enum_MMPDUResultCode -{ -// SUCCESS = 0, // Redefined - UNSPECIFIED_FAILURE = 1, - - // 2 - 9 Reserved - - NOT_SUPPROT_CAPABILITIES = 10, - - //REASSOCIATION_DENIED - // - REASSOC_DENIED_UNABLE_CFM_ASSOC_EXIST = 11, - - //ASSOCIATION_DENIED_NOT_IN_STANDARD - // - ASSOC_DENIED_REASON_NOT_IN_STANDARD = 12, - PEER_NOT_SUPPORT_AUTH_ALGORITHM = 13, - AUTH_SEQNUM_OUT_OF_EXPECT = 14, - AUTH_REJECT_REASON_CHALLENGE_FAIL = 15, - AUTH_REJECT_REASON_WAIT_TIMEOUT = 16, - ASSOC_DENIED_REASON_AP_BUSY = 17, - ASSOC_DENIED_REASON_NOT_SUPPORT_BASIC_RATE = 18 -} WB_MMPDURESULTCODE, *PWB_MMPDURESULTCODE; -*/ - -#define RATE_BITMAP_1M 1 -#define RATE_BITMAP_2M 2 -#define RATE_BITMAP_5dot5M 5 -#define RATE_BITMAP_6M 6 -#define RATE_BITMAP_9M 9 -#define RATE_BITMAP_11M 11 -#define RATE_BITMAP_12M 12 -#define RATE_BITMAP_18M 18 -#define RATE_BITMAP_22M 22 -#define RATE_BITMAP_24M 24 -#define RATE_BITMAP_33M 17 -#define RATE_BITMAP_36M 19 -#define RATE_BITMAP_48M 25 -#define RATE_BITMAP_54M 28 - #define RATE_AUTO 0 #define RATE_1M 2 #define RATE_2M 4 @@ -209,408 +68,4 @@ enum enum_MMPDUResultCode #define RATE_54M 108 #define RATE_MAX 255 -/* CAPABILITY */ -#define CAPABILITY_ESS_BIT 0x0001 -#define CAPABILITY_IBSS_BIT 0x0002 -#define CAPABILITY_CF_POLL_BIT 0x0004 -#define CAPABILITY_CF_POLL_REQ_BIT 0x0008 -#define CAPABILITY_PRIVACY_BIT 0x0010 -#define CAPABILITY_SHORT_PREAMBLE_BIT 0x0020 -#define CAPABILITY_PBCC_BIT 0x0040 -#define CAPABILITY_CHAN_AGILITY_BIT 0x0080 -#define CAPABILITY_SHORT_SLOT_TIME_BIT 0x0400 -#define CAPABILITY_DSSS_OFDM_BIT 0x2000 - - -struct Capability_Information_Element { - union { - u16 __attribute__ ((packed)) wValue; - #ifdef _BIG_ENDIAN_ /* 20060926 add by anson's endian */ - struct _Capability { - /* -- 11G -- */ - u8 Reserved3:2; - u8 DSSS_OFDM:1; - u8 Reserved2:2; - u8 Short_Slot_Time:1; - u8 Reserved1:2; - u8 Channel_Agility:1; - u8 PBCC:1; - u8 ShortPreamble:1; - u8 CF_Privacy:1; - u8 CF_Poll_Request:1; - u8 CF_Pollable:1; - u8 IBSS:1; - u8 ESS:1; - } __attribute__ ((packed)) Capability; - #else - struct _Capability { - u8 ESS:1; - u8 IBSS:1; - u8 CF_Pollable:1; - u8 CF_Poll_Request:1; - u8 CF_Privacy:1; - u8 ShortPreamble:1; - u8 PBCC:1; - u8 Channel_Agility:1; - u8 Reserved1:2; - /* -- 11G -- */ - u8 Short_Slot_Time:1; - u8 Reserved2:2; - u8 DSSS_OFDM:1; - u8 Reserved3:2; - } __attribute__ ((packed)) Capability; - #endif - } __attribute__ ((packed)) ; -} __attribute__ ((packed)); - -struct FH_Parameter_Set_Element { - u8 Element_ID; - u8 Length; - u8 Dwell_Time[2]; - u8 Hop_Set; - u8 Hop_Pattern; - u8 Hop_Index; -}; - -struct DS_Parameter_Set_Element { - u8 Element_ID; - u8 Length; - u8 Current_Channel; -}; - -struct Supported_Rates_Element { - u8 Element_ID; - u8 Length; - u8 SupportedRates[8]; -} __attribute__ ((packed)); - -struct SSID_Element { - u8 Element_ID; - u8 Length; - u8 SSID[32]; -} __attribute__ ((packed)) ; - -struct CF_Parameter_Set_Element { - u8 Element_ID; - u8 Length; - u8 CFP_Count; - u8 CFP_Period; - u8 CFP_MaxDuration[2]; /* in Time Units */ - u8 CFP_DurRemaining[2]; /* in time units */ -}; - -struct TIM_Element { - u8 Element_ID; - u8 Length; - u8 DTIM_Count; - u8 DTIM_Period; - u8 Bitmap_Control; - u8 Partial_Virtual_Bitmap[251]; -}; - -struct IBSS_Parameter_Set_Element { - u8 Element_ID; - u8 Length; - u8 ATIM_Window[2]; -}; - -struct Challenge_Text_Element { - u8 Element_ID; - u8 Length; - u8 Challenge_Text[253]; -}; - -struct PHY_Parameter_Set_Element { -/* int aSlotTime; */ -/* int aSifsTime; */ - s32 aCCATime; - s32 aRxTxTurnaroundTime; - s32 aTxPLCPDelay; - s32 RxPLCPDelay; - s32 aRxTxSwitchTime; - s32 aTxRampOntime; - s32 aTxRampOffTime; - s32 aTxRFDelay; - s32 aRxRFDelay; - s32 aAirPropagationTime; - s32 aMACProcessingDelay; - s32 aPreambleLength; - s32 aPLCPHeaderLength; - s32 aMPDUDurationFactor; - s32 aMPDUMaxLength; -/* int aCWmin; */ -/* int aCWmax; */ -}; - -/* -- 11G -- */ -struct ERP_Information_Element { - u8 Element_ID; - u8 Length; - #ifdef _BIG_ENDIAN_ /* 20060926 add by anson's endian */ - u8 Reserved:5; /* 20060926 add by anson */ - u8 Barker_Preamble_Mode:1; - u8 Use_Protection:1; - u8 NonERP_Present:1; - #else - u8 NonERP_Present:1; - u8 Use_Protection:1; - u8 Barker_Preamble_Mode:1; - u8 Reserved:5; - #endif -}; - -struct Extended_Supported_Rates_Element { - u8 Element_ID; - u8 Length; - u8 ExtendedSupportedRates[255]; -} __attribute__ ((packed)); - -/* WPA(802.11i draft 3.0) */ -#define VERSION_WPA 1 -#ifdef _WPA2_ -#define VERSION_WPA2 1 -#endif /* end def _WPA2_ */ -/* WPA2.0 OUI=00:50:F2, the MSB is reserved for suite type */ -#define OUI_WPA 0x00F25000 -#ifdef _WPA2_ -/* for wpa2 change to 0x00ACOF04 by Ws 26/04/04 */ -#define OUI_WPA2 0x00AC0F00 -#endif /* end def _WPA2_ */ - -#define OUI_WPA_ADDITIONAL 0x01 -#define WLAN_MIN_RSN_WPA_LENGTH 6 /* added by ws 09/10/04 */ -#ifdef _WPA2_ -#define WLAN_MIN_RSN_WPA2_LENGTH 2 /* Fix to 2 09/14/05 */ -#endif /* end def _WPA2_ */ - -#define oui_wpa (u32)(OUI_WPA|OUI_WPA_ADDITIONAL) - -#define WPA_OUI_BIG ((u32) 0x01F25000)/* added by ws 09/23/04 */ -#define WPA_OUI_LITTLE ((u32) 0x01F25001)/* added by ws 09/23/04 */ -/* 20061108 For WPS. It's little endian. Big endian is 0x0050F204 */ -#define WPA_WPS_OUI cpu_to_le32(0x04F25000) - -/* -----WPA2----- */ -#ifdef _WPA2_ -#define WPA2_OUI_BIG ((u32)0x01AC0F00) -#define WPA2_OUI_LITTLE ((u32)0x01AC0F01) -#endif /* end def _WPA2_ */ - -/* Authentication suite */ -#define OUI_AUTH_WPA_NONE 0x00 /* for WPA_NONE */ -#define OUI_AUTH_8021X 0x01 -#define OUI_AUTH_PSK 0x02 -/* Cipher suite */ -#define OUI_CIPHER_GROUP_KEY 0x00 /* added by ws 05/21/04 */ -#define OUI_CIPHER_WEP_40 0x01 -#define OUI_CIPHER_TKIP 0x02 -#define OUI_CIPHER_CCMP 0x04 -#define OUI_CIPHER_WEP_104 0x05 - -struct suite_selector{ - union{ - u8 Value[4]; - struct _SUIT_ { - u8 OUI[3]; - u8 Type; - } SuitSelector; - }; -}; - -/* -- WPA -- */ -struct RSN_Information_Element{ - u8 Element_ID; - u8 Length; - /* WPA version 2.0 additional field, and should be 00:50:F2:01 */ - struct suite_selector OuiWPAAdditional; - u16 Version; - struct suite_selector GroupKeySuite; - u16 PairwiseKeySuiteCount; - struct suite_selector PairwiseKeySuite[1]; -} __attribute__ ((packed)); -struct RSN_Auth_Sub_Information_Element { - u16 AuthKeyMngtSuiteCount; - struct suite_selector AuthKeyMngtSuite[1]; -} __attribute__ ((packed)); - -/* -- WPA2 -- */ -struct RSN_Capability_Element { - union { - u16 __attribute__ ((packed)) wValue; - #ifdef _BIG_ENDIAN_ /* 20060927 add by anson's endian */ - struct _RSN_Capability { - u16 __attribute__ ((packed)) Reserved2:8; /* 20051201 */ - u16 __attribute__ ((packed)) Reserved1:2; - u16 __attribute__ ((packed)) GTK_Replay_Counter:2; - u16 __attribute__ ((packed)) PTK_Replay_Counter:2; - u16 __attribute__ ((packed)) No_Pairwise:1; - u16 __attribute__ ((packed)) Pre_Auth:1; - } __attribute__ ((packed)) RSN_Capability; - #else - struct _RSN_Capability { - u16 __attribute__ ((packed)) Pre_Auth:1; - u16 __attribute__ ((packed)) No_Pairwise:1; - u16 __attribute__ ((packed)) PTK_Replay_Counter:2; - u16 __attribute__ ((packed)) GTK_Replay_Counter:2; - u16 __attribute__ ((packed)) Reserved1:2; - u16 __attribute__ ((packed)) Reserved2:8; /* 20051201 */ - } __attribute__ ((packed)) RSN_Capability; - #endif - - } __attribute__ ((packed)) ; -} __attribute__ ((packed)) ; - -#ifdef _WPA2_ -struct pmkid { - u8 pValue[16]; -}; - -struct WPA2_RSN_Information_Element { - u8 Element_ID; - u8 Length; - u16 Version; - struct suite_selector GroupKeySuite; - u16 PairwiseKeySuiteCount; - struct suite_selector PairwiseKeySuite[1]; - -} __attribute__ ((packed)); - -struct WPA2_RSN_Auth_Sub_Information_Element { - u16 AuthKeyMngtSuiteCount; - struct suite_selector AuthKeyMngtSuite[1]; -} __attribute__ ((packed)); - - -struct PMKID_Information_Element { - u16 PMKID_Count; - struct pmkid pmkid[16]; -} __attribute__ ((packed)); - -#endif /* enddef _WPA2_ */ -/*============================================================ -// MAC Frame structure (different type) and subfield structure -//============================================================*/ -struct MAC_frame_control { -/* a combination of the [Protocol Version, Control Type, Control Subtype]*/ - u8 mac_frame_info; -/* 20060927 add by anson's endian */ - #ifdef _BIG_ENDIAN_ - u8 order:1; - u8 WEP:1; - u8 more_data:1; - u8 pwr_mgt:1; - u8 retry:1; - u8 more_frag:1; - u8 from_ds:1; - u8 to_ds:1; - #else - u8 to_ds:1; - u8 from_ds:1; - u8 more_frag:1; - u8 retry:1; - u8 pwr_mgt:1; - u8 more_data:1; - u8 WEP:1; - u8 order:1; - #endif -} __attribute__ ((packed)); - -struct Management_Frame { -/* 2B, ToDS,FromDS,MoreFrag,MoreData,Order=0 */ - struct MAC_frame_control frame_control; - u16 duration; - u8 DA[MAC_ADDR_LENGTH]; /* Addr1 */ - u8 SA[MAC_ADDR_LENGTH]; /* Addr2 */ - u8 BSSID[MAC_ADDR_LENGTH]; /* Addr3 */ - u16 Sequence_Control; - /* Management Frame Body <= 325 bytes */ - /* FCS 4 bytes */ -} __attribute__ ((packed)); - -/* SW-MAC don't Tx/Rx Control-Frame, HW-MAC do it. */ -struct Control_Frame { -/* ToDS,FromDS,MoreFrag,Retry,MoreData,WEP,Order=0 */ - struct MAC_frame_control frame_control; - u16 duration; - u8 RA[MAC_ADDR_LENGTH]; - u8 TA[MAC_ADDR_LENGTH]; - u16 FCS; -} __attribute__ ((packed)); - -struct Data_Frame { - struct MAC_frame_control frame_control; - u16 duration; - u8 Addr1[MAC_ADDR_LENGTH]; - u8 Addr2[MAC_ADDR_LENGTH]; - u8 Addr3[MAC_ADDR_LENGTH]; - u16 Sequence_Control; - u8 Addr4[MAC_ADDR_LENGTH]; /* only exist when ToDS=FromDS=1 */ - /* Data Frame Body <= 2312 */ - /* FCS */ -} __attribute__ ((packed)); - -struct Disassociation_Frame_Body { - u16 reasonCode; -} __attribute__ ((packed)); - -struct Association_Request_Frame_Body { - u16 capability_information; - u16 listenInterval; - u8 Current_AP_Address[MAC_ADDR_LENGTH];/* for reassociation only */ - /* SSID (2+32 bytes) */ - /* Supported_Rates (2+8 bytes) */ -} __attribute__ ((packed)); - -struct Association_Response_Frame_Body { - u16 capability_information; - u16 statusCode; - u16 Association_ID; - struct Supported_Rates_Element supportedRates; -} __attribute__ ((packed)); - -/*struct Reassociation_Request_Frame_Body -{ - u16 capability_information; - u16 listenInterval; - u8 Current_AP_Address[MAC_ADDR_LENGTH]; - // SSID (2+32 bytes) - // Supported_Rates (2+8 bytes) -};*/ -/* eliminated by WS 07/22/04 comboined with associateion request frame. */ - -struct Reassociation_Response_Frame_Body { - u16 capability_information; - u16 statusCode; - u16 Association_ID; - struct Supported_Rates_Element supportedRates; -} __attribute__ ((packed)); - -struct Deauthentication_Frame_Body { - u16 reasonCode; -} __attribute__ ((packed)); - - -struct Probe_Response_Frame_Body { - u16 Timestamp; - u16 Beacon_Interval; - u16 Capability_Information; - /* SSID - // Supported_Rates - // PHY parameter Set (DS Parameters) - // CF parameter Set - // IBSS parameter Set */ -} __attribute__ ((packed)); - -struct Authentication_Frame_Body { - u16 algorithmNumber; - u16 sequenceNumber; - u16 statusCode; - /* NB: don't include ChallengeText in this structure - // struct Challenge_Text_Element sChallengeTextElement; - // wkchen added */ -} __attribute__ ((packed)); - - #endif /* _MAC_Structure_H_ */ - - diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c index 9217762b181..aef0855f4c6 100644 --- a/drivers/staging/winbond/mds.c +++ b/drivers/staging/winbond/mds.c @@ -1,9 +1,7 @@ #include "mds_f.h" -#include "mlmetxrx_f.h" #include "mto.h" -#include "sysdef.h" -#include "wbhal_f.h" -#include "wblinux_f.h" +#include "wbhal.h" +#include "wb35tx_f.h" unsigned char Mds_initial(struct wbsoft_priv *adapter) @@ -17,12 +15,8 @@ Mds_initial(struct wbsoft_priv *adapter) return hal_get_tx_buffer(&adapter->sHwData, &pMds->pTxBuffer); } -void -Mds_Destroy(struct wbsoft_priv *adapter) -{ -} - -static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor *pDes, u8 *buffer) +static void Mds_DurationSet(struct wbsoft_priv *adapter, + struct wb35_descriptor *pDes, u8 *buffer) { struct T00_descriptor *pT00; struct T01_descriptor *pT01; @@ -50,10 +44,11 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor * Set RTS/CTS mechanism ******************************************/ if (!boGroupAddr) { - /* NOTE : If the protection mode is enabled and the MSDU will be fragmented, - * the tx rates of MPDUs will all be DSSS rates. So it will not use - * CTS-to-self in this case. CTS-To-self will only be used when without - * fragmentation. -- 20050112 */ + /* NOTE : If the protection mode is enabled and the MSDU will + * be fragmented, the tx rates of MPDUs will all be DSSS + * rates. So it will not use CTS-to-self in this case. + * CTS-To-self will only be used when without + * fragmentation. -- 20050112 */ BodyLen = (u16)pT00->T00_frame_length; /* include 802.11 header */ BodyLen += 4; /* CRC */ @@ -61,7 +56,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor RTS_on = true; /* Using RTS */ else { if (pT01->T01_modulation_type) { /* Is using OFDM */ - if (CURRENT_PROTECT_MECHANISM) /* Is using protect */ + /* Is using protect */ + if (CURRENT_PROTECT_MECHANISM) CTS_on = true; /* Using CTS */ } } @@ -74,9 +70,9 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor * ACK Rate : 24 Mega bps * ACK frame length = 14 bytes */ Duration = 2*DEFAULT_SIFSTIME + - 2*PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + - ((BodyLen*8 + 22 + Rate*4 - 1)/(Rate*4))*Tsym + - ((112 + 22 + 95)/96)*Tsym; + 2*PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + + ((BodyLen*8 + 22 + Rate*4 - 1)/(Rate*4))*Tsym + + ((112 + 22 + 95)/96)*Tsym; } else { /* DSSS */ /* CTS duration * 2 SIFS + DATA transmit time + 1 ACK @@ -97,18 +93,21 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor * CTS Rate : 24 Mega bps * CTS frame length = 14 bytes */ Duration += (DEFAULT_SIFSTIME + - PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + - ((112 + 22 + 95)/96)*Tsym); + PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION + + ((112 + 22 + 95)/96)*Tsym); } else { /* CTS + 1 SIFS + CTS duration * CTS Rate : ?? Mega bps - * CTS frame length = 14 bytes */ - if (pT01->T01_plcp_header_length) /* long preamble */ + * CTS frame length = 14 bytes + */ + /* long preamble */ + if (pT01->T01_plcp_header_length) Duration += LONG_PREAMBLE_PLUS_PLCPHEADER_TIME; else Duration += SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME; - Duration += (((112 + Rate-1) / Rate) + DEFAULT_SIFSTIME); + Duration += (((112 + Rate-1) / Rate) + + DEFAULT_SIFSTIME); } } @@ -134,9 +133,10 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor * Rate : ??Mega bps * ACK frame length = 14 bytes, tx rate = 24M */ Duration = PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION * 3; - Duration += (((NextBodyLen*8 + 22 + Rate*4 - 1)/(Rate*4)) * Tsym + - (((2*14)*8 + 22 + 95)/96)*Tsym + - DEFAULT_SIFSTIME*3); + Duration += (((NextBodyLen*8 + 22 + Rate*4 - 1) + /(Rate*4)) * Tsym + + (((2*14)*8 + 22 + 95)/96)*Tsym + + DEFAULT_SIFSTIME*3); } else { /* DSSS * data transmit time + 2 ACK + 3 SIFS @@ -148,11 +148,12 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor else Duration = SHORT_PREAMBLE_PLUS_PLCPHEADER_TIME*3; - Duration += (((NextBodyLen + (2*14))*8 + Rate-1) / Rate + - DEFAULT_SIFSTIME*3); + Duration += (((NextBodyLen + (2*14))*8 + + Rate-1) / Rate + + DEFAULT_SIFSTIME*3); } - - ((u16 *)buffer)[5] = cpu_to_le16(Duration); /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + ((u16 *)buffer)[5] = cpu_to_le16(Duration); /* ----20061009 add by anson's endian */ pNextT00->value = cpu_to_le32(pNextT00->value); @@ -161,7 +162,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor buffer += OffsetSize; pT01 = (struct T01_descriptor *)(buffer+4); - if (i != 1) /* The last fragment will not have the next fragment */ + /* The last fragment will not have the next fragment */ + if (i != 1) pNextT00 = (struct T00_descriptor *)(buffer+OffsetSize); } @@ -175,7 +177,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor * ACK frame length = 14 bytes */ Duration = PREAMBLE_PLUS_SIGNAL_PLUS_SIGNALEXTENSION; /* The Tx rate of ACK use 24M */ - Duration += (((112 + 22 + 95)/96)*Tsym + DEFAULT_SIFSTIME); + Duration += (((112 + 22 + 95)/96)*Tsym + + DEFAULT_SIFSTIME); } else { /* DSSS * 1 ACK + 1 SIFS @@ -190,7 +193,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor } } - ((u16 *)buffer)[5] = cpu_to_le16(Duration); /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + /* 4 USHOR for skip 8B USB, 2USHORT=FC + Duration */ + ((u16 *)buffer)[5] = cpu_to_le16(Duration); pT00->value = cpu_to_le32(pT00->value); pT01->value = cpu_to_le32(pT01->value); /* --end 20061009 add */ @@ -198,7 +202,8 @@ static void Mds_DurationSet(struct wbsoft_priv *adapter, struct wb35_descriptor } /* The function return the 4n size of usb pk */ -static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, struct wb35_descriptor *pDes, u8 *TargetBuffer) +static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, + struct wb35_descriptor *pDes, u8 *TargetBuffer) { struct T00_descriptor *pT00; struct wb35_mds *pMds = &adapter->Mds; @@ -221,9 +226,10 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, struct wb35_descriptor *pDe CopySize = SizeLeft; if (SizeLeft > pDes->FragmentThreshold) { CopySize = pDes->FragmentThreshold; - pT00->T00_frame_length = 24 + CopySize; /* Set USB length */ - } else - pT00->T00_frame_length = 24 + SizeLeft; /* Set USB length */ + /* Set USB length */ + pT00->T00_frame_length = 24 + CopySize; + } else /* Set USB length */ + pT00->T00_frame_length = 24 + SizeLeft; SizeLeft -= CopySize; @@ -253,7 +259,7 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, struct wb35_descriptor *pDe buf_index++; buf_index %= MAX_DESCRIPTOR_BUFFER_INDEX; } else { - u8 *pctmp = pDes->buffer_address[buf_index]; + u8 *pctmp = pDes->buffer_address[buf_index]; pctmp += CopySize; pDes->buffer_address[buf_index] = pctmp; pDes->buffer_size[buf_index] -= CopySize; @@ -267,21 +273,27 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, struct wb35_descriptor *pDe /* 931130.5.n */ if (pMds->MicAdd) { if (!SizeLeft) { - pMds->MicWriteAddress[pMds->MicWriteIndex] = buffer - pMds->MicAdd; - pMds->MicWriteSize[pMds->MicWriteIndex] = pMds->MicAdd; + pMds->MicWriteAddress[pMds->MicWriteIndex] = + buffer - pMds->MicAdd; + pMds->MicWriteSize[pMds->MicWriteIndex] = + pMds->MicAdd; pMds->MicAdd = 0; } else if (SizeLeft < 8) { /* 931130.5.p */ pMds->MicAdd = SizeLeft; - pMds->MicWriteAddress[pMds->MicWriteIndex] = buffer - (8 - SizeLeft); - pMds->MicWriteSize[pMds->MicWriteIndex] = 8 - SizeLeft; + pMds->MicWriteAddress[pMds->MicWriteIndex] = + buffer - (8 - SizeLeft); + pMds->MicWriteSize[pMds->MicWriteIndex] = + 8 - SizeLeft; pMds->MicWriteIndex++; } } /* Does it need to generate the new header for next mpdu? */ if (SizeLeft) { - buffer = TargetBuffer + Size; /* Get the next 4n start address */ - memcpy(buffer, TargetBuffer, 32); /* Copy 8B USB +24B 802.11 */ + /* Get the next 4n start address */ + buffer = TargetBuffer + Size; + /* Copy 8B USB +24B 802.11 */ + memcpy(buffer, TargetBuffer, 32); pT00 = (struct T00_descriptor *)buffer; pT00->T00_first_mpdu = 0; } @@ -293,11 +305,13 @@ static u16 Mds_BodyCopy(struct wbsoft_priv *adapter, struct wb35_descriptor *pDe pT00->T00_IsLastMpdu = 1; buffer = (u8 *)pT00 + 8; /* +8 for USB hdr */ buffer[1] &= ~0x04; /* Clear more frag bit of 802.11 frame control */ - pDes->FragmentCount = FragmentCount; /* Update the correct fragment number */ + /* Update the correct fragment number */ + pDes->FragmentCount = FragmentCount; return Size; } -static void Mds_HeaderCopy(struct wbsoft_priv *adapter, struct wb35_descriptor *pDes, u8 *TargetBuffer) +static void Mds_HeaderCopy(struct wbsoft_priv *adapter, + struct wb35_descriptor *pDes, u8 *TargetBuffer) { struct wb35_mds *pMds = &adapter->Mds; u8 *src_buffer = pDes->buffer_address[0]; /* 931130.5.g */ @@ -322,14 +336,15 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, struct wb35_descriptor * pT00->T00_tx_packet_id = pDes->Descriptor_ID; /* Set packet ID */ pT00->T00_header_length = 24; /* Set header length */ - pT01->T01_retry_abort_ebable = 1; /* 921013 931130.5.h */ + pT01->T01_retry_abort_enable = 1; /* 921013 931130.5.h */ /* Key ID setup */ pT01->T01_wep_id = 0; FragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; /* Do not fragment */ /* Copy full data, the 1'st buffer contain all the data 931130.5.j */ - memcpy(TargetBuffer, src_buffer, DOT_11_MAC_HEADER_SIZE); /* Copy header */ + /* Copy header */ + memcpy(TargetBuffer, src_buffer, DOT_11_MAC_HEADER_SIZE); pDes->buffer_address[0] = src_buffer + DOT_11_MAC_HEADER_SIZE; pDes->buffer_total_size -= DOT_11_MAC_HEADER_SIZE; pDes->buffer_size[0] = pDes->buffer_total_size; @@ -350,17 +365,15 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, struct wb35_descriptor * ctmp1 = ctmpf = CURRENT_TX_RATE_FOR_MNG; pDes->TxRate = ctmp1; - #ifdef _PE_TX_DUMP_ - printk("Tx rate =%x\n", ctmp1); - #endif + pr_debug("Tx rate =%x\n", ctmp1); pT01->T01_modulation_type = (ctmp1%3) ? 0 : 1; for (i = 0; i < 2; i++) { if (i == 1) ctmp1 = ctmpf; - - pMds->TxRate[pDes->Descriptor_ID][i] = ctmp1; /* backup the ta rate and fall back rate */ + /* backup the ta rate and fall back rate */ + pMds->TxRate[pDes->Descriptor_ID][i] = ctmp1; if (ctmp1 == 108) ctmp2 = 7; @@ -396,14 +409,55 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, struct wb35_descriptor * /* * Set preamble type */ - if ((pT01->T01_modulation_type == 0) && (pT01->T01_transmit_rate == 0)) /* RATE_1M */ + /* RATE_1M */ + if ((pT01->T01_modulation_type == 0) && (pT01->T01_transmit_rate == 0)) pDes->PreambleMode = WLAN_PREAMBLE_TYPE_LONG; else pDes->PreambleMode = CURRENT_PREAMBLE_MODE; - pT01->T01_plcp_header_length = pDes->PreambleMode; /* Set preamble */ + pT01->T01_plcp_header_length = pDes->PreambleMode; /* Set preamble */ } +static void MLME_GetNextPacket(struct wbsoft_priv *adapter, + struct wb35_descriptor *desc) +{ + desc->InternalUsed = desc->buffer_start_index + desc->buffer_number; + desc->InternalUsed %= MAX_DESCRIPTOR_BUFFER_INDEX; + desc->buffer_address[desc->InternalUsed] = adapter->sMlmeFrame.pMMPDU; + desc->buffer_size[desc->InternalUsed] = adapter->sMlmeFrame.len; + desc->buffer_total_size += adapter->sMlmeFrame.len; + desc->buffer_number++; + desc->Type = adapter->sMlmeFrame.data_type; +} + +static void MLMEfreeMMPDUBuffer(struct wbsoft_priv *adapter, s8 *pData) +{ + int i; + + /* Reclaim the data buffer */ + for (i = 0; i < MAX_NUM_TX_MMPDU; i++) { + if (pData == (s8 *)&(adapter->sMlmeFrame.TxMMPDU[i])) + break; + } + if (adapter->sMlmeFrame.TxMMPDUInUse[i]) + adapter->sMlmeFrame.TxMMPDUInUse[i] = false; + else { + /* Something wrong + PD43 Add debug code here??? */ + } +} + +static void MLME_SendComplete(struct wbsoft_priv *adapter, u8 PacketID, + unsigned char SendOK) +{ + /* Reclaim the data buffer */ + adapter->sMlmeFrame.len = 0; + MLMEfreeMMPDUBuffer(adapter, adapter->sMlmeFrame.pMMPDU); + + /* Return resource */ + adapter->sMlmeFrame.is_in_used = PACKET_FREE_TO_USE; +} + void Mds_Tx(struct wbsoft_priv *adapter) { @@ -411,9 +465,9 @@ Mds_Tx(struct wbsoft_priv *adapter) struct wb35_mds *pMds = &adapter->Mds; struct wb35_descriptor TxDes; struct wb35_descriptor *pTxDes = &TxDes; - u8 *XmitBufAddress; - u16 XmitBufSize, PacketSize, stmp, CurrentSize, FragmentThreshold; - u8 FillIndex, TxDesIndex, FragmentCount, FillCount; + u8 *XmitBufAddress; + u16 XmitBufSize, PacketSize, stmp, CurrentSize, FragmentThreshold; + u8 FillIndex, TxDesIndex, FragmentCount, FillCount; unsigned char BufferFilled = false; @@ -429,14 +483,14 @@ Mds_Tx(struct wbsoft_priv *adapter) /* Start to fill the data */ do { FillIndex = pMds->TxFillIndex; - if (pMds->TxOwner[FillIndex]) { /* Is owned by software 0:Yes 1:No */ -#ifdef _PE_TX_DUMP_ - printk("[Mds_Tx] Tx Owner is H/W.\n"); -#endif + /* Is owned by software 0:Yes 1:No */ + if (pMds->TxOwner[FillIndex]) { + pr_debug("[Mds_Tx] Tx Owner is H/W.\n"); break; } - XmitBufAddress = pMds->pTxBuffer + (MAX_USB_TX_BUFFER * FillIndex); /* Get buffer */ + /* Get buffer */ + XmitBufAddress = pMds->pTxBuffer + (MAX_USB_TX_BUFFER * FillIndex); XmitBufSize = 0; FillCount = 0; do { @@ -448,12 +502,10 @@ Mds_Tx(struct wbsoft_priv *adapter) FragmentThreshold = CURRENT_FRAGMENT_THRESHOLD; /* 931130.5.b */ FragmentCount = PacketSize/FragmentThreshold + 1; - stmp = PacketSize + FragmentCount*32 + 8; /* 931130.5.c 8:MIC */ - if ((XmitBufSize + stmp) >= MAX_USB_TX_BUFFER) { - printk("[Mds_Tx] Excess max tx buffer.\n"); + /* 931130.5.c 8:MIC */ + stmp = PacketSize + FragmentCount*32 + 8; + if ((XmitBufSize + stmp) >= MAX_USB_TX_BUFFER) break; /* buffer is not enough */ - } - /* * Start transmitting @@ -465,20 +517,23 @@ Mds_Tx(struct wbsoft_priv *adapter) TxDesIndex = pMds->TxDesIndex; /* Get the current ID */ pTxDes->Descriptor_ID = TxDesIndex; - pMds->TxDesFrom[TxDesIndex] = 2; /* Storing the information of source comming from */ + /* Storing the information of source coming from */ + pMds->TxDesFrom[TxDesIndex] = 2; pMds->TxDesIndex++; pMds->TxDesIndex %= MAX_USB_TX_DESCRIPTOR; MLME_GetNextPacket(adapter, pTxDes); - /* Copy header. 8byte USB + 24byte 802.11Hdr. Set TxRate, Preamble type */ + /* + * Copy header. 8byte USB + 24byte 802.11Hdr. + * Set TxRate, Preamble type + */ Mds_HeaderCopy(adapter, pTxDes, XmitBufAddress); /* For speed up Key setting */ if (pTxDes->EapFix) { -#ifdef _PE_TX_DUMP_ - printk("35: EPA 4th frame detected. Size = %d\n", PacketSize); -#endif + pr_debug("35: EPA 4th frame detected. Size = %d\n", + PacketSize); pHwData->IsKeyPreSet = 1; } @@ -492,12 +547,9 @@ Mds_Tx(struct wbsoft_priv *adapter) XmitBufSize += CurrentSize; XmitBufAddress += CurrentSize; -#ifdef _IBSS_BEACON_SEQ_STICK_ - if ((XmitBufAddress[DOT_11_DA_OFFSET+8] & 0xfc) != MAC_SUBTYPE_MNGMNT_PROBE_REQUEST) /* +8 for USB hdr */ -#endif - pMds->TxToggle = true; - - /* Get packet to transmit completed, 1:TESTSTA 2:MLME 3: Ndis data */ + /* Get packet to transmit completed, + * 1:TESTSTA 2:MLME 3: Ndis data + */ MLME_SendComplete(adapter, 0, true); /* Software TSC count 20060214 */ @@ -506,7 +558,12 @@ Mds_Tx(struct wbsoft_priv *adapter) pMds->TxTsc_2++; FillCount++; /* 20060928 */ - } while (HAL_USB_MODE_BURST(pHwData)); /* End of multiple MSDU copy loop. false = single true = multiple sending */ + /* + * End of multiple MSDU copy loop. + * false = single + * true = multiple sending + */ + } while (HAL_USB_MODE_BURST(pHwData)); /* Move to the next one, if necessary */ if (BufferFilled) { @@ -549,7 +606,7 @@ Mds_SendComplete(struct wbsoft_priv *adapter, struct T02_descriptor *pT02) unsigned char SendOK = true; u8 RetryCount, TxRate; - if (pT02->T02_IgnoreResult) /* Don't care the result */ + if (pT02->T02_IgnoreResult) /* Don't care about the result */ return; if (pT02->T02_IsLastMpdu) { /* TODO: DTO -- get the retry count and fragment count */ @@ -567,9 +624,8 @@ Mds_SendComplete(struct wbsoft_priv *adapter, struct T02_descriptor *pT02) pHwData->tx_retry_count[RetryCount] += RetryCount; else pHwData->tx_retry_count[7] += RetryCount; - #ifdef _PE_STATE_DUMP_ - printk("dto_tx_retry_count =%d\n", pHwData->dto_tx_retry_count); - #endif + pr_debug("dto_tx_retry_count =%d\n", + pHwData->dto_tx_retry_count); MTO_SetTxCount(adapter, TxRate, RetryCount); } pHwData->dto_tx_frag_count += (RetryCount+1); diff --git a/drivers/staging/winbond/mds_f.h b/drivers/staging/winbond/mds_f.h index 7f68deae6d0..159b2eb366e 100644 --- a/drivers/staging/winbond/mds_f.h +++ b/drivers/staging/winbond/mds_f.h @@ -1,20 +1,22 @@ #ifndef __WINBOND_MDS_F_H #define __WINBOND_MDS_F_H -#include "wbhal_s.h" +#include "wbhal.h" #include "core.h" unsigned char Mds_initial(struct wbsoft_priv *adapter); -void Mds_Destroy(struct wbsoft_priv *adapter); void Mds_Tx(struct wbsoft_priv *adapter); void Mds_SendComplete(struct wbsoft_priv *adapter, struct T02_descriptor *pt02); -void Mds_MpduProcess(struct wbsoft_priv *adapter, struct wb35_descriptor *prxdes); -extern void DataDmp(u8 *pdata, u32 len, u32 offset); +void Mds_MpduProcess(struct wbsoft_priv *adapter, + struct wb35_descriptor *prxdes); /* For data frame sending */ u16 MDS_GetPacketSize(struct wbsoft_priv *adapter); -void MDS_GetNextPacket(struct wbsoft_priv *adapter, struct wb35_descriptor *pdes); -void MDS_GetNextPacketComplete(struct wbsoft_priv *adapter, struct wb35_descriptor *pdes); -void MDS_SendResult(struct wbsoft_priv *adapter, u8 packetid, unsigned char sendok); +void MDS_GetNextPacket(struct wbsoft_priv *adapter, + struct wb35_descriptor *pdes); +void MDS_GetNextPacketComplete(struct wbsoft_priv *adapter, + struct wb35_descriptor *pdes); +void MDS_SendResult(struct wbsoft_priv *adapter, u8 packetid, + unsigned char sendok); #endif diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h index e2de4bd23b4..2972d66c943 100644 --- a/drivers/staging/winbond/mds_s.h +++ b/drivers/staging/winbond/mds_s.h @@ -3,7 +3,7 @@ #include <linux/timer.h> #include <linux/types.h> -#include <asm/atomic.h> +#include <linux/atomic.h> #include "localpara.h" #include "mac_structures.h" @@ -40,7 +40,7 @@ enum { /* * ================================================================ - * Configration default value + * Configuration default value * ================================================================ */ #define DEFAULT_MULTICASTLISTMAX 32 /* standard */ @@ -107,10 +107,6 @@ struct wb35_mds { u8 TxRate[((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01)][2]; /* [0] current tx rate, [1] fall back rate */ u8 TxInfo[((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01)]; /*Store information for callback function */ - /* for scanning mechanism */ - u8 TxToggle; /* It is TRUE if there are tx activities in some time interval */ - u8 Reserved_[3]; - /* ---- for Tx Parameter */ u16 TxFragmentThreshold; /* For frame body only */ u16 TxRTSThreshold; diff --git a/drivers/staging/winbond/mlmetxrx.c b/drivers/staging/winbond/mlmetxrx.c deleted file mode 100644 index 7425a23f12e..00000000000 --- a/drivers/staging/winbond/mlmetxrx.c +++ /dev/null @@ -1,62 +0,0 @@ -/* ============================================================================ - Module Name: - MLMETxRx.C - - Description: - The interface between MDS (MAC Data Service) and MLME. - - Revision History: - -------------------------------------------------------------------------- - 200209 UN20 Jennifer Xu - Initial Release - 20021108 PD43 Austin Liu - 20030117 PD43 Austin Liu - Deleted MLMEReturnPacket and MLMEProcThread() - - Copyright (c) 1996-2002 Winbond Electronics Corp. All Rights Reserved. -============================================================================ */ -#include "sysdef.h" - -#include "mds_f.h" - -void MLME_GetNextPacket(struct wbsoft_priv *adapter, struct wb35_descriptor *desc) -{ - desc->InternalUsed = desc->buffer_start_index + desc->buffer_number; - desc->InternalUsed %= MAX_DESCRIPTOR_BUFFER_INDEX; - desc->buffer_address[desc->InternalUsed] = adapter->sMlmeFrame.pMMPDU; - desc->buffer_size[desc->InternalUsed] = adapter->sMlmeFrame.len; - desc->buffer_total_size += adapter->sMlmeFrame.len; - desc->buffer_number++; - desc->Type = adapter->sMlmeFrame.DataType; -} - -static void MLMEfreeMMPDUBuffer(struct wbsoft_priv *adapter, s8 *pData) -{ - int i; - - /* Reclaim the data buffer */ - for (i = 0; i < MAX_NUM_TX_MMPDU; i++) { - if (pData == (s8 *)&(adapter->sMlmeFrame.TxMMPDU[i])) - break; - } - if (adapter->sMlmeFrame.TxMMPDUInUse[i]) - adapter->sMlmeFrame.TxMMPDUInUse[i] = false; - else { - /* Something wrong - PD43 Add debug code here??? */ - } -} - -void -MLME_SendComplete(struct wbsoft_priv *adapter, u8 PacketID, unsigned char SendOK) -{ - /* Reclaim the data buffer */ - adapter->sMlmeFrame.len = 0; - MLMEfreeMMPDUBuffer(adapter, adapter->sMlmeFrame.pMMPDU); - - /* Return resource */ - adapter->sMlmeFrame.IsInUsed = PACKET_FREE_TO_USE; -} - - - diff --git a/drivers/staging/winbond/mlmetxrx_f.h b/drivers/staging/winbond/mlmetxrx_f.h deleted file mode 100644 index 012507fc49e..00000000000 --- a/drivers/staging/winbond/mlmetxrx_f.h +++ /dev/null @@ -1,23 +0,0 @@ -/* ================================================================ -// MLMETxRx.H -- -// -// Functions defined in MLMETxRx.c. -// -// Copyright (c) 2002 Winbond Electrics Corp. All Rights Reserved. -//================================================================ */ -#ifndef _MLMETXRX_H -#define _MLMETXRX_H - -#include "core.h" - -void MLME_GetNextPacket(struct wbsoft_priv *adapter, struct wb35_descriptor *pDes); - -void -MLME_SendComplete(struct wbsoft_priv *adapter, u8 PacketID, - unsigned char SendOK); - -#ifdef _IBSS_BEACON_SEQ_STICK_ -s8 SendBCNullData(struct wbsoft_priv *adapter, u16 wIdx); -#endif - -#endif diff --git a/drivers/staging/winbond/mto.c b/drivers/staging/winbond/mto.c index 9cd212783d6..b031ecd4f3c 100644 --- a/drivers/staging/winbond/mto.c +++ b/drivers/staging/winbond/mto.c @@ -17,12 +17,14 @@ * ============================================================================ */ -#include "sysdef.h" #include "sme_api.h" -#include "wbhal_f.h" +#include "wbhal.h" +#include "wb35reg_f.h" +#include "core.h" +#include "mto.h" /* Declare SQ3 to rate and fragmentation threshold table */ -/* Declare fragmentation thresholds table */ +/* Declare fragmentation threshold table */ #define MTO_MAX_FRAG_TH_LEVELS 5 #define MTO_MAX_DATA_RATE_LEVELS 12 @@ -32,29 +34,18 @@ u16 MTO_Frag_Th_Tbl[MTO_MAX_FRAG_TH_LEVELS] = { /* * Declare data rate table: - * The following table will be changed at anytime if the opration rate + * The following table will be changed at anytime if the operation rate * supported by AP don't match the table */ static u8 MTO_Data_Rate_Tbl[MTO_MAX_DATA_RATE_LEVELS] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; -static int TotalTxPkt; -static int TotalTxPktRetry; /* this record the retry rate at different data rate */ static int retryrate_rec[MTO_MAX_DATA_RATE_LEVELS]; -static int PeriodTotalTxPkt; -static int PeriodTotalTxPktRetry; - static u8 boSparseTxTraffic; -void MTO_Init(struct wbsoft_priv *adapter); -void TxRateReductionCtrl(struct wbsoft_priv *adapter); -void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index); -void MTO_TxFailed(struct wbsoft_priv *adapter); -void hal_get_dto_para(struct wbsoft_priv *adapter, char *buffer); - /* * =========================================================================== * MTO_Init -- @@ -173,9 +164,4 @@ void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 tx_rate, u8 index) MTO_HAL()->dto_tx_retry_count += index; MTO_HAL()->dto_tx_frag_count += (index + 1); } - TotalTxPkt++; - TotalTxPktRetry += (index + 1); - - PeriodTotalTxPkt++; - PeriodTotalTxPktRetry += (index + 1); } diff --git a/drivers/staging/winbond/mto.h b/drivers/staging/winbond/mto.h index a0f659cf99f..8d41eeda45b 100644 --- a/drivers/staging/winbond/mto.h +++ b/drivers/staging/winbond/mto.h @@ -127,12 +127,8 @@ extern u16 MTO_Frag_Th_Tbl[]; #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()] #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()] -extern void MTO_Init(struct wbsoft_priv *); -extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *); -extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8); -extern u8 MTO_GetTxRate(struct wbsoft_priv *adapter, u32 fpdu_len); -extern u8 MTO_GetTxFallbackRate(struct wbsoft_priv *adapter); -extern void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index); +void MTO_Init(struct wbsoft_priv *); +void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index); #endif /* __MTO_H__ */ diff --git a/drivers/staging/winbond/phy_calibration.c b/drivers/staging/winbond/phy_calibration.c index 2b375ba3812..8aecced62dd 100644 --- a/drivers/staging/winbond/phy_calibration.c +++ b/drivers/staging/winbond/phy_calibration.c @@ -10,9 +10,10 @@ */ /****************** INCLUDE FILES SECTION ***********************************/ -#include "sysdef.h" #include "phy_calibration.h" -#include "wbhal_f.h" +#include "wbhal.h" +#include "wb35reg_f.h" +#include "core.h" /****************** DEBUG CONSTANT AND MACRO SECTION ************************/ @@ -23,13 +24,15 @@ #define AG_CONST 0.6072529350 #define FIXED(X) ((s32)((X) * 32768.0)) -#define DEG2RAD(X) 0.017453 * (X) +#define DEG2RAD(X) (0.017453 * (X)) static const s32 Angles[] = { - FIXED(DEG2RAD(45.0)), FIXED(DEG2RAD(26.565)), FIXED(DEG2RAD(14.0362)), - FIXED(DEG2RAD(7.12502)), FIXED(DEG2RAD(3.57633)), FIXED(DEG2RAD(1.78991)), - FIXED(DEG2RAD(0.895174)), FIXED(DEG2RAD(0.447614)), FIXED(DEG2RAD(0.223811)), - FIXED(DEG2RAD(0.111906)), FIXED(DEG2RAD(0.055953)), FIXED(DEG2RAD(0.027977)) + FIXED(DEG2RAD(45.0)), FIXED(DEG2RAD(26.565)), + FIXED(DEG2RAD(14.0362)), FIXED(DEG2RAD(7.12502)), + FIXED(DEG2RAD(3.57633)), FIXED(DEG2RAD(1.78991)), + FIXED(DEG2RAD(0.895174)), FIXED(DEG2RAD(0.447614)), + FIXED(DEG2RAD(0.223811)), FIXED(DEG2RAD(0.111906)), + FIXED(DEG2RAD(0.055953)), FIXED(DEG2RAD(0.027977)) }; /****************** LOCAL FUNCTION DECLARATION SECTION **********************/ @@ -41,261 +44,221 @@ static const s32 Angles[] = { /****************** FUNCTION DEFINITION SECTION *****************************/ -s32 _s13_to_s32(u32 data) +static s32 _s13_to_s32(u32 data) { - u32 val; + u32 val; - val = (data & 0x0FFF); + val = (data & 0x0FFF); - if ((data & BIT(12)) != 0) - val |= 0xFFFFF000; + if ((data & BIT(12)) != 0) + val |= 0xFFFFF000; - return ((s32) val); + return (s32) val; } -u32 _s32_to_s13(s32 data) +/****************************************************************************/ +static s32 _s4_to_s32(u32 data) { - u32 val; + s32 val; - if (data > 4095) - data = 4095; - else if (data < -4096) - data = -4096; + val = (data & 0x0007); - val = data & 0x1FFF; + if ((data & BIT(3)) != 0) + val |= 0xFFFFFFF8; - return val; + return val; } -/****************************************************************************/ -s32 _s4_to_s32(u32 data) +static u32 _s32_to_s4(s32 data) { - s32 val; + u32 val; - val = (data & 0x0007); + if (data > 7) + data = 7; + else if (data < -8) + data = -8; - if ((data & BIT(3)) != 0) - val |= 0xFFFFFFF8; + val = data & 0x000F; - return val; + return val; } -u32 _s32_to_s4(s32 data) +/****************************************************************************/ +static s32 _s5_to_s32(u32 data) { - u32 val; + s32 val; - if (data > 7) - data = 7; - else if (data < -8) - data = -8; + val = (data & 0x000F); - val = data & 0x000F; + if ((data & BIT(4)) != 0) + val |= 0xFFFFFFF0; - return val; + return val; } -/****************************************************************************/ -s32 _s5_to_s32(u32 data) +static u32 _s32_to_s5(s32 data) { - s32 val; + u32 val; - val = (data & 0x000F); + if (data > 15) + data = 15; + else if (data < -16) + data = -16; - if ((data & BIT(4)) != 0) - val |= 0xFFFFFFF0; + val = data & 0x001F; - return val; + return val; } -u32 _s32_to_s5(s32 data) +/****************************************************************************/ +static s32 _s6_to_s32(u32 data) { - u32 val; + s32 val; - if (data > 15) - data = 15; - else if (data < -16) - data = -16; + val = (data & 0x001F); - val = data & 0x001F; + if ((data & BIT(5)) != 0) + val |= 0xFFFFFFE0; - return val; + return val; } -/****************************************************************************/ -s32 _s6_to_s32(u32 data) +static u32 _s32_to_s6(s32 data) { - s32 val; + u32 val; - val = (data & 0x001F); + if (data > 31) + data = 31; + else if (data < -32) + data = -32; - if ((data & BIT(5)) != 0) - val |= 0xFFFFFFE0; + val = data & 0x003F; - return val; + return val; } -u32 _s32_to_s6(s32 data) +/****************************************************************************/ +static s32 _floor(s32 n) { - u32 val; - - if (data > 31) - data = 31; - else if (data < -32) - data = -32; - - val = data & 0x003F; + if (n > 0) + n += 5; + else + n -= 5; - return val; + return n/10; } /****************************************************************************/ -s32 _s9_to_s32(u32 data) +/* + * The following code is sqare-root function. + * sqsum is the input and the output is sq_rt; + * The maximum of sqsum = 2^27 -1; + */ +static u32 _sqrt(u32 sqsum) { - s32 val; + u32 sq_rt; + + int g0, g1, g2, g3, g4; + int seed; + int next; + int step; + + g4 = sqsum / 100000000; + g3 = (sqsum - g4*100000000) / 1000000; + g2 = (sqsum - g4*100000000 - g3*1000000) / 10000; + g1 = (sqsum - g4*100000000 - g3*1000000 - g2*10000) / 100; + g0 = (sqsum - g4*100000000 - g3*1000000 - g2*10000 - g1*100); + + next = g4; + step = 0; + seed = 0; + while (((seed+1)*(step+1)) <= next) { + step++; + seed++; + } - val = data & 0x00FF; + sq_rt = seed * 10000; + next = (next-(seed*step))*100 + g3; - if ((data & BIT(8)) != 0) - val |= 0xFFFFFF00; + step = 0; + seed = 2 * seed * 10; + while (((seed+1)*(step+1)) <= next) { + step++; + seed++; + } - return val; -} + sq_rt = sq_rt + step * 1000; + next = (next - seed * step) * 100 + g2; + seed = (seed + step) * 10; + step = 0; + while (((seed+1)*(step+1)) <= next) { + step++; + seed++; + } -u32 _s32_to_s9(s32 data) -{ - u32 val; + sq_rt = sq_rt + step * 100; + next = (next - seed * step) * 100 + g1; + seed = (seed + step) * 10; + step = 0; - if (data > 255) - data = 255; - else if (data < -256) - data = -256; + while (((seed+1)*(step+1)) <= next) { + step++; + seed++; + } - val = data & 0x01FF; + sq_rt = sq_rt + step * 10; + next = (next - seed * step) * 100 + g0; + seed = (seed + step) * 10; + step = 0; - return val; -} + while (((seed+1)*(step+1)) <= next) { + step++; + seed++; + } -/****************************************************************************/ -s32 _floor(s32 n) -{ - if (n > 0) - n += 5; - else - n -= 5; + sq_rt = sq_rt + step; - return (n/10); + return sq_rt; } /****************************************************************************/ -/* - * The following code is sqare-root function. - * sqsum is the input and the output is sq_rt; - * The maximum of sqsum = 2^27 -1; - */ -u32 _sqrt(u32 sqsum) +static void _sin_cos(s32 angle, s32 *sin, s32 *cos) { - u32 sq_rt; - - int g0, g1, g2, g3, g4; - int seed; - int next; - int step; - - g4 = sqsum / 100000000; - g3 = (sqsum - g4*100000000) / 1000000; - g2 = (sqsum - g4*100000000 - g3*1000000) / 10000; - g1 = (sqsum - g4*100000000 - g3*1000000 - g2*10000) / 100; - g0 = (sqsum - g4*100000000 - g3*1000000 - g2*10000 - g1*100); - - next = g4; - step = 0; - seed = 0; - while (((seed+1)*(step+1)) <= next) { - step++; - seed++; - } - - sq_rt = seed * 10000; - next = (next-(seed*step))*100 + g3; - - step = 0; - seed = 2 * seed * 10; - while (((seed+1)*(step+1)) <= next) { - step++; - seed++; - } - - sq_rt = sq_rt + step * 1000; - next = (next - seed * step) * 100 + g2; - seed = (seed + step) * 10; - step = 0; - while (((seed+1)*(step+1)) <= next) { - step++; - seed++; - } - - sq_rt = sq_rt + step * 100; - next = (next - seed * step) * 100 + g1; - seed = (seed + step) * 10; - step = 0; - - while (((seed+1)*(step+1)) <= next) { - step++; - seed++; - } - - sq_rt = sq_rt + step * 10; - next = (next - seed * step) * 100 + g0; - seed = (seed + step) * 10; - step = 0; - - while (((seed+1)*(step+1)) <= next) { - step++; - seed++; - } - - sq_rt = sq_rt + step; - - return sq_rt; -} + s32 X, Y, TargetAngle, CurrAngle; + unsigned Step; + + X = FIXED(AG_CONST); /* AG_CONST * cos(0) */ + Y = 0; /* AG_CONST * sin(0) */ + TargetAngle = abs(angle); + CurrAngle = 0; + + for (Step = 0; Step < 12; Step++) { + s32 NewX; + + if (TargetAngle > CurrAngle) { + NewX = X - (Y >> Step); + Y = (X >> Step) + Y; + X = NewX; + CurrAngle += Angles[Step]; + } else { + NewX = X + (Y >> Step); + Y = -(X >> Step) + Y; + X = NewX; + CurrAngle -= Angles[Step]; + } + } -/****************************************************************************/ -void _sin_cos(s32 angle, s32 *sin, s32 *cos) -{ - s32 X, Y, TargetAngle, CurrAngle; - unsigned Step; - - X = FIXED(AG_CONST); /* AG_CONST * cos(0) */ - Y = 0; /* AG_CONST * sin(0) */ - TargetAngle = abs(angle); - CurrAngle = 0; - - for (Step = 0; Step < 12; Step++) { - s32 NewX; - - if (TargetAngle > CurrAngle) { - NewX = X - (Y >> Step); - Y = (X >> Step) + Y; - X = NewX; - CurrAngle += Angles[Step]; - } else { - NewX = X + (Y >> Step); - Y = -(X >> Step) + Y; - X = NewX; - CurrAngle -= Angles[Step]; - } - } - - if (angle > 0) { - *cos = X; - *sin = Y; - } else { - *cos = X; - *sin = -Y; - } + if (angle > 0) { + *cos = X; + *sin = Y; + } else { + *cos = X; + *sin = -Y; + } } -static unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue) +static unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, + u32 *pValue) { if (number < 0x1000) number += 0x1000; @@ -303,7 +266,8 @@ static unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * } #define hw_get_dxx_reg(_A, _B, _C) hal_get_dxx_reg(_A, _B, (u32 *)_C) -static unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 value) +static unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, + u32 value) { unsigned char ret; @@ -315,7 +279,7 @@ static unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 va #define hw_set_dxx_reg(_A, _B, _C) hal_set_dxx_reg(_A, _B, (u32)_C) -void _reset_rx_cal(struct hw_data *phw_data) +static void _reset_rx_cal(struct hw_data *phw_data) { u32 val; @@ -335,26 +299,26 @@ void _reset_rx_cal(struct hw_data *phw_data) /**********************************************/ -void _rxadc_dc_offset_cancellation_winbond(struct hw_data *phw_data, u32 frequency) +static void _rxadc_dc_offset_cancellation_winbond(struct hw_data *phw_data, u32 frequency) { - u32 reg_agc_ctrl3; - u32 reg_a_acq_ctrl; - u32 reg_b_acq_ctrl; - u32 val; + u32 reg_agc_ctrl3; + u32 reg_a_acq_ctrl; + u32 reg_b_acq_ctrl; + u32 val; - PHY_DEBUG(("[CAL] -> [1]_rxadc_dc_offset_cancellation()\n")); - phy_init_rf(phw_data); + PHY_DEBUG(("[CAL] -> [1]_rxadc_dc_offset_cancellation()\n")); + phy_init_rf(phw_data); - /* set calibration channel */ - if ((RF_WB_242 == phw_data->phy_type) || + /* set calibration channel */ + if ((RF_WB_242 == phw_data->phy_type) || (RF_WB_242_1 == phw_data->phy_type)) /* 20060619.5 Add */{ - if ((frequency >= 2412) && (frequency <= 2484)) { - /* w89rf242 change frequency to 2390Mhz */ - PHY_DEBUG(("[CAL] W89RF242/11G/Channel=2390Mhz\n")); + if ((frequency >= 2412) && (frequency <= 2484)) { + /* w89rf242 change frequency to 2390Mhz */ + PHY_DEBUG(("[CAL] W89RF242/11G/Channel=2390Mhz\n")); phy_set_rf_data(phw_data, 3, (3<<24)|0x025586); - } - } else { + } + } else { } @@ -398,7 +362,7 @@ void _rxadc_dc_offset_cancellation_winbond(struct hw_data *phw_data, u32 frequen val |= MASK_ADC_DC_CAL_STR; hw_set_dxx_reg(phw_data, REG_MODE_CTRL, val); - /* e. The result are shown in "adc_dc_cal_i[8:0] and adc_dc_cal_q[8:0]" */ + /* e. The results are shown in "adc_dc_cal_i[8:0] and adc_dc_cal_q[8:0]" */ #ifdef _DEBUG hw_get_dxx_reg(phw_data, REG_OFFSET_READ, &val); PHY_DEBUG(("[CAL] REG_OFFSET_READ = 0x%08X\n", val)); @@ -406,7 +370,8 @@ void _rxadc_dc_offset_cancellation_winbond(struct hw_data *phw_data, u32 frequen PHY_DEBUG(("[CAL] ** adc_dc_cal_i = %d (0x%04X)\n", _s9_to_s32(val&0x000001FF), val&0x000001FF)); PHY_DEBUG(("[CAL] ** adc_dc_cal_q = %d (0x%04X)\n", - _s9_to_s32((val&0x0003FE00)>>9), (val&0x0003FE00)>>9)); + _s9_to_s32((val&0x0003FE00)>>9), + (val&0x0003FE00)>>9)); #endif hw_get_dxx_reg(phw_data, REG_MODE_CTRL, &val); @@ -429,249 +394,8 @@ void _rxadc_dc_offset_cancellation_winbond(struct hw_data *phw_data, u32 frequen hw_set_dxx_reg(phw_data, REG_AGC_CTRL3, reg_agc_ctrl3); } -/****************************************************************/ -void _txidac_dc_offset_cancellation_winbond(struct hw_data *phw_data) -{ - u32 reg_agc_ctrl3; - u32 reg_mode_ctrl; - u32 reg_dc_cancel; - s32 iqcal_image_i; - s32 iqcal_image_q; - u32 sqsum; - s32 mag_0; - s32 mag_1; - s32 fix_cancel_dc_i = 0; - u32 val; - int loop; - - PHY_DEBUG(("[CAL] -> [2]_txidac_dc_offset_cancellation()\n")); - - /* a. Set to "TX calibration mode" */ - - /* 0x01 0xEE3FC2 ; 3B8FF ; Calibration (6a). enable TX IQ calibration loop circuits */ - phy_set_rf_data(phw_data, 1, (1<<24)|0xEE3FC2); - /* 0x0B 0x1905D6 ; 06417 ; Calibration (6b). enable TX I/Q cal loop squaring circuit */ - phy_set_rf_data(phw_data, 11, (11<<24)|0x1901D6); - /* 0x05 0x24C60A ; 09318 ; Calibration (6c). setting TX-VGA gain: TXGCH=2 & GPK=110 --> to be optimized */ - phy_set_rf_data(phw_data, 5, (5<<24)|0x24C48A); - /* 0x06 0x06880C ; 01A20 ; Calibration (6d). RXGCH=00; RXGCL=100 000 (RXVGA=32) --> to be optimized */ - phy_set_rf_data(phw_data, 6, (6<<24)|0x06890C); - /* 0x00 0xFDF1C0 ; 3F7C7 ; Calibration (6e). turn on IQ imbalance/Test mode */ - phy_set_rf_data(phw_data, 0, (0<<24)|0xFDF1C0); - - hw_set_dxx_reg(phw_data, 0x58, 0x30303030); /* IQ_Alpha Changed */ - - /* a. Disable AGC */ - hw_get_dxx_reg(phw_data, REG_AGC_CTRL3, ®_agc_ctrl3); - reg_agc_ctrl3 &= ~BIT(2); - reg_agc_ctrl3 |= (MASK_LNA_FIX_GAIN|MASK_AGC_FIX); - hw_set_dxx_reg(phw_data, REG_AGC_CTRL3, reg_agc_ctrl3); - - hw_get_dxx_reg(phw_data, REG_AGC_CTRL5, &val); - val |= MASK_AGC_FIX_GAIN; - hw_set_dxx_reg(phw_data, REG_AGC_CTRL5, val); - - /* b. set iqcal_mode[1:0] to 0x2 and set iqcal_tone[3:2] to 0 */ - hw_get_dxx_reg(phw_data, REG_MODE_CTRL, ®_mode_ctrl); - - PHY_DEBUG(("[CAL] MODE_CTRL (read) = 0x%08X\n", reg_mode_ctrl)); - reg_mode_ctrl &= ~(MASK_IQCAL_TONE_SEL|MASK_IQCAL_MODE); - - /* mode=2, tone=0 */ - /* reg_mode_ctrl |= (MASK_CALIB_START|2); */ - - /* mode=2, tone=1 */ - /* reg_mode_ctrl |= (MASK_CALIB_START|2|(1<<2)); */ - - /* mode=2, tone=2 */ - reg_mode_ctrl |= (MASK_CALIB_START|2|(2<<2)); - hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl); - PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); - - hw_get_dxx_reg(phw_data, 0x5C, ®_dc_cancel); - PHY_DEBUG(("[CAL] DC_CANCEL (read) = 0x%08X\n", reg_dc_cancel)); - - for (loop = 0; loop < LOOP_TIMES; loop++) { - PHY_DEBUG(("[CAL] [%d.] ==================================\n", loop)); - - /* c. reset cancel_dc_i[9:5] and cancel_dc_q[4:0] in register DC_Cancel */ - reg_dc_cancel &= ~(0x03FF); - PHY_DEBUG(("[CAL] DC_CANCEL (write) = 0x%08X\n", reg_dc_cancel)); - hw_set_dxx_reg(phw_data, 0x5C, reg_dc_cancel); - - hw_get_dxx_reg(phw_data, REG_CALIB_READ2, &val); - PHY_DEBUG(("[CAL] CALIB_READ2 = 0x%08X\n", val)); - - iqcal_image_i = _s13_to_s32(val & 0x00001FFF); - iqcal_image_q = _s13_to_s32((val & 0x03FFE000) >> 13); - sqsum = iqcal_image_i*iqcal_image_i + iqcal_image_q*iqcal_image_q; - mag_0 = (s32) _sqrt(sqsum); - PHY_DEBUG(("[CAL] mag_0=%d (iqcal_image_i=%d, iqcal_image_q=%d)\n", - mag_0, iqcal_image_i, iqcal_image_q)); - - /* d. */ - reg_dc_cancel |= (1 << CANCEL_DC_I_SHIFT); - PHY_DEBUG(("[CAL] DC_CANCEL (write) = 0x%08X\n", reg_dc_cancel)); - hw_set_dxx_reg(phw_data, 0x5C, reg_dc_cancel); - - hw_get_dxx_reg(phw_data, REG_CALIB_READ2, &val); - PHY_DEBUG(("[CAL] CALIB_READ2 = 0x%08X\n", val)); - - iqcal_image_i = _s13_to_s32(val & 0x00001FFF); - iqcal_image_q = _s13_to_s32((val & 0x03FFE000) >> 13); - sqsum = iqcal_image_i*iqcal_image_i + iqcal_image_q*iqcal_image_q; - mag_1 = (s32) _sqrt(sqsum); - PHY_DEBUG(("[CAL] mag_1=%d (iqcal_image_i=%d, iqcal_image_q=%d)\n", - mag_1, iqcal_image_i, iqcal_image_q)); - - /* e. Calculate the correct DC offset cancellation value for I */ - if (mag_0 != mag_1) - fix_cancel_dc_i = (mag_0*10000) / (mag_0*10000 - mag_1*10000); - else { - if (mag_0 == mag_1) - PHY_DEBUG(("[CAL] ***** mag_0 = mag_1 !!\n")); - fix_cancel_dc_i = 0; - } - - PHY_DEBUG(("[CAL] ** fix_cancel_dc_i = %d (0x%04X)\n", - fix_cancel_dc_i, _s32_to_s5(fix_cancel_dc_i))); - - if ((abs(mag_1-mag_0)*6) > mag_0) - break; - } - - if (loop >= 19) - fix_cancel_dc_i = 0; - - reg_dc_cancel &= ~(0x03FF); - reg_dc_cancel |= (_s32_to_s5(fix_cancel_dc_i) << CANCEL_DC_I_SHIFT); - hw_set_dxx_reg(phw_data, 0x5C, reg_dc_cancel); - PHY_DEBUG(("[CAL] DC_CANCEL (write) = 0x%08X\n", reg_dc_cancel)); - - /* g. */ - reg_mode_ctrl &= ~MASK_CALIB_START; - hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl); - PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); -} - -/*****************************************************/ -void _txqdac_dc_offset_cacellation_winbond(struct hw_data *phw_data) -{ - u32 reg_agc_ctrl3; - u32 reg_mode_ctrl; - u32 reg_dc_cancel; - s32 iqcal_image_i; - s32 iqcal_image_q; - u32 sqsum; - s32 mag_0; - s32 mag_1; - s32 fix_cancel_dc_q = 0; - u32 val; - int loop; - - PHY_DEBUG(("[CAL] -> [3]_txqdac_dc_offset_cacellation()\n")); - /*0x01 0xEE3FC2 ; 3B8FF ; Calibration (6a). enable TX IQ calibration loop circuits */ - phy_set_rf_data(phw_data, 1, (1<<24)|0xEE3FC2); - /* 0x0B 0x1905D6 ; 06417 ; Calibration (6b). enable TX I/Q cal loop squaring circuit */ - phy_set_rf_data(phw_data, 11, (11<<24)|0x1901D6); - /* 0x05 0x24C60A ; 09318 ; Calibration (6c). setting TX-VGA gain: TXGCH=2 & GPK=110 --> to be optimized */ - phy_set_rf_data(phw_data, 5, (5<<24)|0x24C48A); - /* 0x06 0x06880C ; 01A20 ; Calibration (6d). RXGCH=00; RXGCL=100 000 (RXVGA=32) --> to be optimized */ - phy_set_rf_data(phw_data, 6, (6<<24)|0x06890C); - /* 0x00 0xFDF1C0 ; 3F7C7 ; Calibration (6e). turn on IQ imbalance/Test mode */ - phy_set_rf_data(phw_data, 0, (0<<24)|0xFDF1C0); - - hw_set_dxx_reg(phw_data, 0x58, 0x30303030); /* IQ_Alpha Changed */ - - /* a. Disable AGC */ - hw_get_dxx_reg(phw_data, REG_AGC_CTRL3, ®_agc_ctrl3); - reg_agc_ctrl3 &= ~BIT(2); - reg_agc_ctrl3 |= (MASK_LNA_FIX_GAIN|MASK_AGC_FIX); - hw_set_dxx_reg(phw_data, REG_AGC_CTRL3, reg_agc_ctrl3); - - hw_get_dxx_reg(phw_data, REG_AGC_CTRL5, &val); - val |= MASK_AGC_FIX_GAIN; - hw_set_dxx_reg(phw_data, REG_AGC_CTRL5, val); - - /* a. set iqcal_mode[1:0] to 0x3 and set iqcal_tone[3:2] to 0 */ - hw_get_dxx_reg(phw_data, REG_MODE_CTRL, ®_mode_ctrl); - PHY_DEBUG(("[CAL] MODE_CTRL (read) = 0x%08X\n", reg_mode_ctrl)); - - /* reg_mode_ctrl &= ~(MASK_IQCAL_TONE_SEL|MASK_IQCAL_MODE); */ - reg_mode_ctrl &= ~(MASK_IQCAL_MODE); - reg_mode_ctrl |= (MASK_CALIB_START|3); - hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl); - PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); - - hw_get_dxx_reg(phw_data, 0x5C, ®_dc_cancel); - PHY_DEBUG(("[CAL] DC_CANCEL (read) = 0x%08X\n", reg_dc_cancel)); - - for (loop = 0; loop < LOOP_TIMES; loop++) { - PHY_DEBUG(("[CAL] [%d.] ==================================\n", loop)); - - /* b. reset cancel_dc_q[4:0] in register DC_Cancel */ - reg_dc_cancel &= ~(0x001F); - PHY_DEBUG(("[CAL] DC_CANCEL (write) = 0x%08X\n", reg_dc_cancel)); - hw_set_dxx_reg(phw_data, 0x5C, reg_dc_cancel); - - hw_get_dxx_reg(phw_data, REG_CALIB_READ2, &val); - PHY_DEBUG(("[CAL] CALIB_READ2 = 0x%08X\n", val)); - - iqcal_image_i = _s13_to_s32(val & 0x00001FFF); - iqcal_image_q = _s13_to_s32((val & 0x03FFE000) >> 13); - sqsum = iqcal_image_i*iqcal_image_i + iqcal_image_q*iqcal_image_q; - mag_0 = _sqrt(sqsum); - PHY_DEBUG(("[CAL] mag_0=%d (iqcal_image_i=%d, iqcal_image_q=%d)\n", - mag_0, iqcal_image_i, iqcal_image_q)); - - /* c. */ - reg_dc_cancel |= (1 << CANCEL_DC_Q_SHIFT); - PHY_DEBUG(("[CAL] DC_CANCEL (write) = 0x%08X\n", reg_dc_cancel)); - hw_set_dxx_reg(phw_data, 0x5C, reg_dc_cancel); - - hw_get_dxx_reg(phw_data, REG_CALIB_READ2, &val); - PHY_DEBUG(("[CAL] CALIB_READ2 = 0x%08X\n", val)); - - iqcal_image_i = _s13_to_s32(val & 0x00001FFF); - iqcal_image_q = _s13_to_s32((val & 0x03FFE000) >> 13); - sqsum = iqcal_image_i*iqcal_image_i + iqcal_image_q*iqcal_image_q; - mag_1 = _sqrt(sqsum); - PHY_DEBUG(("[CAL] mag_1=%d (iqcal_image_i=%d, iqcal_image_q=%d)\n", - mag_1, iqcal_image_i, iqcal_image_q)); - - /* d. Calculate the correct DC offset cancellation value for I */ - if (mag_0 != mag_1) - fix_cancel_dc_q = (mag_0*10000) / (mag_0*10000 - mag_1*10000); - else { - if (mag_0 == mag_1) - PHY_DEBUG(("[CAL] ***** mag_0 = mag_1 !!\n")); - fix_cancel_dc_q = 0; - } - - PHY_DEBUG(("[CAL] ** fix_cancel_dc_q = %d (0x%04X)\n", - fix_cancel_dc_q, _s32_to_s5(fix_cancel_dc_q))); - - if ((abs(mag_1-mag_0)*6) > mag_0) - break; - } - - if (loop >= 19) - fix_cancel_dc_q = 0; - - reg_dc_cancel &= ~(0x001F); - reg_dc_cancel |= (_s32_to_s5(fix_cancel_dc_q) << CANCEL_DC_Q_SHIFT); - hw_set_dxx_reg(phw_data, 0x5C, reg_dc_cancel); - PHY_DEBUG(("[CAL] DC_CANCEL (write) = 0x%08X\n", reg_dc_cancel)); - - - /* f. */ - reg_mode_ctrl &= ~MASK_CALIB_START; - hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl); - PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); -} - /* 20060612.1.a 20060718.1 Modify */ -u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, +static u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, s32 a_2_threshold, s32 b_2_threshold) { @@ -710,7 +434,8 @@ u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, loop = LOOP_TIMES; while (loop > 0) { - PHY_DEBUG(("[CAL] [%d.] <_tx_iq_calibration_loop>\n", (LOOP_TIMES-loop+1))); + PHY_DEBUG(("[CAL] [%d.] <_tx_iq_calibration_loop>\n", + (LOOP_TIMES-loop+1))); iqcal_tone_i_avg = 0; iqcal_tone_q_avg = 0; @@ -718,8 +443,8 @@ u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, return 0; for (capture_time = 0; capture_time < 10; capture_time++) { /* - * a. Set iqcal_mode[1:0] to 0x2 and set "calib_start" to 0x1 to - * enable "IQ alibration Mode II" + * a. Set iqcal_mode[1:0] to 0x2 and set "calib_start" + * to 0x1 to enable "IQ calibration Mode II" */ reg_mode_ctrl &= ~(MASK_IQCAL_TONE_SEL|MASK_IQCAL_MODE); reg_mode_ctrl &= ~MASK_IQCAL_MODE; @@ -748,8 +473,8 @@ u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); /* - * d. Set iqcal_mode[1:0] to 0x3 and set "calib_start" to 0x1 to - * enable "IQ alibration Mode II" + * d. Set iqcal_mode[1:0] to 0x3 and set "calib_start" + * to 0x1 to enable "IQ calibration Mode II" */ /* hw_get_dxx_reg(phw_data, REG_MODE_CTRL, &val); */ hw_get_dxx_reg(phw_data, REG_MODE_CTRL, ®_mode_ctrl); @@ -765,7 +490,7 @@ u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, iqcal_tone_i = _s13_to_s32(val & 0x00001FFF); iqcal_tone_q = _s13_to_s32((val & 0x03FFE000) >> 13); PHY_DEBUG(("[CAL] ** iqcal_tone_i = %d, iqcal_tone_q = %d\n", - iqcal_tone_i, iqcal_tone_q)); + iqcal_tone_i, iqcal_tone_q)); if (capture_time == 0) continue; else { @@ -954,7 +679,7 @@ u8 _tx_iq_calibration_loop_winbond(struct hw_data *phw_data, return 1; } -void _tx_iq_calibration_winbond(struct hw_data *phw_data) +static void _tx_iq_calibration_winbond(struct hw_data *phw_data) { u32 reg_agc_ctrl3; #ifdef _DEBUG @@ -973,13 +698,13 @@ void _tx_iq_calibration_winbond(struct hw_data *phw_data) phy_set_rf_data(phw_data, 11, (11<<24)|0x19BDD6); /* 20060612.1.a 0x1905D6); */ /* 0x05 0x24C60A ; 09318 ; Calibration (6c). setting TX-VGA gain: TXGCH=2 & GPK=110 --> to be optimized */ phy_set_rf_data(phw_data, 5, (5<<24)|0x24C60A); /* 0x24C60A (high temperature) */ - /* 0x06 0x06880C ; 01A20 ; Calibration (6d). RXGCH=00; RXGCL=100 000 (RXVGA=32) --> to be optimized */ + /* 0x06 0x06880C ; 01A20 ; Calibration (6d). RXGCH=00; RXGCL=100 000 (RXVGA=32) --> to be optimized */ phy_set_rf_data(phw_data, 6, (6<<24)|0x34880C); /* 20060612.1.a 0x06890C); */ /* 0x00 0xFDF1C0 ; 3F7C7 ; Calibration (6e). turn on IQ imbalance/Test mode */ phy_set_rf_data(phw_data, 0, (0<<24)|0xFDF1C0); /* ; [BB-chip]: Calibration (6f).Send test pattern */ /* ; [BB-chip]: Calibration (6g). Search RXGCL optimal value */ - /* ; [BB-chip]: Calibration (6h). Caculate TX-path IQ imbalance and setting TX path IQ compensation table */ + /* ; [BB-chip]: Calibration (6h). Calculate TX-path IQ imbalance and setting TX path IQ compensation table */ /* phy_set_rf_data(phw_data, 3, (3<<24)|0x025586); */ msleep(30); /* 20060612.1.a 30ms delay. Add the follow 2 lines */ @@ -1100,7 +825,7 @@ void _tx_iq_calibration_winbond(struct hw_data *phw_data) } /*****************************************************/ -u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 frequency) +static u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 frequency) { u32 reg_mode_ctrl; s32 iqcal_tone_i; @@ -1145,7 +870,8 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre /* for (loop = 0; loop < LOOP_TIMES; loop++) */ loop = LOOP_TIMES; while (loop > 0) { - PHY_DEBUG(("[CAL] [%d.] <_rx_iq_calibration_loop>\n", (LOOP_TIMES-loop+1))); + PHY_DEBUG(("[CAL] [%d.] <_rx_iq_calibration_loop>\n", + (LOOP_TIMES-loop+1))); iqcal_tone_i_avg = 0; iqcal_tone_q_avg = 0; iqcal_image_i_avg = 0; @@ -1153,33 +879,33 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre capture_time = 0; for (capture_time = 0; capture_time < 10; capture_time++) { - /* i. Set "calib_start" to 0x0 */ - reg_mode_ctrl &= ~MASK_CALIB_START; - if (!hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl))/*20060718.1 modify */ - return 0; - PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); + /* i. Set "calib_start" to 0x0 */ + reg_mode_ctrl &= ~MASK_CALIB_START; + if (!hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl))/*20060718.1 modify */ + return 0; + PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); - reg_mode_ctrl &= ~MASK_IQCAL_MODE; - reg_mode_ctrl |= (MASK_CALIB_START|0x1); - hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl); - PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); + reg_mode_ctrl &= ~MASK_IQCAL_MODE; + reg_mode_ctrl |= (MASK_CALIB_START|0x1); + hw_set_dxx_reg(phw_data, REG_MODE_CTRL, reg_mode_ctrl); + PHY_DEBUG(("[CAL] MODE_CTRL (write) = 0x%08X\n", reg_mode_ctrl)); - /* c. */ - hw_get_dxx_reg(phw_data, REG_CALIB_READ1, &val); - PHY_DEBUG(("[CAL] CALIB_READ1 = 0x%08X\n", val)); + /* c. */ + hw_get_dxx_reg(phw_data, REG_CALIB_READ1, &val); + PHY_DEBUG(("[CAL] CALIB_READ1 = 0x%08X\n", val)); - iqcal_tone_i = _s13_to_s32(val & 0x00001FFF); - iqcal_tone_q = _s13_to_s32((val & 0x03FFE000) >> 13); - PHY_DEBUG(("[CAL] ** iqcal_tone_i = %d, iqcal_tone_q = %d\n", - iqcal_tone_i, iqcal_tone_q)); + iqcal_tone_i = _s13_to_s32(val & 0x00001FFF); + iqcal_tone_q = _s13_to_s32((val & 0x03FFE000) >> 13); + PHY_DEBUG(("[CAL] ** iqcal_tone_i = %d, iqcal_tone_q = %d\n", + iqcal_tone_i, iqcal_tone_q)); - hw_get_dxx_reg(phw_data, REG_CALIB_READ2, &val); - PHY_DEBUG(("[CAL] CALIB_READ2 = 0x%08X\n", val)); + hw_get_dxx_reg(phw_data, REG_CALIB_READ2, &val); + PHY_DEBUG(("[CAL] CALIB_READ2 = 0x%08X\n", val)); - iqcal_image_i = _s13_to_s32(val & 0x00001FFF); - iqcal_image_q = _s13_to_s32((val & 0x03FFE000) >> 13); - PHY_DEBUG(("[CAL] ** iqcal_image_i = %d, iqcal_image_q = %d\n", - iqcal_image_i, iqcal_image_q)); + iqcal_image_i = _s13_to_s32(val & 0x00001FFF); + iqcal_image_q = _s13_to_s32((val & 0x03FFE000) >> 13); + PHY_DEBUG(("[CAL] ** iqcal_image_i = %d, iqcal_image_q = %d\n", + iqcal_image_i, iqcal_image_q)); if (capture_time == 0) continue; else { @@ -1198,13 +924,13 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre /* d. */ rot_tone_i_b = (iqcal_tone_i * iqcal_tone_i + - iqcal_tone_q * iqcal_tone_q) / 1024; + iqcal_tone_q * iqcal_tone_q) / 1024; rot_tone_q_b = (iqcal_tone_i * iqcal_tone_q * (-1) + - iqcal_tone_q * iqcal_tone_i) / 1024; + iqcal_tone_q * iqcal_tone_i) / 1024; rot_image_i_b = (iqcal_image_i * iqcal_tone_i - - iqcal_image_q * iqcal_tone_q) / 1024; + iqcal_image_q * iqcal_tone_q) / 1024; rot_image_q_b = (iqcal_image_i * iqcal_tone_q + - iqcal_image_q * iqcal_tone_i) / 1024; + iqcal_image_q * iqcal_tone_i) / 1024; PHY_DEBUG(("[CAL] ** rot_tone_i_b = %d\n", rot_tone_i_b)); PHY_DEBUG(("[CAL] ** rot_tone_q_b = %d\n", rot_tone_q_b)); @@ -1224,8 +950,10 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre b_2 = (rot_image_q_b * 32768) / rot_tone_i_b - phw_data->iq_rsdl_phase_tx_d2; - PHY_DEBUG(("[CAL] ** iq_rsdl_gain_tx_d2 = %d\n", phw_data->iq_rsdl_gain_tx_d2)); - PHY_DEBUG(("[CAL] ** iq_rsdl_phase_tx_d2= %d\n", phw_data->iq_rsdl_phase_tx_d2)); + PHY_DEBUG(("[CAL] ** iq_rsdl_gain_tx_d2 = %d\n", + phw_data->iq_rsdl_gain_tx_d2)); + PHY_DEBUG(("[CAL] ** iq_rsdl_phase_tx_d2= %d\n", + phw_data->iq_rsdl_phase_tx_d2)); PHY_DEBUG(("[CAL] ***** EPSILON/2 = %d\n", a_2)); PHY_DEBUG(("[CAL] ***** THETA/2 = %d\n", b_2)); @@ -1271,7 +999,8 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre /* e. */ pwr_tone = (iqcal_tone_i*iqcal_tone_i + iqcal_tone_q*iqcal_tone_q); - pwr_image = (iqcal_image_i*iqcal_image_i + iqcal_image_q*iqcal_image_q)*factor; + pwr_image = (iqcal_image_i*iqcal_image_i + + iqcal_image_q*iqcal_image_q)*factor; PHY_DEBUG(("[CAL] ** pwr_tone = %d\n", pwr_tone)); PHY_DEBUG(("[CAL] ** pwr_image = %d\n", pwr_image)); @@ -1357,7 +1086,7 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre hw_set_dxx_reg(phw_data, 0x54, val); if (loop == 3) - return 0; + return 0; } PHY_DEBUG(("[CAL] ** CALIB_DATA = 0x%08X\n", val)); @@ -1370,9 +1099,9 @@ u8 _rx_iq_calibration_loop_winbond(struct hw_data *phw_data, u16 factor, u32 fre /*************************************************/ /***************************************************************/ -void _rx_iq_calibration_winbond(struct hw_data *phw_data, u32 frequency) +static void _rx_iq_calibration_winbond(struct hw_data *phw_data, u32 frequency) { -/* figo 20050523 marked this flag for can't compile for relesase */ +/* figo 20050523 marked this flag for can't compile for release */ #ifdef _DEBUG s32 rx_cal_reg[4]; u32 val; @@ -1396,7 +1125,7 @@ void _rx_iq_calibration_winbond(struct hw_data *phw_data, u32 frequency) /* ; [BB-chip]: Calibration (7f). Send test pattern */ /* ; [BB-chip]: Calibration (7g). Search RXGCL optimal value */ - /* ; [BB-chip]: Calibration (7h). Caculate RX-path IQ imbalance and setting RX path IQ compensation table */ + /* ; [BB-chip]: Calibration (7h). Calculate RX-path IQ imbalance and setting RX path IQ compensation table */ result = _rx_iq_calibration_loop_winbond(phw_data, 12589, frequency); @@ -1453,7 +1182,7 @@ void phy_calibration_winbond(struct hw_data *phw_data, u32 frequency) _rxadc_dc_offset_cancellation_winbond(phw_data, frequency); /* _txidac_dc_offset_cancellation_winbond(phw_data); */ - /* _txqdac_dc_offset_cacellation_winbond(phw_data); */ + /* _txqdac_dc_offset_cancellation_winbond(phw_data); */ _tx_iq_calibration_winbond(phw_data); _rx_iq_calibration_winbond(phw_data, frequency); @@ -1475,40 +1204,40 @@ void phy_calibration_winbond(struct hw_data *phw_data, u32 frequency) /******************/ void phy_set_rf_data(struct hw_data *pHwData, u32 index, u32 value) { - u32 ltmp = 0; - - switch (pHwData->phy_type) { - case RF_MAXIM_2825: - case RF_MAXIM_V1: /* 11g Winbond 2nd BB(with Phy board (v1) + Maxim 331) */ - ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); - break; - - case RF_MAXIM_2827: - ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); - break; - - case RF_MAXIM_2828: - ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); - break; - - case RF_MAXIM_2829: - ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); - break; - - case RF_AIROHA_2230: - case RF_AIROHA_2230S: /* 20060420 Add this */ - ltmp = (1 << 31) | (0 << 30) | (20 << 24) | BitReverse(value, 20); - break; - - case RF_AIROHA_7230: - ltmp = (1 << 31) | (0 << 30) | (24 << 24) | (value&0xffffff); - break; - - case RF_WB_242: - case RF_WB_242_1:/* 20060619.5 Add */ - ltmp = (1 << 31) | (0 << 30) | (24 << 24) | BitReverse(value, 24); - break; - } + u32 ltmp = 0; + + switch (pHwData->phy_type) { + case RF_MAXIM_2825: + case RF_MAXIM_V1: /* 11g Winbond 2nd BB(with Phy board (v1) + Maxim 331) */ + ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); + break; + + case RF_MAXIM_2827: + ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); + break; + + case RF_MAXIM_2828: + ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); + break; + + case RF_MAXIM_2829: + ltmp = (1 << 31) | (0 << 30) | (18 << 24) | BitReverse(value, 18); + break; + + case RF_AIROHA_2230: + case RF_AIROHA_2230S: /* 20060420 Add this */ + ltmp = (1 << 31) | (0 << 30) | (20 << 24) | BitReverse(value, 20); + break; + + case RF_AIROHA_7230: + ltmp = (1 << 31) | (0 << 30) | (24 << 24) | (value&0xffffff); + break; + + case RF_WB_242: + case RF_WB_242_1:/* 20060619.5 Add */ + ltmp = (1 << 31) | (0 << 30) | (24 << 24) | BitReverse(value, 24); + break; + } Wb35Reg_WriteSync(pHwData, 0x0864, ltmp); } @@ -1568,7 +1297,8 @@ unsigned char adjust_TXVGA_for_iq_mag(struct hw_data *phw_data) sqsum = iqcal_tone_i0*iqcal_tone_i0 + iqcal_tone_q0*iqcal_tone_q0; iq_mag_0_tx = (s32) _sqrt(sqsum); - PHY_DEBUG(("[CAL] ** auto_adjust_txvga_for_iq_mag_0_tx=%d\n", iq_mag_0_tx)); + PHY_DEBUG(("[CAL] ** auto_adjust_txvga_for_iq_mag_0_tx=%d\n", + iq_mag_0_tx)); if (iq_mag_0_tx >= 700 && iq_mag_0_tx <= 1750) break; diff --git a/drivers/staging/winbond/phy_calibration.h b/drivers/staging/winbond/phy_calibration.h index 30320314883..78fc6805860 100644 --- a/drivers/staging/winbond/phy_calibration.h +++ b/drivers/staging/winbond/phy_calibration.h @@ -1,7 +1,7 @@ #ifndef __WINBOND_PHY_CALIBRATION_H #define __WINBOND_PHY_CALIBRATION_H -#include "wbhal_f.h" +#include "wbhal.h" #define REG_AGC_CTRL1 0x1000 #define REG_AGC_CTRL2 0x1004 @@ -79,6 +79,7 @@ #define SHIFT_IQCAL_TONE_Q(x) ((x) >> 13) void phy_set_rf_data(struct hw_data *pHwData, u32 index, u32 value); +void phy_calibration_winbond(struct hw_data *phw_data, u32 frequency); #define phy_init_rf(_A) /* RFSynthesizer_initial(_A) */ #endif diff --git a/drivers/staging/winbond/reg.c b/drivers/staging/winbond/reg.c index 990f9d4bdbb..5fd4c4a72ee 100644 --- a/drivers/staging/winbond/reg.c +++ b/drivers/staging/winbond/reg.c @@ -1,5 +1,6 @@ -#include "sysdef.h" -#include "wbhal_f.h" +#include "wbhal.h" +#include "wb35reg_f.h" +#include "core.h" /* * ==================================================== @@ -42,7 +43,7 @@ */ /* MAX2825 (pure b/g) */ -u32 max2825_rf_data[] = { +static u32 max2825_rf_data[] = { (0x00<<18) | 0x000a2, (0x01<<18) | 0x21cc0, (0x02<<18) | 0x13806, @@ -58,7 +59,7 @@ u32 max2825_rf_data[] = { (0x0C<<18) | 0x0c100 /* 11a: 0x0c300, 11g: 0x0c100 */ }; -u32 max2825_channel_data_24[][3] = { +static u32 max2825_channel_data_24[][3] = { {(0x03 << 18) | 0x30142, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x289A6}, /* channel 01 */ {(0x03 << 18) | 0x32141, (0x04 << 18) | 0x08444, (0x05 << 18) | 0x289A6}, /* channel 02 */ {(0x03 << 18) | 0x32143, (0x04 << 18) | 0x0aeee, (0x05 << 18) | 0x289A6}, /* channel 03 */ @@ -75,11 +76,11 @@ u32 max2825_channel_data_24[][3] = { {(0x03 << 18) | 0x32941, (0x04 << 18) | 0x09999, (0x05 << 18) | 0x289A6} /* channel 14 (2484MHz) */ }; -u32 max2825_power_data_24[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; +static u32 max2825_power_data_24[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; /* ========================================== */ /* MAX2827 (a/b/g) */ -u32 max2827_rf_data[] = { +static u32 max2827_rf_data[] = { (0x00 << 18) | 0x000a2, (0x01 << 18) | 0x21cc0, (0x02 << 18) | 0x13806, @@ -95,7 +96,7 @@ u32 max2827_rf_data[] = { (0x0C << 18) | 0x0c100 /* 11a: 0x0c300, 11g: 0x0c100 */ }; -u32 max2827_channel_data_24[][3] = { +static u32 max2827_channel_data_24[][3] = { {(0x03 << 18) | 0x30142, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x289A6}, /* channe1 01 */ {(0x03 << 18) | 0x32141, (0x04 << 18) | 0x08444, (0x05 << 18) | 0x289A6}, /* channe1 02 */ {(0x03 << 18) | 0x32143, (0x04 << 18) | 0x0aeee, (0x05 << 18) | 0x289A6}, /* channe1 03 */ @@ -112,7 +113,7 @@ u32 max2827_channel_data_24[][3] = { {(0x03 << 18) | 0x32941, (0x04 << 18) | 0x09999, (0x05 << 18) | 0x289A6} /* channel 14 (2484MHz) */ }; -u32 max2827_channel_data_50[][3] = { +static u32 max2827_channel_data_50[][3] = { {(0x03 << 18) | 0x33cc3, (0x04 << 18) | 0x08ccc, (0x05 << 18) | 0x2A9A6}, /* channel 36 */ {(0x03 << 18) | 0x302c0, (0x04 << 18) | 0x08000, (0x05 << 18) | 0x2A9A6}, /* channel 40 */ {(0x03 << 18) | 0x302c2, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x2A9A6}, /* channel 44 */ @@ -123,12 +124,12 @@ u32 max2827_channel_data_50[][3] = { {(0x03 << 18) | 0x30ac2, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x2A9A6} /* channel 64 */ }; -u32 max2827_power_data_24[] = {(0x0C << 18) | 0x0C000, (0x0C << 18) | 0x0D600, (0x0C << 18) | 0x0C100}; -u32 max2827_power_data_50[] = {(0x0C << 18) | 0x0C400, (0x0C << 18) | 0x0D500, (0x0C << 18) | 0x0C300}; +static u32 max2827_power_data_24[] = {(0x0C << 18) | 0x0C000, (0x0C << 18) | 0x0D600, (0x0C << 18) | 0x0C100}; +static u32 max2827_power_data_50[] = {(0x0C << 18) | 0x0C400, (0x0C << 18) | 0x0D500, (0x0C << 18) | 0x0C300}; /* ======================================================= */ /* MAX2828 (a/b/g) */ -u32 max2828_rf_data[] = { +static u32 max2828_rf_data[] = { (0x00 << 18) | 0x000a2, (0x01 << 18) | 0x21cc0, (0x02 << 18) | 0x13806, @@ -144,7 +145,7 @@ u32 max2828_rf_data[] = { (0x0C << 18) | 0x0c100 /* 11a: 0x0c300, 11g: 0x0c100 */ }; -u32 max2828_channel_data_24[][3] = { +static u32 max2828_channel_data_24[][3] = { {(0x03 << 18) | 0x30142, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x289A6}, /* channe1 01 */ {(0x03 << 18) | 0x32141, (0x04 << 18) | 0x08444, (0x05 << 18) | 0x289A6}, /* channe1 02 */ {(0x03 << 18) | 0x32143, (0x04 << 18) | 0x0aeee, (0x05 << 18) | 0x289A6}, /* channe1 03 */ @@ -161,7 +162,7 @@ u32 max2828_channel_data_24[][3] = { {(0x03 << 18) | 0x32941, (0x04 << 18) | 0x09999, (0x05 << 18) | 0x289A6} /* channel 14 (2484MHz) */ }; -u32 max2828_channel_data_50[][3] = { +static u32 max2828_channel_data_50[][3] = { {(0x03 << 18) | 0x33cc3, (0x04 << 18) | 0x08ccc, (0x05 << 18) | 0x289A6}, /* channel 36 */ {(0x03 << 18) | 0x302c0, (0x04 << 18) | 0x08000, (0x05 << 18) | 0x289A6}, /* channel 40 */ {(0x03 << 18) | 0x302c2, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x289A6}, /* channel 44 */ @@ -172,12 +173,12 @@ u32 max2828_channel_data_50[][3] = { {(0x03 << 18) | 0x30ac2, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x289A6} /* channel 64 */ }; -u32 max2828_power_data_24[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; -u32 max2828_power_data_50[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; +static u32 max2828_power_data_24[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; +static u32 max2828_power_data_50[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; /* ========================================================== */ /* MAX2829 (a/b/g) */ -u32 max2829_rf_data[] = { +static u32 max2829_rf_data[] = { (0x00 << 18) | 0x000a2, (0x01 << 18) | 0x23520, (0x02 << 18) | 0x13802, @@ -193,7 +194,7 @@ u32 max2829_rf_data[] = { (0x0C << 18) | 0x0F300 /* TXVGA=51, (MAX-6 dB) */ }; -u32 max2829_channel_data_24[][3] = { +static u32 max2829_channel_data_24[][3] = { {(3 << 18) | 0x30142, (4 << 18) | 0x0b333, (5 << 18) | 0x289C6}, /* 01 (2412MHz) */ {(3 << 18) | 0x32141, (4 << 18) | 0x08444, (5 << 18) | 0x289C6}, /* 02 (2417MHz) */ {(3 << 18) | 0x32143, (4 << 18) | 0x0aeee, (5 << 18) | 0x289C6}, /* 03 (2422MHz) */ @@ -210,7 +211,7 @@ u32 max2829_channel_data_24[][3] = { {(3 << 18) | 0x32941, (4 << 18) | 0x09999, (5 << 18) | 0x289C6}, /* 14 (2484MHz) */ }; -u32 max2829_channel_data_50[][4] = { +static u32 max2829_channel_data_50[][4] = { {36, (3 << 18) | 0x33cc3, (4 << 18) | 0x08ccc, (5 << 18) | 0x2A946}, /* 36 (5.180GHz) */ {40, (3 << 18) | 0x302c0, (4 << 18) | 0x08000, (5 << 18) | 0x2A946}, /* 40 (5.200GHz) */ {44, (3 << 18) | 0x302c2, (4 << 18) | 0x0b333, (5 << 18) | 0x2A946}, /* 44 (5.220GHz) */ @@ -295,51 +296,6 @@ u32 max2829_channel_data_50[][4] = { * 0x0c 0x0c000 * ==================================================================== */ -u32 maxim_317_rf_data[] = { - (0x00 << 18) | 0x000a2, - (0x01 << 18) | 0x214c0, - (0x02 << 18) | 0x13802, - (0x03 << 18) | 0x30143, - (0x04 << 18) | 0x0accc, - (0x05 << 18) | 0x28986, - (0x06 << 18) | 0x18008, - (0x07 << 18) | 0x38400, - (0x08 << 18) | 0x05108, - (0x09 << 18) | 0x27ff8, - (0x0A << 18) | 0x14000, - (0x0B << 18) | 0x37f99, - (0x0C << 18) | 0x0c000 -}; - -u32 maxim_317_channel_data_24[][3] = { - {(0x03 << 18) | 0x30143, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x28986}, /* channe1 01 */ - {(0x03 << 18) | 0x32140, (0x04 << 18) | 0x09111, (0x05 << 18) | 0x28986}, /* channe1 02 */ - {(0x03 << 18) | 0x32142, (0x04 << 18) | 0x0bbbb, (0x05 << 18) | 0x28986}, /* channe1 03 */ - {(0x03 << 18) | 0x32143, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x28986}, /* channe1 04 */ - {(0x03 << 18) | 0x31140, (0x04 << 18) | 0x09111, (0x05 << 18) | 0x28986}, /* channe1 05 */ - {(0x03 << 18) | 0x31142, (0x04 << 18) | 0x0bbbb, (0x05 << 18) | 0x28986}, /* channe1 06 */ - {(0x03 << 18) | 0x31143, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x28986}, /* channe1 07 */ - {(0x03 << 18) | 0x33140, (0x04 << 18) | 0x09111, (0x05 << 18) | 0x28986}, /* channe1 08 */ - {(0x03 << 18) | 0x33142, (0x04 << 18) | 0x0bbbb, (0x05 << 18) | 0x28986}, /* channe1 09 */ - {(0x03 << 18) | 0x33143, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x28986}, /* channe1 10 */ - {(0x03 << 18) | 0x30940, (0x04 << 18) | 0x09111, (0x05 << 18) | 0x28986}, /* channe1 11 */ - {(0x03 << 18) | 0x30942, (0x04 << 18) | 0x0bbbb, (0x05 << 18) | 0x28986}, /* channe1 12 */ - {(0x03 << 18) | 0x30943, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x28986} /* channe1 13 */ -}; - -u32 maxim_317_channel_data_50[][3] = { - {(0x03 << 18) | 0x33cc0, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x2a986}, /* channel 36 */ - {(0x03 << 18) | 0x302c0, (0x04 << 18) | 0x08000, (0x05 << 18) | 0x2a986}, /* channel 40 */ - {(0x03 << 18) | 0x302c3, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x2a986}, /* channel 44 */ - {(0x03 << 18) | 0x322c1, (0x04 << 18) | 0x09666, (0x05 << 18) | 0x2a986}, /* channel 48 */ - {(0x03 << 18) | 0x312c2, (0x04 << 18) | 0x09999, (0x05 << 18) | 0x2a986}, /* channel 52 */ - {(0x03 << 18) | 0x332c0, (0x04 << 18) | 0x0b333, (0x05 << 18) | 0x2a99e}, /* channel 56 */ - {(0x03 << 18) | 0x30ac0, (0x04 << 18) | 0x08000, (0x05 << 18) | 0x2a99e}, /* channel 60 */ - {(0x03 << 18) | 0x30ac3, (0x04 << 18) | 0x0accc, (0x05 << 18) | 0x2a99e} /* channel 64 */ -}; - -u32 maxim_317_power_data_24[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; -u32 maxim_317_power_data_50[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100}; /* * =================================================================== @@ -387,7 +343,7 @@ u32 maxim_317_power_data_50[] = {(0x0C << 18) | 0x0c000, (0x0C << 18) | 0x0c100} * 0x0f 0xf00a0 ; Restore Initial Setting * ================================================================== */ -u32 al2230_rf_data[] = { +static u32 al2230_rf_data[] = { (0x00 << 20) | 0x09EFC, (0x01 << 20) | 0x8CCCC, (0x02 << 20) | 0x40058, @@ -405,7 +361,7 @@ u32 al2230_rf_data[] = { (0x0F << 20) | 0xF01A0 }; -u32 al2230s_rf_data[] = { +static u32 al2230s_rf_data[] = { (0x00 << 20) | 0x09EFC, (0x01 << 20) | 0x8CCCC, (0x02 << 20) | 0x40058, @@ -423,7 +379,7 @@ u32 al2230s_rf_data[] = { (0x0F << 20) | 0xF01A0 }; -u32 al2230_channel_data_24[][2] = { +static u32 al2230_channel_data_24[][2] = { {(0x00 << 20) | 0x09EFC, (0x01 << 20) | 0x8CCCC}, /* channe1 01 */ {(0x00 << 20) | 0x09EFC, (0x01 << 20) | 0x8CCCD}, /* channe1 02 */ {(0x00 << 20) | 0x09E7C, (0x01 << 20) | 0x8CCCC}, /* channe1 03 */ @@ -445,7 +401,7 @@ u32 al2230_channel_data_24[][2] = { #define AIROHA_TXVGA_MIDDLE_INDEX 12 /* Index for 0x96602 */ #define AIROHA_TXVGA_HIGH_INDEX 8 /* Index for 0x97602 1.0.24.0 1.0.28.0 */ -u32 al2230_txvga_data[][2] = { +static u32 al2230_txvga_data[][2] = { /* value , index */ {0x090202, 0}, {0x094202, 2}, @@ -496,7 +452,7 @@ u32 al2230_txvga_data[][2] = { */ /* channel independent registers: */ -u32 al7230_rf_data_24[] = { +static u32 al7230_rf_data_24[] = { (0x00 << 24) | 0x003790, (0x01 << 24) | 0x133331, (0x02 << 24) | 0x841FF2, @@ -515,7 +471,7 @@ u32 al7230_rf_data_24[] = { (0x0F << 24) | 0x1ABA8F }; -u32 al7230_channel_data_24[][2] = { +static u32 al7230_channel_data_24[][2] = { {(0x00 << 24) | 0x003790, (0x01 << 24) | 0x133331}, /* channe1 01 */ {(0x00 << 24) | 0x003790, (0x01 << 24) | 0x1B3331}, /* channe1 02 */ {(0x00 << 24) | 0x003790, (0x01 << 24) | 0x033331}, /* channe1 03 */ @@ -533,7 +489,7 @@ u32 al7230_channel_data_24[][2] = { }; /* channel independent registers: */ -u32 al7230_rf_data_50[] = { +static u32 al7230_rf_data_50[] = { (0x00 << 24) | 0x0FF520, (0x01 << 24) | 0x000001, (0x02 << 24) | 0x451FE2, @@ -552,7 +508,7 @@ u32 al7230_rf_data_50[] = { (0x0F << 24) | 0x12BACF /* 5Ghz default state */ }; -u32 al7230_channel_data_5[][4] = { +static u32 al7230_channel_data_5[][4] = { /* channel dependent registers: 0x00, 0x01 and 0x04 */ /* 11J =========== */ {184, (0x00 << 24) | 0x0FF520, (0x01 << 24) | 0x000001, (0x04 << 24) | 0x67F784}, /* channel 184 */ @@ -602,7 +558,7 @@ u32 al7230_channel_data_5[][4] = { */ /* TXVGA Mapping Table <=== Register 0x0B */ -u32 al7230_txvga_data[][2] = { +static u32 al7230_txvga_data[][2] = { {0x08040B, 0}, /* TXVGA = 0; */ {0x08041B, 1}, /* TXVGA = 1; */ {0x08042B, 2}, /* TXVGA = 2; */ @@ -674,7 +630,7 @@ u32 al7230_txvga_data[][2] = { * W89RF242 RFIC SPI programming initial data * Winbond WLAN 11g RFIC BB-SPI register -- version FA5976A rev 1.3b */ -u32 w89rf242_rf_data[] = { +static u32 w89rf242_rf_data[] = { (0x00 << 24) | 0xF86100, /* 3E184; MODA (0x00) -- Normal mode ; calibration off */ (0x01 << 24) | 0xEFFFC2, /* 3BFFF; MODB (0x01) -- turn off RSSI, and other circuits are turned on */ (0x02 << 24) | 0x102504, /* 04094; FSET (0x02) -- default 20MHz crystal ; Icmp=1.5mA */ @@ -692,10 +648,10 @@ u32 w89rf242_rf_data[] = { (0x0E << 24) | 0x5557DC, /* 1555F ; IBSC (0x0E) -- IRLNA & IRLNB (PTAT & Const current)=01/01; FA5976B_1.3F */ (0x10 << 24) | 0x000C20, /* 00030 ; TMODA (0x10) -- LNA_gain_step=0011 ; LNA=15/16dB */ (0x11 << 24) | 0x0C0022, /* 03000 ; TMODB (0x11) -- Turn ON RX-Q path Test Switch; To improve IQ path group delay (FA5976A_1.3C) */ - (0x12 << 24) | 0x000024 /* TMODC (0x12) -- Turn OFF Tempearure sensor */ + (0x12 << 24) | 0x000024 /* TMODC (0x12) -- Turn OFF Temperature sensor */ }; -u32 w89rf242_channel_data_24[][2] = { +static u32 w89rf242_channel_data_24[][2] = { {(0x03 << 24) | 0x025B06, (0x04 << 24) | 0x080408}, /* channe1 01 */ {(0x03 << 24) | 0x025C46, (0x04 << 24) | 0x080408}, /* channe1 02 */ {(0x03 << 24) | 0x025D86, (0x04 << 24) | 0x080408}, /* channe1 03 */ @@ -712,9 +668,7 @@ u32 w89rf242_channel_data_24[][2] = { {(0x03 << 24) | 0x026D06, (0x04 << 24) | 0x080408} /* channe1 14 */ }; -u32 w89rf242_power_data_24[] = {(0x05 << 24) | 0x24C48A, (0x05 << 24) | 0x24C48A, (0x05 << 24) | 0x24C48A}; - -u32 w89rf242_txvga_old_mapping[][2] = { +static u32 w89rf242_txvga_old_mapping[][2] = { {0, 0} , /* New <-> Old */ {1, 1} , {2, 2} , @@ -737,7 +691,7 @@ u32 w89rf242_txvga_old_mapping[][2] = { {34, 19}, }; -u32 w89rf242_txvga_data[][5] = { +static u32 w89rf242_txvga_data[][5] = { /* low gain mode */ {(0x05 << 24) | 0x24C00A, 0, 0x00292315, 0x0800FEFF, 0x52523131}, /* min gain */ {(0x05 << 24) | 0x24C80A, 1, 0x00292315, 0x0800FEFF, 0x52523131}, @@ -919,20 +873,20 @@ void Uxx_power_on_procedure(struct hw_data *pHwData) Wb35Reg_WriteSync(pHwData, 0x03f8, 0x7ff); } -void Set_ChanIndep_RfData_al7230_24(struct hw_data *pHwData, u32 *pltmp , char number) +static void Set_ChanIndep_RfData_al7230_24(struct hw_data *pHwData, u32 *pltmp, + char number) { u8 i; - for (i = 0; i < number; i++) { pHwData->phy_para[i] = al7230_rf_data_24[i]; pltmp[i] = (1 << 31) | (0 << 30) | (24 << 24) | (al7230_rf_data_24[i] & 0xffffff); } } -void Set_ChanIndep_RfData_al7230_50(struct hw_data *pHwData, u32 *pltmp, char number) +static void Set_ChanIndep_RfData_al7230_50(struct hw_data *pHwData, u32 *pltmp, + char number) { u8 i; - for (i = 0; i < number; i++) { pHwData->phy_para[i] = al7230_rf_data_50[i]; pltmp[i] = (1 << 31) | (0 << 30) | (24 << 24) | (al7230_rf_data_50[i] & 0xffffff); @@ -1010,9 +964,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) case RF_AIROHA_7230: /* Start to fill RF parameters, PLL_ON should be pulled low. */ Wb35Reg_WriteSync(pHwData, 0x03dc, 0x00000000); - #ifdef _PE_STATE_DUMP_ - printk("* PLL_ON low\n"); - #endif + pr_debug("* PLL_ON low\n"); number = ARRAY_SIZE(al7230_rf_data_24); Set_ChanIndep_RfData_al7230_24(pHwData, pltmp, number); break; @@ -1089,7 +1041,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) msleep(5); ltmp = (1 << 31) | (0 << 30) | (20 << 24) | BitReverse((0x0F << 20) | 0xF01A0, 20); - Wb35Reg_WriteSync(pHwData, 0x0864, ltmp) ; + Wb35Reg_WriteSync(pHwData, 0x0864, ltmp); Wb35Reg_WriteSync(pHwData, 0x105c, pHwData->reg.BB5C); pHwData->reg.BB50 &= ~0x13; /* (MASK_IQCAL_MODE|MASK_CALIB_START); */ @@ -1098,9 +1050,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) case RF_AIROHA_7230: /* RF parameters have filled completely, PLL_ON should be pulled high */ Wb35Reg_WriteSync(pHwData, 0x03dc, 0x00000080); - #ifdef _PE_STATE_DUMP_ - printk("* PLL_ON high\n"); - #endif + pr_debug("* PLL_ON high\n"); /* 2.4GHz */ ltmp = (1 << 31) | (0 << 30) | (24 << 24) | 0x9ABA8F; @@ -1115,9 +1065,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) /* 5GHz */ Wb35Reg_WriteSync(pHwData, 0x03dc, 0x00000000); - #ifdef _PE_STATE_DUMP_ - printk("* PLL_ON low\n"); - #endif + pr_debug("* PLL_ON low\n"); number = ARRAY_SIZE(al7230_rf_data_50); Set_ChanIndep_RfData_al7230_50(pHwData, pltmp, number); @@ -1127,9 +1075,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) msleep(5); Wb35Reg_WriteSync(pHwData, 0x03dc, 0x00000080); - #ifdef _PE_STATE_DUMP_ - printk("* PLL_ON high\n"); - #endif + pr_debug("* PLL_ON high\n"); ltmp = (1 << 31) | (0 << 30) | (24 << 24) | 0x9ABA8F; Wb35Reg_WriteSync(pHwData, 0x0864, ltmp); @@ -1270,7 +1216,7 @@ void RFSynthesizer_initial(struct hw_data *pHwData) } } -void BBProcessor_AL7230_2400(struct hw_data *pHwData) +static void BBProcessor_AL7230_2400(struct hw_data *pHwData) { struct wb35_reg *reg = &pHwData->reg; u32 pltmp[12]; @@ -1311,7 +1257,7 @@ void BBProcessor_AL7230_2400(struct hw_data *pHwData) Wb35Reg_BurstWrite(pHwData, 0x1030, pltmp, 12, AUTO_INCREMENT); } -void BBProcessor_AL7230_5000(struct hw_data *pHwData) +static void BBProcessor_AL7230_5000(struct hw_data *pHwData) { struct wb35_reg *reg = &pHwData->reg; u32 pltmp[12]; @@ -1627,22 +1573,24 @@ void BBProcessor_initial(struct hw_data *pHwData) reg->SQ3_filter[i] = 0x2f; /* half of Bit 0 ~ 6 */ } -void set_tx_power_per_channel_max2829(struct hw_data *pHwData, struct chan_info Channel) +static inline void set_tx_power_per_channel_max2829(struct hw_data *pHwData, + struct chan_info Channel) { RFSynthesizer_SetPowerIndex(pHwData, 100); } -void set_tx_power_per_channel_al2230(struct hw_data *pHwData, struct chan_info Channel) +static void set_tx_power_per_channel_al2230(struct hw_data *pHwData, + struct chan_info Channel) { u8 index = 100; - if (pHwData->TxVgaFor24[Channel.ChanNo - 1] != 0xff) index = pHwData->TxVgaFor24[Channel.ChanNo - 1]; RFSynthesizer_SetPowerIndex(pHwData, index); } -void set_tx_power_per_channel_al7230(struct hw_data *pHwData, struct chan_info Channel) +static void set_tx_power_per_channel_al7230(struct hw_data *pHwData, + struct chan_info Channel) { u8 i, index = 100; @@ -1665,7 +1613,8 @@ void set_tx_power_per_channel_al7230(struct hw_data *pHwData, struct chan_info RFSynthesizer_SetPowerIndex(pHwData, index); } -void set_tx_power_per_channel_wb242(struct hw_data *pHwData, struct chan_info Channel) +static void set_tx_power_per_channel_wb242(struct hw_data *pHwData, + struct chan_info Channel) { u8 index = 100; @@ -1795,9 +1744,7 @@ void RFSynthesizer_SwitchingChannel(struct hw_data *pHwData, struct chan_info C /* Write to register. number must less and equal than 16 */ Wb35Reg_BurstWrite(pHwData, 0x0864, pltmp, number, NO_INCREMENT); - #ifdef _PE_STATE_DUMP_ - printk("Band changed\n"); - #endif + pr_debug("Band changed\n"); } if (Channel.band <= BAND_TYPE_OFDM_24) { /* channel 1 ~ 14 */ @@ -2073,11 +2020,7 @@ void Mxx_initial(struct hw_data *pHwData) */ /* M00 bit set */ - #ifdef _IBSS_BEACON_SEQ_STICK_ - reg->M00_MacControl = 0; /* Solve beacon sequence number stop by software */ - #else reg->M00_MacControl = 0x80000000; /* Solve beacon sequence number stop by hardware */ - #endif /* M24 disable enter power save, BB RxOn and enable NAV attack */ reg->M24_MacControl = 0x08040042; @@ -2106,7 +2049,7 @@ void Mxx_initial(struct hw_data *pHwData) pltmp[5] = reg->M38_MacControl; /* M3C */ - tmp = (DEFAULT_PIFST << 26) | (DEFAULT_EIFST << 16) | (DEFAULT_DIFST << 8) | (DEFAULT_SIFST << 4) | DEFAULT_OSIFST ; + tmp = (DEFAULT_PIFST << 26) | (DEFAULT_EIFST << 16) | (DEFAULT_DIFST << 8) | (DEFAULT_SIFST << 4) | DEFAULT_OSIFST; reg->M3C_MacControl = tmp; pltmp[6] = tmp; @@ -2336,13 +2279,6 @@ void EEPROMTxVgaAdjust(struct hw_data *pHwData) pHwData->TxVgaFor50[32].TxVgaValue = pTxVga[17] - stmp * 2 / 4; pHwData->TxVgaFor50[31].TxVgaValue = pTxVga[17] - stmp * 3 / 4; } - - #ifdef _PE_STATE_DUMP_ - printk(" TxVgaFor24 :\n"); - DataDmp((u8 *)pHwData->TxVgaFor24, 14 , 0); - printk(" TxVgaFor50 :\n"); - DataDmp((u8 *)pHwData->TxVgaFor50, 70 , 0); - #endif } void BBProcessor_RateChanging(struct hw_data *pHwData, u8 rate) diff --git a/drivers/staging/winbond/sme_api.h b/drivers/staging/winbond/sme_api.h index 8f4596c9e9b..652ae7085a5 100644 --- a/drivers/staging/winbond/sme_api.h +++ b/drivers/staging/winbond/sme_api.h @@ -12,7 +12,6 @@ #include "localpara.h" /****************** CONSTANT AND MACRO SECTION ******************************/ -#define _INLINE __inline #define MEDIA_STATE_DISCONNECTED 0 #define MEDIA_STATE_CONNECTED 1 @@ -26,17 +25,17 @@ /* OID_802_11_BSSID */ s8 sme_get_bssid(void *pcore_data, u8 *pbssid); -s8 sme_get_desired_bssid(void *pcore_data, u8 *pbssid); /* Not use */ +s8 sme_get_desired_bssid(void *pcore_data, u8 *pbssid); /* Unused */ s8 sme_set_desired_bssid(void *pcore_data, u8 *pbssid); /* OID_802_11_SSID */ s8 sme_get_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len); -s8 sme_get_desired_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len);/* Not use */ +s8 sme_get_desired_ssid(void *pcore_data, u8 *pssid, u8 *pssid_len);/* Unused */ s8 sme_set_desired_ssid(void *pcore_data, u8 *pssid, u8 ssid_len); /* OID_802_11_INFRASTRUCTURE_MODE */ s8 sme_get_bss_type(void *pcore_data, u8 *pbss_type); -s8 sme_get_desired_bss_type(void *pcore_data, u8 *pbss_type); /* Not use */ +s8 sme_get_desired_bss_type(void *pcore_data, u8 *pbss_type); /* Unused */ s8 sme_set_desired_bss_type(void *pcore_data, u8 bss_type); /* OID_802_11_FRAGMENTATION_THRESHOLD */ @@ -107,7 +106,7 @@ s8 sme_set_bssid_list_scan(void *pcore_data, void *pscan_para); s8 sme_set_reload_defaults(void *pcore_data, u8 reload_type); -/*------------------------- none-standard ----------------------------------*/ +/*------------------------- non-standard ----------------------------------*/ s8 sme_get_connect_status(void *pcore_data, u8 *pstatus); /*--------------------------------------------------------------------------*/ @@ -138,7 +137,7 @@ s8 sme_set_txrate_policy(void *pcore_data, u8 policy); s8 sme_get_txrate_policy(void *pcore_data, u8 *policy); s8 sme_get_cwmin_value(void *pcore_data, u8 *cwmin); s8 sme_get_cwmax_value(void *pcore_data, u16 *cwmax); -s8 sme_get_ms_radio_mode(void *pcore_data, u8 * pMsRadioOff); +s8 sme_get_ms_radio_mode(void *pcore_data, u8 *pMsRadioOff); s8 sme_set_ms_radio_mode(void *pcore_data, u8 boMsRadioOff); void sme_get_tx_power_level(void *pcore_data, u32 *TxPower); diff --git a/drivers/staging/winbond/sysdef.h b/drivers/staging/winbond/sysdef.h deleted file mode 100644 index d0d71f69bc8..00000000000 --- a/drivers/staging/winbond/sysdef.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Winbond WLAN System Configuration defines */ - -#ifndef SYS_DEF_H -#define SYS_DEF_H - -#include <linux/delay.h> - -#define WB_LINUX -#define WB_LINUX_WPA_PSK - -#define _USE_FALLBACK_RATE_ - -#define _WPA2_ - -#ifndef _WPA_PSK_DEBUG -#undef _WPA_PSK_DEBUG -#endif - -/* debug print options, mark what debug you don't need */ - -#ifdef FULL_DEBUG -#define _PE_STATE_DUMP_ -#define _PE_TX_DUMP_ -#define _PE_RX_DUMP_ -#define _PE_OID_DUMP_ -#define _PE_DTO_DUMP_ -#define _PE_REG_DUMP_ -#define _PE_USB_INI_DUMP_ -#endif - -#endif diff --git a/drivers/staging/winbond/wb35reg.c b/drivers/staging/winbond/wb35reg.c index 770722385ee..bbc5ddcce6f 100644 --- a/drivers/staging/winbond/wb35reg.c +++ b/drivers/staging/winbond/wb35reg.c @@ -1,11 +1,9 @@ -#include "sysdef.h" #include "wb35reg_f.h" +#include "phy_calibration.h" #include <linux/usb.h> #include <linux/slab.h> -extern void phy_calibration_winbond(struct hw_data *phw_data, u32 frequency); - /* * true : read command process successfully * false : register not support @@ -15,7 +13,8 @@ extern void phy_calibration_winbond(struct hw_data *phw_data, u32 frequency); * Flag : AUTO_INCREMENT - RegisterNo will auto increment 4 * NO_INCREMENT - Function will write data into the same register */ -unsigned char Wb35Reg_BurstWrite(struct hw_data *pHwData, u16 RegisterNo, u32 *pRegisterData, u8 NumberOfData, u8 Flag) +unsigned char Wb35Reg_BurstWrite(struct hw_data *pHwData, u16 RegisterNo, + u32 *pRegisterData, u8 NumberOfData, u8 Flag) { struct wb35_reg *reg = &pHwData->reg; struct urb *urb = NULL; @@ -31,88 +30,157 @@ unsigned char Wb35Reg_BurstWrite(struct hw_data *pHwData, u16 RegisterNo, u32 *p /* Trying to use burst write function if use new hardware */ UrbSize = sizeof(struct wb35_reg_queue) + DataSize + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); + if (reg_queue == NULL) + return false; + urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 2; /* burst write register */ - reg_queue->INDEX = RegisterNo; - reg_queue->pBuffer = (u32 *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - memcpy(reg_queue->pBuffer, pRegisterData, DataSize); - /* the function for reversing register data from little endian to big endian */ - for (i = 0; i < NumberOfData ; i++) - reg_queue->pBuffer[i] = cpu_to_le32(reg_queue->pBuffer[i]); - - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue) + DataSize); - dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; - dr->bRequest = 0x04; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(Flag); /* 0: Register number auto-increment, 1: No auto increment */ - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(DataSize); - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; + if (urb == NULL) { + kfree(reg_queue); + return false; + } - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; + reg_queue->DIRECT = 2; /* burst write register */ + reg_queue->INDEX = RegisterNo; + reg_queue->pBuffer = (u32 *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + memcpy(reg_queue->pBuffer, pRegisterData, DataSize); + /* the function for reversing register data from little endian to big endian */ + for (i = 0; i < NumberOfData; i++) + reg_queue->pBuffer[i] = cpu_to_le32(reg_queue->pBuffer[i]); + + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue) + DataSize); + dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; + dr->bRequest = 0x04; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(Flag); /* 0: Register number auto-increment, 1: No auto increment */ + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(DataSize); + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; - spin_unlock_irq(®->EP0VM_spin_lock); + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); + spin_unlock_irq(®->EP0VM_spin_lock); - return true; - } else { - if (urb) - usb_free_urb(urb); - if (reg_queue) - kfree(reg_queue); - return false; - } - return false; + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } -void Wb35Reg_Update(struct hw_data *pHwData, u16 RegisterNo, u32 RegisterValue) +void Wb35Reg_Update(struct hw_data *pHwData, u16 RegisterNo, u32 RegisterValue) { struct wb35_reg *reg = &pHwData->reg; switch (RegisterNo) { - case 0x3b0: reg->U1B0 = RegisterValue; break; - case 0x3bc: reg->U1BC_LEDConfigure = RegisterValue; break; - case 0x400: reg->D00_DmaControl = RegisterValue; break; - case 0x800: reg->M00_MacControl = RegisterValue; break; - case 0x804: reg->M04_MulticastAddress1 = RegisterValue; break; - case 0x808: reg->M08_MulticastAddress2 = RegisterValue; break; - case 0x824: reg->M24_MacControl = RegisterValue; break; - case 0x828: reg->M28_MacControl = RegisterValue; break; - case 0x82c: reg->M2C_MacControl = RegisterValue; break; - case 0x838: reg->M38_MacControl = RegisterValue; break; - case 0x840: reg->M40_MacControl = RegisterValue; break; - case 0x844: reg->M44_MacControl = RegisterValue; break; - case 0x848: reg->M48_MacControl = RegisterValue; break; - case 0x84c: reg->M4C_MacStatus = RegisterValue; break; - case 0x860: reg->M60_MacControl = RegisterValue; break; - case 0x868: reg->M68_MacControl = RegisterValue; break; - case 0x870: reg->M70_MacControl = RegisterValue; break; - case 0x874: reg->M74_MacControl = RegisterValue; break; - case 0x878: reg->M78_ERPInformation = RegisterValue; break; - case 0x87C: reg->M7C_MacControl = RegisterValue; break; - case 0x880: reg->M80_MacControl = RegisterValue; break; - case 0x884: reg->M84_MacControl = RegisterValue; break; - case 0x888: reg->M88_MacControl = RegisterValue; break; - case 0x898: reg->M98_MacControl = RegisterValue; break; - case 0x100c: reg->BB0C = RegisterValue; break; - case 0x102c: reg->BB2C = RegisterValue; break; - case 0x1030: reg->BB30 = RegisterValue; break; - case 0x103c: reg->BB3C = RegisterValue; break; - case 0x1048: reg->BB48 = RegisterValue; break; - case 0x104c: reg->BB4C = RegisterValue; break; - case 0x1050: reg->BB50 = RegisterValue; break; - case 0x1054: reg->BB54 = RegisterValue; break; - case 0x1058: reg->BB58 = RegisterValue; break; - case 0x105c: reg->BB5C = RegisterValue; break; - case 0x1060: reg->BB60 = RegisterValue; break; + case 0x3b0: + reg->U1B0 = RegisterValue; + break; + case 0x3bc: + reg->U1BC_LEDConfigure = RegisterValue; + break; + case 0x400: + reg->D00_DmaControl = RegisterValue; + break; + case 0x800: + reg->M00_MacControl = RegisterValue; + break; + case 0x804: + reg->M04_MulticastAddress1 = RegisterValue; + break; + case 0x808: + reg->M08_MulticastAddress2 = RegisterValue; + break; + case 0x824: + reg->M24_MacControl = RegisterValue; + break; + case 0x828: + reg->M28_MacControl = RegisterValue; + break; + case 0x82c: + reg->M2C_MacControl = RegisterValue; + break; + case 0x838: + reg->M38_MacControl = RegisterValue; + break; + case 0x840: + reg->M40_MacControl = RegisterValue; + break; + case 0x844: + reg->M44_MacControl = RegisterValue; + break; + case 0x848: + reg->M48_MacControl = RegisterValue; + break; + case 0x84c: + reg->M4C_MacStatus = RegisterValue; + break; + case 0x860: + reg->M60_MacControl = RegisterValue; + break; + case 0x868: + reg->M68_MacControl = RegisterValue; + break; + case 0x870: + reg->M70_MacControl = RegisterValue; + break; + case 0x874: + reg->M74_MacControl = RegisterValue; + break; + case 0x878: + reg->M78_ERPInformation = RegisterValue; + break; + case 0x87C: + reg->M7C_MacControl = RegisterValue; + break; + case 0x880: + reg->M80_MacControl = RegisterValue; + break; + case 0x884: + reg->M84_MacControl = RegisterValue; + break; + case 0x888: + reg->M88_MacControl = RegisterValue; + break; + case 0x898: + reg->M98_MacControl = RegisterValue; + break; + case 0x100c: + reg->BB0C = RegisterValue; + break; + case 0x102c: + reg->BB2C = RegisterValue; + break; + case 0x1030: + reg->BB30 = RegisterValue; + break; + case 0x103c: + reg->BB3C = RegisterValue; + break; + case 0x1048: + reg->BB48 = RegisterValue; + break; + case 0x104c: + reg->BB4C = RegisterValue; + break; + case 0x1050: + reg->BB50 = RegisterValue; + break; + case 0x1054: + reg->BB54 = RegisterValue; + break; + case 0x1058: + reg->BB58 = RegisterValue; + break; + case 0x105c: + reg->BB5C = RegisterValue; + break; + case 0x1060: + reg->BB60 = RegisterValue; + break; } } @@ -120,7 +188,8 @@ void Wb35Reg_Update(struct hw_data *pHwData, u16 RegisterNo, u32 RegisterValue * true : read command process successfully * false : register not support */ -unsigned char Wb35Reg_WriteSync(struct hw_data *pHwData, u16 RegisterNo, u32 RegisterValue) +unsigned char Wb35Reg_WriteSync(struct hw_data *pHwData, u16 RegisterNo, + u32 RegisterValue) { struct wb35_reg *reg = &pHwData->reg; int ret = -1; @@ -140,19 +209,18 @@ unsigned char Wb35Reg_WriteSync(struct hw_data *pHwData, u16 RegisterNo, u32 Reg /* Sync IoCallDriver */ reg->EP0vm_state = VM_RUNNING; - ret = usb_control_msg(pHwData->WbUsb.udev, - usb_sndctrlpipe(pHwData->WbUsb.udev, 0), - 0x03, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, - 0x0, RegisterNo, &RegisterValue, 4, HZ * 100); + ret = usb_control_msg(pHwData->udev, + usb_sndctrlpipe(pHwData->udev, 0), + 0x03, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, + 0x0, RegisterNo, &RegisterValue, 4, HZ * 100); reg->EP0vm_state = VM_STOP; reg->SyncIoPause = 0; Wb35Reg_EP0VM_start(pHwData); if (ret < 0) { -#ifdef _PE_REG_DUMP_ - printk("EP0 Write register usb message sending error\n"); -#endif + pr_debug("EP0 Write register usb message sending error\n"); pHwData->SurpriseRemove = 1; return false; } @@ -163,7 +231,8 @@ unsigned char Wb35Reg_WriteSync(struct hw_data *pHwData, u16 RegisterNo, u32 Reg * true : read command process successfully * false : register not support */ -unsigned char Wb35Reg_Write(struct hw_data *pHwData, u16 RegisterNo, u32 RegisterValue) +unsigned char Wb35Reg_Write(struct hw_data *pHwData, u16 RegisterNo, + u32 RegisterValue) { struct wb35_reg *reg = &pHwData->reg; struct usb_ctrlrequest *dr; @@ -178,50 +247,51 @@ unsigned char Wb35Reg_Write(struct hw_data *pHwData, u16 RegisterNo, u32 Registe /* update the register by send urb request */ UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); + if (reg_queue == NULL) + return false; + urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 1; /* burst write register */ - reg_queue->INDEX = RegisterNo; - reg_queue->VALUE = cpu_to_le32(RegisterValue); - reg_queue->RESERVED_VALID = false; - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; - dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(0x0); - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(4); - - /* Enter the sending queue */ - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; + if (urb == NULL) { + kfree(reg_queue); + return false; + } - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; + reg_queue->DIRECT = 1; /* burst write register */ + reg_queue->INDEX = RegisterNo; + reg_queue->VALUE = cpu_to_le32(RegisterValue); + reg_queue->RESERVED_VALID = false; + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; + dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(0x0); + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(4); + + /* Enter the sending queue */ + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; - spin_unlock_irq(®->EP0VM_spin_lock); + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); + spin_unlock_irq(®->EP0VM_spin_lock); - return true; - } else { - if (urb) - usb_free_urb(urb); - kfree(reg_queue); - return false; - } + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } /* * This command will be executed with a user defined value. When it completes, * this value is useful. For example, hal_set_current_channel will use it. * true : read command process successfully - * false : register not support + * false : register not supported */ unsigned char Wb35Reg_WriteWithCallbackValue(struct hw_data *pHwData, u16 RegisterNo, @@ -242,43 +312,45 @@ unsigned char Wb35Reg_WriteWithCallbackValue(struct hw_data *pHwData, /* update the register by send urb request */ UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 1; /* burst write register */ - reg_queue->INDEX = RegisterNo; - reg_queue->VALUE = cpu_to_le32(RegisterValue); - /* NOTE : Users must guarantee the size of value will not exceed the buffer size. */ - memcpy(reg_queue->RESERVED, pValue, Len); - reg_queue->RESERVED_VALID = true; - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; - dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(0x0); - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(4); - - /* Enter the sending queue */ - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; - - spin_unlock_irq(®->EP0VM_spin_lock); + if (reg_queue == NULL) + return false; - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); - return true; - } else { - if (urb) - usb_free_urb(urb); + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { kfree(reg_queue); return false; } + + reg_queue->DIRECT = 1; /* burst write register */ + reg_queue->INDEX = RegisterNo; + reg_queue->VALUE = cpu_to_le32(RegisterValue); + /* NOTE : Users must guarantee the size of value will not exceed the buffer size. */ + memcpy(reg_queue->RESERVED, pValue, Len); + reg_queue->RESERVED_VALID = true; + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + dr->bRequestType = USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE; + dr->bRequest = 0x03; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(0x0); + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(4); + + /* Enter the sending queue */ + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; + + spin_unlock_irq(®->EP0VM_spin_lock); + + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } /* @@ -287,7 +359,8 @@ unsigned char Wb35Reg_WriteWithCallbackValue(struct hw_data *pHwData, * pRegisterValue : It must be a resident buffer due to * asynchronous read register. */ -unsigned char Wb35Reg_ReadSync(struct hw_data *pHwData, u16 RegisterNo, u32 *pRegisterValue) +unsigned char Wb35Reg_ReadSync(struct hw_data *pHwData, u16 RegisterNo, + u32 *pRegisterValue) { struct wb35_reg *reg = &pHwData->reg; u32 *pltmp = pRegisterValue; @@ -305,10 +378,11 @@ unsigned char Wb35Reg_ReadSync(struct hw_data *pHwData, u16 RegisterNo, u32 *pRe msleep(10); reg->EP0vm_state = VM_RUNNING; - ret = usb_control_msg(pHwData->WbUsb.udev, - usb_rcvctrlpipe(pHwData->WbUsb.udev, 0), - 0x01, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - 0x0, RegisterNo, pltmp, 4, HZ * 100); + ret = usb_control_msg(pHwData->udev, + usb_rcvctrlpipe(pHwData->udev, 0), + 0x01, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, + 0x0, RegisterNo, pltmp, 4, HZ * 100); *pRegisterValue = cpu_to_le32(*pltmp); @@ -320,9 +394,7 @@ unsigned char Wb35Reg_ReadSync(struct hw_data *pHwData, u16 RegisterNo, u32 *pRe Wb35Reg_EP0VM_start(pHwData); if (ret < 0) { -#ifdef _PE_REG_DUMP_ - printk("EP0 Read register usb message sending error\n"); -#endif + pr_debug("EP0 Read register usb message sending error\n"); pHwData->SurpriseRemove = 1; return false; } @@ -335,7 +407,8 @@ unsigned char Wb35Reg_ReadSync(struct hw_data *pHwData, u16 RegisterNo, u32 *pRe * pRegisterValue : It must be a resident buffer due to * asynchronous read register. */ -unsigned char Wb35Reg_Read(struct hw_data *pHwData, u16 RegisterNo, u32 *pRegisterValue) +unsigned char Wb35Reg_Read(struct hw_data *pHwData, u16 RegisterNo, + u32 *pRegisterValue) { struct wb35_reg *reg = &pHwData->reg; struct usb_ctrlrequest *dr; @@ -350,41 +423,41 @@ unsigned char Wb35Reg_Read(struct hw_data *pHwData, u16 RegisterNo, u32 *pRegist /* update the variable by send Urb to read register */ UrbSize = sizeof(struct wb35_reg_queue) + sizeof(struct usb_ctrlrequest); reg_queue = kzalloc(UrbSize, GFP_ATOMIC); - urb = usb_alloc_urb(0, GFP_ATOMIC); - if (urb && reg_queue) { - reg_queue->DIRECT = 0; /* read register */ - reg_queue->INDEX = RegisterNo; - reg_queue->pBuffer = pRegisterValue; - dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); - dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN; - dr->bRequest = 0x01; /* USB or vendor-defined request code, burst mode */ - dr->wValue = cpu_to_le16(0x0); - dr->wIndex = cpu_to_le16(RegisterNo); - dr->wLength = cpu_to_le16(4); - - /* Enter the sending queue */ - reg_queue->Next = NULL; - reg_queue->pUsbReq = dr; - reg_queue->urb = urb; - spin_lock_irq(®->EP0VM_spin_lock); - if (reg->reg_first == NULL) - reg->reg_first = reg_queue; - else - reg->reg_last->Next = reg_queue; - reg->reg_last = reg_queue; - - spin_unlock_irq(®->EP0VM_spin_lock); - - /* Start EP0VM */ - Wb35Reg_EP0VM_start(pHwData); + if (reg_queue == NULL) + return false; - return true; - } else { - if (urb) - usb_free_urb(urb); + urb = usb_alloc_urb(0, GFP_ATOMIC); + if (urb == NULL) { kfree(reg_queue); return false; } + reg_queue->DIRECT = 0; /* read register */ + reg_queue->INDEX = RegisterNo; + reg_queue->pBuffer = pRegisterValue; + dr = (struct usb_ctrlrequest *)((u8 *)reg_queue + sizeof(struct wb35_reg_queue)); + dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN; + dr->bRequest = 0x01; /* USB or vendor-defined request code, burst mode */ + dr->wValue = cpu_to_le16(0x0); + dr->wIndex = cpu_to_le16(RegisterNo); + dr->wLength = cpu_to_le16(4); + + /* Enter the sending queue */ + reg_queue->Next = NULL; + reg_queue->pUsbReq = dr; + reg_queue->urb = urb; + spin_lock_irq(®->EP0VM_spin_lock); + if (reg->reg_first == NULL) + reg->reg_first = reg_queue; + else + reg->reg_last->Next = reg_queue; + reg->reg_last = reg_queue; + + spin_unlock_irq(®->EP0VM_spin_lock); + + /* Start EP0VM */ + Wb35Reg_EP0VM_start(pHwData); + + return true; } @@ -432,8 +505,8 @@ void Wb35Reg_EP0VM(struct hw_data *pHwData) if (reg_queue->DIRECT == 1) /* output */ pBuffer = ®_queue->VALUE; - usb_fill_control_urb(urb, pHwData->WbUsb.udev, - REG_DIRECTION(pHwData->WbUsb.udev, reg_queue), + usb_fill_control_urb(urb, pHwData->udev, + REG_DIRECTION(pHwData->udev, reg_queue), (u8 *)dr, pBuffer, cpu_to_le16(dr->wLength), Wb35Reg_EP0VM_complete, (void *)pHwData); @@ -442,9 +515,7 @@ void Wb35Reg_EP0VM(struct hw_data *pHwData) ret = usb_submit_urb(urb, GFP_ATOMIC); if (ret < 0) { -#ifdef _PE_REG_DUMP_ - printk("EP0 Irp sending error\n"); -#endif + pr_debug("EP0 Irp sending error\n"); goto cleanup; } return; @@ -479,9 +550,7 @@ void Wb35Reg_EP0VM_complete(struct urb *urb) spin_unlock_irq(®->EP0VM_spin_lock); if (reg->EP0VM_status) { -#ifdef _PE_REG_DUMP_ - printk("EP0 IoCompleteRoutine return error\n"); -#endif + pr_debug("EP0 IoCompleteRoutine return error\n"); reg->EP0vm_state = VM_STOP; pHwData->SurpriseRemove = 1; } else { @@ -526,9 +595,7 @@ void Wb35Reg_destroy(struct hw_data *pHwData) usb_free_urb(urb); kfree(reg_queue); } else { -#ifdef _PE_REG_DUMP_ - printk("EP0 queue release error\n"); -#endif + pr_debug("EP0 queue release error\n"); } spin_lock_irq(®->EP0VM_spin_lock); @@ -643,7 +710,7 @@ unsigned char Wb35Reg_initial(struct hw_data *pHwData) * CardComputeCrc -- * * Description: - * Runs the AUTODIN II CRC algorithm on buffer Buffer of length, Length. + * Runs the AUTODIN II CRC algorithm on the buffers Buffer length. * * Arguments: * Buffer - the input buffer diff --git a/drivers/staging/winbond/wb35reg_f.h b/drivers/staging/winbond/wb35reg_f.h index bf23c108419..95dc9809684 100644 --- a/drivers/staging/winbond/wb35reg_f.h +++ b/drivers/staging/winbond/wb35reg_f.h @@ -1,7 +1,7 @@ #ifndef __WINBOND_WB35REG_F_H #define __WINBOND_WB35REG_F_H -#include "wbhal_s.h" +#include "wbhal.h" /* * ==================================== diff --git a/drivers/staging/winbond/wb35reg_s.h b/drivers/staging/winbond/wb35reg_s.h index 4eff009444b..dc79faa4029 100644 --- a/drivers/staging/winbond/wb35reg_s.h +++ b/drivers/staging/winbond/wb35reg_s.h @@ -3,7 +3,9 @@ #include <linux/spinlock.h> #include <linux/types.h> -#include <asm/atomic.h> +#include <linux/atomic.h> + +struct hw_data; /* ========================================================================= * @@ -49,11 +51,7 @@ #define DEFAULT_CWMAX 1023 /* (M2C) CWmax. Its value is in the range 0-1023. */ #define DEFAULT_AID 1 /* (M34) AID. Its value is in the range 1-2007. */ -#ifdef _USE_FALLBACK_RATE_ #define DEFAULT_RATE_RETRY_LIMIT 2 /* (M38) as named */ -#else -#define DEFAULT_RATE_RETRY_LIMIT 7 /* (M38) as named */ -#endif #define DEFAULT_LONG_RETRY_LIMIT 7 /* (M38) LongRetryLimit. Its value is in the range 0-15. */ #define DEFAULT_SHORT_RETRY_LIMIT 7 /* (M38) ShortRetryLimit. Its value is in the range 0-15. */ @@ -168,4 +166,75 @@ struct wb35_reg { u32 SQ3_filter[MAX_SQ3_FILTER_SIZE]; u32 SQ3_index; }; + +/* ===================================================================== + * Function declaration + * ===================================================================== + */ +void hal_remove_mapping_key(struct hw_data *hw_data, u8 *mac_addr); +void hal_remove_default_key(struct hw_data *hw_data, u32 index); +unsigned char hal_set_mapping_key(struct hw_data *adapter, u8 *mac_addr, + u8 null_key, u8 wep_on, u8 *tx_tsc, + u8 *rx_tsc, u8 key_type, u8 key_len, + u8 *key_data); +unsigned char hal_set_default_key(struct hw_data *adapter, u8 index, + u8 null_key, u8 wep_on, u8 *tx_tsc, + u8 *rx_tsc, u8 key_type, u8 key_len, + u8 *key_data); +void hal_clear_all_default_key(struct hw_data *hw_data); +void hal_clear_all_group_key(struct hw_data *hw_data); +void hal_clear_all_mapping_key(struct hw_data *hw_data); +void hal_clear_all_key(struct hw_data *hw_data); +void hal_set_power_save_mode(struct hw_data *hw_data, unsigned char power_save, + unsigned char wakeup, unsigned char dtim); +void hal_get_power_save_mode(struct hw_data *hw_data, u8 *in_pwr_save); +void hal_set_slot_time(struct hw_data *hw_data, u8 type); + +#define hal_set_atim_window(_A, _ATM) + +void hal_start_bss(struct hw_data *hw_data, u8 mac_op_mode); + +/* 0:BSS STA 1:IBSS STA */ +void hal_join_request(struct hw_data *hw_data, u8 bss_type); + +void hal_stop_sync_bss(struct hw_data *hw_data); +void hal_resume_sync_bss(struct hw_data *hw_data); +void hal_set_aid(struct hw_data *hw_data, u16 aid); +void hal_set_bssid(struct hw_data *hw_data, u8 *bssid); +void hal_get_bssid(struct hw_data *hw_data, u8 *bssid); +void hal_set_listen_interval(struct hw_data *hw_data, u16 listen_interval); +void hal_set_cap_info(struct hw_data *hw_data, u16 capability_info); +void hal_set_ssid(struct hw_data *hw_data, u8 *ssid, u8 ssid_len); +void hal_start_tx0(struct hw_data *hw_data); + +#define hal_get_cwmin(_A) ((_A)->cwmin) + +void hal_set_cwmax(struct hw_data *hw_data, u16 cwin_max); + +#define hal_get_cwmax(_A) ((_A)->cwmax) + +void hal_set_rsn_wpa(struct hw_data *hw_data, u32 *rsn_ie_bitmap, + u32 *rsn_oui_type , unsigned char desired_auth_mode); +void hal_set_connect_info(struct hw_data *hw_data, unsigned char bo_connect); +u8 hal_get_est_sq3(struct hw_data *hw_data, u8 count); +void hal_descriptor_indicate(struct hw_data *hw_data, + struct wb35_descriptor *des); +u8 hal_get_antenna_number(struct hw_data *hw_data); +u32 hal_get_bss_pk_cnt(struct hw_data *hw_data); + +#define hal_get_region_from_EEPROM(_A) ((_A)->reg.EEPROMRegion) +#define hal_get_tx_buffer(_A, _B) Wb35Tx_get_tx_buffer(_A, _B) +#define hal_software_set(_A) (_A->SoftwareSet) +#define hal_driver_init_OK(_A) (_A->IsInitOK) +#define hal_rssi_boundary_high(_A) (_A->RSSI_high) +#define hal_rssi_boundary_low(_A) (_A->RSSI_low) +#define hal_scan_interval(_A) (_A->Scan_Interval) + +#define PHY_DEBUG(msg, args...) + +/* return 100ms count */ +#define hal_get_time_count(_P) (_P->time_count / 10) + +#define hal_ibss_disconnect(_A) (hal_stop_sync_bss(_A)) + #endif diff --git a/drivers/staging/winbond/wb35rx.c b/drivers/staging/winbond/wb35rx.c index 448514aada4..f006b166aeb 100644 --- a/drivers/staging/winbond/wb35rx.c +++ b/drivers/staging/winbond/wb35rx.c @@ -14,10 +14,10 @@ #include <linux/slab.h> #include "core.h" -#include "sysdef.h" #include "wb35rx_f.h" -static void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, int PacketSize) +static void packet_came(struct ieee80211_hw *hw, char *pRxBufferAddress, + int PacketSize) { struct wbsoft_priv *priv = hw->priv; struct sk_buff *skb; @@ -65,7 +65,8 @@ static void Wb35Rx_adjust(struct wb35_descriptor *pRxDes) } else if (DecryptionMethod) { /* For TKIP and CCMP */ for (i = 7; i > 1; i--) pRxBufferAddress[i] = pRxBufferAddress[i - 2]; - pRxDes->buffer_address[0] = pRxBufferAddress + 2; /* Update the descriptor, shift 8 byte */ + /* Update the descriptor, shift 8 byte */ + pRxDes->buffer_address[0] = pRxBufferAddress + 2; BufferSize -= 8; /* 8 byte for IV + ICV */ } pRxDes->buffer_size[0] = BufferSize; @@ -96,7 +97,9 @@ static u16 Wb35Rx_indicate(struct ieee80211_hw *hw) /* Parse the bulkin buffer */ while (BufferSize >= 4) { - if ((cpu_to_le32(*(u32 *)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) /* Is ending? */ + /* Is ending? */ + if ((cpu_to_le32(*(u32 *)pRxBufferAddress) & 0x0fffffff) == + RX_END_TAG) break; /* Get the R00 R01 first */ @@ -109,10 +112,8 @@ static u16 Wb35Rx_indicate(struct ieee80211_hw *hw) /* Basic check for Rx length. Is length valid? */ if (PacketSize > MAX_PACKET_SIZE) { -#ifdef _PE_RX_DUMP_ - printk("Serious ERROR : Rx data size too long, size =%d\n", PacketSize); -#endif - + pr_debug("Serious ERROR : Rx data size too long, size =%d\n", + PacketSize); pWb35Rx->EP3vm_state = VM_STOP; pWb35Rx->Ep3ErrorCount2++; break; @@ -122,7 +123,8 @@ static u16 Wb35Rx_indicate(struct ieee80211_hw *hw) * Wb35Rx_indicate() is called synchronously so it isn't * necessary to set "RxDes.Desctriptor_ID = RxBufferID;" */ - BufferSize -= 8; /* subtract 8 byte for 35's USB header length */ + /* subtract 8 byte for 35's USB header length */ + BufferSize -= 8; pRxBufferAddress += 8; RxDes.buffer_address[0] = pRxBufferAddress; @@ -174,7 +176,7 @@ static void Wb35Rx_Complete(struct urb *urb) /* The IRP is completed */ pWb35Rx->EP3vm_state = VM_COMPLETED; - if (pHwData->SurpriseRemove || pHwData->HwStop) /* Must be here, or RxBufferId is invalid */ + if (pHwData->SurpriseRemove) /* Must be here, or RxBufferId is invalid */ goto error; if (pWb35Rx->rx_halt) @@ -186,9 +188,7 @@ static void Wb35Rx_Complete(struct urb *urb) /* The URB is completed, check the result */ if (pWb35Rx->EP3VM_status != 0) { -#ifdef _PE_USB_STATE_DUMP_ - printk("EP3 IoCompleteRoutine return error\n"); -#endif + pr_debug("EP3 IoCompleteRoutine return error\n"); pWb35Rx->EP3vm_state = VM_STOP; goto error; } @@ -239,7 +239,7 @@ static void Wb35Rx(struct ieee80211_hw *hw) u32 RxBufferId; /* Issuing URB */ - if (pHwData->SurpriseRemove || pHwData->HwStop) + if (pHwData->SurpriseRemove) goto error; if (pWb35Rx->rx_halt) @@ -249,9 +249,7 @@ static void Wb35Rx(struct ieee80211_hw *hw) RxBufferId = pWb35Rx->RxBufferId; if (!pWb35Rx->RxOwner[RxBufferId]) { /* It's impossible to run here. */ -#ifdef _PE_RX_DUMP_ - printk("Rx driver fifo unavailable\n"); -#endif + pr_debug("Rx driver fifo unavailable\n"); goto error; } @@ -263,13 +261,13 @@ static void Wb35Rx(struct ieee80211_hw *hw) pWb35Rx->pDRx = kzalloc(MAX_USB_RX_BUFFER, GFP_ATOMIC); if (!pWb35Rx->pDRx) { - printk("w35und: Rx memory alloc failed\n"); + dev_info(&hw->wiphy->dev, "w35und: Rx memory alloc failed\n"); goto error; } pRxBufferAddress = pWb35Rx->pDRx; - usb_fill_bulk_urb(urb, pHwData->WbUsb.udev, - usb_rcvbulkpipe(pHwData->WbUsb.udev, 3), + usb_fill_bulk_urb(urb, pHwData->udev, + usb_rcvbulkpipe(pHwData->udev, 3), pRxBufferAddress, MAX_USB_RX_BUFFER, Wb35Rx_Complete, hw); @@ -278,7 +276,7 @@ static void Wb35Rx(struct ieee80211_hw *hw) retv = usb_submit_urb(urb, GFP_ATOMIC); if (retv != 0) { - printk("Rx URB sending error\n"); + dev_info(&hw->wiphy->dev, "Rx URB sending error\n"); goto error; } return; @@ -314,7 +312,9 @@ static void Wb35Rx_reset_descriptor(struct hw_data *pHwData) pWb35Rx->EP3vm_state = VM_STOP; pWb35Rx->rx_halt = 0; - /* Initial the Queue. The last buffer is reserved for used if the Rx resource is unavailable. */ + /* Initial the Queue. The last buffer is reserved for used + * if the Rx resource is unavailable. + */ for (i = 0; i < MAX_USB_RX_BUFFER_NUMBER; i++) pWb35Rx->RxOwner[i] = 1; } @@ -336,10 +336,9 @@ void Wb35Rx_stop(struct hw_data *pHwData) /* Canceling the Irp if already sends it out. */ if (pWb35Rx->EP3vm_state == VM_RUNNING) { - usb_unlink_urb(pWb35Rx->RxUrb); /* Only use unlink, let Wb35Rx_destroy to free them */ -#ifdef _PE_RX_DUMP_ - printk("EP3 Rx stop\n"); -#endif + /* Only use unlink, let Wb35Rx_destroy to free them */ + usb_unlink_urb(pWb35Rx->RxUrb); + pr_debug("EP3 Rx stop\n"); } } @@ -353,10 +352,7 @@ void Wb35Rx_destroy(struct hw_data *pHwData) } while (pWb35Rx->EP3vm_state != VM_STOP); msleep(10); /* Delay for waiting function exit */ - if (pWb35Rx->RxUrb) - usb_free_urb(pWb35Rx->RxUrb); -#ifdef _PE_RX_DUMP_ - printk("Wb35Rx_destroy OK\n"); -#endif + usb_free_urb(pWb35Rx->RxUrb); + pr_debug("Wb35Rx_destroy OK\n"); } diff --git a/drivers/staging/winbond/wb35rx_f.h b/drivers/staging/winbond/wb35rx_f.h index 98acce517d9..559bdca12e1 100644 --- a/drivers/staging/winbond/wb35rx_f.h +++ b/drivers/staging/winbond/wb35rx_f.h @@ -2,14 +2,14 @@ #define __WINBOND_WB35RX_F_H #include <net/mac80211.h> -#include "wbhal_s.h" +#include "wbhal.h" -//==================================== -// Interface function declare -//==================================== -unsigned char Wb35Rx_initial( struct hw_data * pHwData ); -void Wb35Rx_destroy( struct hw_data * pHwData ); -void Wb35Rx_stop( struct hw_data * pHwData ); +/* + * Interface function declaration + */ +unsigned char Wb35Rx_initial(struct hw_data *pHwData); +void Wb35Rx_destroy(struct hw_data *pHwData); +void Wb35Rx_stop(struct hw_data *pHwData); void Wb35Rx_start(struct ieee80211_hw *hw); #endif diff --git a/drivers/staging/winbond/wb35rx_s.h b/drivers/staging/winbond/wb35rx_s.h index 4b03274a7d2..545bc950072 100644 --- a/drivers/staging/winbond/wb35rx_s.h +++ b/drivers/staging/winbond/wb35rx_s.h @@ -1,44 +1,44 @@ -//============================================================================ -// wb35rx.h -- -//============================================================================ +#ifndef __WINBOND_35RX_S_H +#define __WINBOND_35RX_S_H -// Definition for this module used -#define MAX_USB_RX_BUFFER 4096 // This parameter must be 4096 931130.4.f +/* Definition for this module used */ +#define MAX_USB_RX_BUFFER 4096 /* This parameter must be 4096 931130.4.f */ +#define MAX_USB_RX_BUFFER_NUMBER ETHERNET_RX_DESCRIPTORS /* Maximum 254, 255 is RESERVED ID */ +#define RX_INTERFACE 0 /* Interface 1 */ +#define RX_PIPE 2 /* Pipe 3 */ +#define MAX_PACKET_SIZE 1600 /* 1568 = 8 + 1532 + 4 + 24(IV EIV MIC ICV CRC) for check DMA data 931130.4.g */ +#define RX_END_TAG 0x0badbeef -#define MAX_USB_RX_BUFFER_NUMBER ETHERNET_RX_DESCRIPTORS // Maximum 254, 255 is RESERVED ID -#define RX_INTERFACE 0 // Interface 1 -#define RX_PIPE 2 // Pipe 3 -#define MAX_PACKET_SIZE 1600 //1568 // 8 + 1532 + 4 + 24(IV EIV MIC ICV CRC) for check DMA data 931130.4.g -#define RX_END_TAG 0x0badbeef - -//==================================== -// Internal variable for module -//==================================== +/* + * Internal variable for module + */ struct wb35_rx { - u32 ByteReceived;// For calculating throughput of BulkIn - atomic_t RxFireCounter;// Does Wb35Rx module fire? + u32 ByteReceived; /* For calculating throughput of BulkIn */ + atomic_t RxFireCounter;/* Does Wb35Rx module fire? */ - u8 RxBuffer[ MAX_USB_RX_BUFFER_NUMBER ][ ((MAX_USB_RX_BUFFER+3) & ~0x03 ) ]; - u16 RxBufferSize[ ((MAX_USB_RX_BUFFER_NUMBER+1) & ~0x01) ]; - u8 RxOwner[ ((MAX_USB_RX_BUFFER_NUMBER+3) & ~0x03 ) ];//Ownership of buffer 0: SW 1:HW + u8 RxBuffer[MAX_USB_RX_BUFFER_NUMBER][((MAX_USB_RX_BUFFER+3) & ~0x03)]; + u16 RxBufferSize[((MAX_USB_RX_BUFFER_NUMBER+1) & ~0x01)]; + u8 RxOwner[((MAX_USB_RX_BUFFER_NUMBER+3) & ~0x03)]; /* Ownership of buffer 0:SW 1:HW */ - u32 RxProcessIndex;//The next index to process - u32 RxBufferId; - u32 EP3vm_state; + u32 RxProcessIndex; /* The next index to process */ + u32 RxBufferId; + u32 EP3vm_state; - u32 rx_halt; // For VM stopping + u32 rx_halt; /* For VM stopping */ - u16 MoreDataSize; - u16 PacketSize; + u16 MoreDataSize; + u16 PacketSize; - u32 CurrentRxBufferId; // For complete routine usage - u32 Rx3UrbCancel; + u32 CurrentRxBufferId; /* For complete routine usage */ + u32 Rx3UrbCancel; - u32 LastR1; // For RSSI reporting - struct urb * RxUrb; - u32 Ep3ErrorCount2; // 20060625.1 Usbd for Rx DMA error count + u32 LastR1; /* For RSSI reporting */ + struct urb *RxUrb; + u32 Ep3ErrorCount2; /* 20060625.1 Usbd for Rx DMA error count */ int EP3VM_status; - u8 * pDRx; + u8 *pDRx; }; + +#endif /* __WINBOND_35RX_S_H */ diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c index 2a9d0555767..870cff39a22 100644 --- a/drivers/staging/winbond/wb35tx.c +++ b/drivers/staging/winbond/wb35tx.c @@ -1,22 +1,21 @@ -//============================================================================ -// Copyright (c) 1996-2002 Winbond Electronic Corporation -// -// Module Name: -// Wb35Tx.c -// -// Abstract: -// Processing the Tx message and put into down layer -// -//============================================================================ +/* + * Copyright (c) 1996-2002 Winbond Electronic Corporation + * + * Module Name: + * Wb35Tx.c + * + * Abstract: + * Processing the Tx message and put into down layer + * + */ #include <linux/usb.h> #include <linux/gfp.h> #include "wb35tx_f.h" #include "mds_f.h" -#include "sysdef.h" unsigned char -Wb35Tx_get_tx_buffer(struct hw_data * pHwData, u8 **pBuffer) +Wb35Tx_get_tx_buffer(struct hw_data *pHwData, u8 **pBuffer) { struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; @@ -26,30 +25,31 @@ Wb35Tx_get_tx_buffer(struct hw_data * pHwData, u8 **pBuffer) static void Wb35Tx(struct wbsoft_priv *adapter); -static void Wb35Tx_complete(struct urb * pUrb) +static void Wb35Tx_complete(struct urb *pUrb) { struct wbsoft_priv *adapter = pUrb->context; - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; struct wb35_mds *pMds = &adapter->Mds; printk("wb35: tx complete\n"); - // Variable setting + /* Variable setting */ pWb35Tx->EP4vm_state = VM_COMPLETED; - pWb35Tx->EP4VM_status = pUrb->status; //Store the last result of Irp - pMds->TxOwner[ pWb35Tx->TxSendIndex ] = 0;// Set the owner. Free the owner bit always. + pWb35Tx->EP4VM_status = pUrb->status; /* Store the last result of Irp */ + /* Set the owner. Free the owner bit always. */ + pMds->TxOwner[pWb35Tx->TxSendIndex] = 0; pWb35Tx->TxSendIndex++; pWb35Tx->TxSendIndex %= MAX_USB_TX_BUFFER_NUMBER; - if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove + if (pHwData->SurpriseRemove) /* Let WbWlanHalt handle surprise remove */ goto error; if (pWb35Tx->tx_halt) goto error; - // The URB is completed, check the result + /* The URB is completed, check the result */ if (pWb35Tx->EP4VM_status != 0) { - printk("URB submission failed\n"); + dev_err(&pUrb->dev->dev, "URB submission failed\n"); pWb35Tx->EP4vm_state = VM_STOP; goto error; } @@ -65,43 +65,42 @@ error: static void Wb35Tx(struct wbsoft_priv *adapter) { - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; u8 *pTxBufferAddress; struct wb35_mds *pMds = &adapter->Mds; - struct urb * pUrb = (struct urb *)pWb35Tx->Tx4Urb; - int retv; + struct urb *pUrb = (struct urb *)pWb35Tx->Tx4Urb; + int retv; u32 SendIndex; - - if (pHwData->SurpriseRemove || pHwData->HwStop) + if (pHwData->SurpriseRemove) goto cleanup; if (pWb35Tx->tx_halt) goto cleanup; - // Ownership checking + /* Ownership checking */ SendIndex = pWb35Tx->TxSendIndex; - if (!pMds->TxOwner[SendIndex]) //No more data need to be sent, return immediately + /* No more data need to be sent, return immediately */ + if (!pMds->TxOwner[SendIndex]) goto cleanup; pTxBufferAddress = pWb35Tx->TxBuffer[SendIndex]; - // - // Issuing URB - // - usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev, - usb_sndbulkpipe(pHwData->WbUsb.udev, 4), - pTxBufferAddress, pMds->TxBufferSize[ SendIndex ], + + /* Issuing URB */ + usb_fill_bulk_urb(pUrb, pHwData->udev, + usb_sndbulkpipe(pHwData->udev, 4), + pTxBufferAddress, pMds->TxBufferSize[SendIndex], Wb35Tx_complete, adapter); pWb35Tx->EP4vm_state = VM_RUNNING; retv = usb_submit_urb(pUrb, GFP_ATOMIC); - if (retv<0) { - printk("EP4 Tx Irp sending error\n"); + if (retv < 0) { + dev_err(&pUrb->dev->dev, "EP4 Tx Irp sending error\n"); goto cleanup; } - // Check if driver needs issue Irp for EP2 + /* Check if driver needs issue Irp for EP2 */ pWb35Tx->TxFillCount += pMds->TxCountInBuffer[SendIndex]; if (pWb35Tx->TxFillCount > 12) Wb35Tx_EP2VM_start(adapter); @@ -116,10 +115,10 @@ static void Wb35Tx(struct wbsoft_priv *adapter) void Wb35Tx_start(struct wbsoft_priv *adapter) { - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - // Allow only one thread to run into function + /* Allow only one thread to run into function */ if (atomic_inc_return(&pWb35Tx->TxFireCounter) == 1) { pWb35Tx->EP4vm_state = VM_RUNNING; Wb35Tx(adapter); @@ -127,7 +126,7 @@ void Wb35Tx_start(struct wbsoft_priv *adapter) atomic_dec(&pWb35Tx->TxFireCounter); } -unsigned char Wb35Tx_initial(struct hw_data * pHwData) +unsigned char Wb35Tx_initial(struct hw_data *pHwData) { struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; @@ -136,62 +135,52 @@ unsigned char Wb35Tx_initial(struct hw_data * pHwData) return false; pWb35Tx->Tx2Urb = usb_alloc_urb(0, GFP_ATOMIC); - if (!pWb35Tx->Tx2Urb) - { - usb_free_urb( pWb35Tx->Tx4Urb ); + if (!pWb35Tx->Tx2Urb) { + usb_free_urb(pWb35Tx->Tx4Urb); return false; } return true; } -//====================================================== -void Wb35Tx_stop(struct hw_data * pHwData) +void Wb35Tx_stop(struct hw_data *pHwData) { struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - // Trying to canceling the Trp of EP2 + /* Try to cancel the Trp of EP2 */ if (pWb35Tx->EP2vm_state == VM_RUNNING) - usb_unlink_urb( pWb35Tx->Tx2Urb ); // Only use unlink, let Wb35Tx_destrot to free them - #ifdef _PE_TX_DUMP_ - printk("EP2 Tx stop\n"); - #endif + /* Only use unlink, let Wb35Tx_destroy free them */ + usb_unlink_urb(pWb35Tx->Tx2Urb); + pr_debug("EP2 Tx stop\n"); - // Trying to canceling the Irp of EP4 + /* Try to cancel the Irp of EP4 */ if (pWb35Tx->EP4vm_state == VM_RUNNING) - usb_unlink_urb( pWb35Tx->Tx4Urb ); // Only use unlink, let Wb35Tx_destrot to free them - #ifdef _PE_TX_DUMP_ - printk("EP4 Tx stop\n"); - #endif + /* Only use unlink, let Wb35Tx_destroy free them */ + usb_unlink_urb(pWb35Tx->Tx4Urb); + pr_debug("EP4 Tx stop\n"); } -//====================================================== -void Wb35Tx_destroy(struct hw_data * pHwData) +void Wb35Tx_destroy(struct hw_data *pHwData) { struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - // Wait for VM stop + /* Wait for VM stop */ do { - msleep(10); // Delay for waiting function enter 940623.1.a - } while( (pWb35Tx->EP2vm_state != VM_STOP) && (pWb35Tx->EP4vm_state != VM_STOP) ); - msleep(10); // Delay for waiting function enter 940623.1.b + msleep(10); /* Delay for waiting function enter 940623.1.a */ + } while ((pWb35Tx->EP2vm_state != VM_STOP) && (pWb35Tx->EP4vm_state != VM_STOP)); + msleep(10); /* Delay for waiting function enter 940623.1.b */ - if (pWb35Tx->Tx4Urb) - usb_free_urb( pWb35Tx->Tx4Urb ); + usb_free_urb(pWb35Tx->Tx4Urb); + usb_free_urb(pWb35Tx->Tx2Urb); - if (pWb35Tx->Tx2Urb) - usb_free_urb( pWb35Tx->Tx2Urb ); - - #ifdef _PE_TX_DUMP_ - printk("Wb35Tx_destroy OK\n"); - #endif + pr_debug("Wb35Tx_destroy OK\n"); } void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 TimeCount) { - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - unsigned char Trigger = false; + bool Trigger = false; if (pWb35Tx->TxTimer > TimeCount) Trigger = true; @@ -206,46 +195,45 @@ void Wb35Tx_CurrentTime(struct wbsoft_priv *adapter, u32 TimeCount) static void Wb35Tx_EP2VM(struct wbsoft_priv *adapter); -static void Wb35Tx_EP2VM_complete(struct urb * pUrb) +static void Wb35Tx_EP2VM_complete(struct urb *pUrb) { struct wbsoft_priv *adapter = pUrb->context; - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct T02_descriptor T02, TSTATUS; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; + u32 *pltmp = (u32 *)pWb35Tx->EP2_buf; u32 i; u16 InterruptInLength; - - // Variable setting + /* Variable setting */ pWb35Tx->EP2vm_state = VM_COMPLETED; pWb35Tx->EP2VM_status = pUrb->status; - // For Linux 2.4. Interrupt will always trigger - if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove + /* For Linux 2.4. Interrupt will always trigger */ + if (pHwData->SurpriseRemove) /* Let WbWlanHalt handle surprise remove */ goto error; if (pWb35Tx->tx_halt) goto error; - //The Urb is completed, check the result + /* The Urb is completed, check the result */ if (pWb35Tx->EP2VM_status != 0) { - printk("EP2 IoCompleteRoutine return error\n"); - pWb35Tx->EP2vm_state= VM_STOP; + dev_err(&pUrb->dev->dev, "EP2 IoCompleteRoutine return error\n"); + pWb35Tx->EP2vm_state = VM_STOP; goto error; } - // Update the Tx result + /* Update the Tx result */ InterruptInLength = pUrb->actual_length; - // Modify for minimum memory access and DWORD alignment. - T02.value = cpu_to_le32(pltmp[0]) >> 8; // [31:8] -> [24:0] - InterruptInLength -= 1;// 20051221.1.c Modify the follow for more stable - InterruptInLength >>= 2; // InterruptInLength/4 + /* Modify for minimum memory access and DWORD alignment. */ + T02.value = cpu_to_le32(pltmp[0]) >> 8; /* [31:8] -> [24:0] */ + InterruptInLength -= 1; /* 20051221.1.c Modify the follow for more stable */ + InterruptInLength >>= 2; /* InterruptInLength/4 */ for (i = 1; i <= InterruptInLength; i++) { T02.value |= ((cpu_to_le32(pltmp[i]) & 0xff) << 24); - TSTATUS.value = T02.value; //20061009 anson's endian - Mds_SendComplete( adapter, &TSTATUS ); + TSTATUS.value = T02.value; /* 20061009 anson's endian */ + Mds_SendComplete(adapter, &TSTATUS); T02.value = cpu_to_le32(pltmp[i]) >> 8; } @@ -257,31 +245,28 @@ error: static void Wb35Tx_EP2VM(struct wbsoft_priv *adapter) { - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - struct urb * pUrb = (struct urb *)pWb35Tx->Tx2Urb; - u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; + struct urb *pUrb = (struct urb *)pWb35Tx->Tx2Urb; + u32 *pltmp = (u32 *)pWb35Tx->EP2_buf; int retv; - if (pHwData->SurpriseRemove || pHwData->HwStop) + if (pHwData->SurpriseRemove) goto error; if (pWb35Tx->tx_halt) goto error; - // - // Issuing URB - // - usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2), - pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, adapter, 32); + /* Issuing URB */ + usb_fill_int_urb(pUrb, pHwData->udev, usb_rcvintpipe(pHwData->udev, 2), + pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, + adapter, 32); pWb35Tx->EP2vm_state = VM_RUNNING; retv = usb_submit_urb(pUrb, GFP_ATOMIC); if (retv < 0) { - #ifdef _PE_TX_DUMP_ - printk("EP2 Tx Irp sending error\n"); - #endif + pr_debug("EP2 Tx Irp sending error\n"); goto error; } @@ -293,14 +278,13 @@ error: void Wb35Tx_EP2VM_start(struct wbsoft_priv *adapter) { - struct hw_data * pHwData = &adapter->sHwData; + struct hw_data *pHwData = &adapter->sHwData; struct wb35_tx *pWb35Tx = &pHwData->Wb35Tx; - // Allow only one thread to run into function + /* Allow only one thread to run into function */ if (atomic_inc_return(&pWb35Tx->TxResultCount) == 1) { pWb35Tx->EP2vm_state = VM_RUNNING; Wb35Tx_EP2VM(adapter); - } - else + } else atomic_dec(&pWb35Tx->TxResultCount); } diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h index 1d3b515f83b..018fd35e815 100644 --- a/drivers/staging/winbond/wb35tx_f.h +++ b/drivers/staging/winbond/wb35tx_f.h @@ -2,7 +2,6 @@ #define __WINBOND_WB35TX_F_H #include "core.h" -#include "wbhal_f.h" /* * ==================================== diff --git a/drivers/staging/winbond/wb35tx_s.h b/drivers/staging/winbond/wb35tx_s.h index f70f4339559..dc120085d52 100644 --- a/drivers/staging/winbond/wb35tx_s.h +++ b/drivers/staging/winbond/wb35tx_s.h @@ -3,45 +3,37 @@ #include "mds_s.h" -//==================================== -// IS89C35 Tx related definition -//==================================== -#define TX_INTERFACE 0 // Interface 1 -#define TX_PIPE 3 // endpoint 4 -#define TX_INTERRUPT 1 // endpoint 2 -#define MAX_INTERRUPT_LENGTH 64 // It must be 64 for EP2 hardware - - - -//==================================== -// Internal variable for module -//==================================== - +/* IS89C35 Tx related definition */ +#define TX_INTERFACE 0 /* Interface 1 */ +#define TX_PIPE 3 /* Endpoint 4 */ +#define TX_INTERRUPT 1 /* Endpoint 2 */ +#define MAX_INTERRUPT_LENGTH 64 /* It must be 64 for EP2 hardware */ +/* Internal variable for module */ struct wb35_tx { - // For Tx buffer - u8 TxBuffer[ MAX_USB_TX_BUFFER_NUMBER ][ MAX_USB_TX_BUFFER ]; + /* For Tx buffer */ + u8 TxBuffer[MAX_USB_TX_BUFFER_NUMBER][MAX_USB_TX_BUFFER]; - // For Interrupt pipe + /* For Interrupt pipe */ u8 EP2_buf[MAX_INTERRUPT_LENGTH]; - atomic_t TxResultCount;// For thread control of EP2 931130.4.m - atomic_t TxFireCounter;// For thread control of EP4 931130.4.n - u32 ByteTransfer; + atomic_t TxResultCount; /* For thread control of EP2 931130.4.m */ + atomic_t TxFireCounter; /* For thread control of EP4 931130.4.n */ + u32 ByteTransfer; - u32 TxSendIndex;// The next index of Mds array to be sent - u32 EP2vm_state; // for EP2vm state - u32 EP4vm_state; // for EP4vm state - u32 tx_halt; // Stopping VM + u32 TxSendIndex; /* The next index of Mds array to be sent */ + u32 EP2vm_state; /* for EP2vm state */ + u32 EP4vm_state; /* for EP4vm state */ + u32 tx_halt; /* Stopping VM */ - struct urb * Tx4Urb; - struct urb * Tx2Urb; + struct urb *Tx4Urb; + struct urb *Tx2Urb; int EP2VM_status; int EP4VM_status; - u32 TxFillCount; // 20060928 - u32 TxTimer; // 20060928 Add if sending packet not great than 13 + u32 TxFillCount; /* 20060928 */ + u32 TxTimer; /* 20060928 Add if sending packet is greater than 13 */ }; #endif diff --git a/drivers/staging/winbond/wbhal_s.h b/drivers/staging/winbond/wbhal.h index 821a1b3f130..289ee549146 100644 --- a/drivers/staging/winbond/wbhal_s.h +++ b/drivers/staging/winbond/wbhal.h @@ -226,11 +226,11 @@ struct T01_descriptor { u32 T01_add_challenge_text:1; u32 T01_inhibit_crc:1; u32 T01_loop_back_wep_mode:1; - u32 T01_retry_abort_ebable:1; + u32 T01_retry_abort_enable:1; }; #else struct { - u32 T01_retry_abort_ebable:1; + u32 T01_retry_abort_enable:1; u32 T01_loop_back_wep_mode:1; u32 T01_inhibit_crc:1; u32 T01_add_challenge_text:1; @@ -342,9 +342,6 @@ struct wb35_descriptor { /* Skip length = 8 DWORD */ void *buffer_address[MAX_DESCRIPTOR_BUFFER_INDEX]; }; - -#define DEFAULT_NULL_PACKET_COUNT 180000 /* 180 seconds */ - #define MAX_TXVGA_EEPROM 9 /* How many word(u16) of EEPROM will be used for TxVGA */ #define MAX_RF_PARAMETER 32 @@ -359,7 +356,6 @@ struct txvga_for_50 { * ============================================== */ -#include "wbusb_s.h" #include "wb35reg_s.h" #include "wb35tx_s.h" #include "wb35rx_s.h" @@ -440,7 +436,7 @@ struct hw_data { * Variable for each module * ================================================== */ - struct wb_usb WbUsb; /* Need WbUsb.h */ + struct usb_device *udev; struct wb35_reg reg; /* Need Wb35Reg.h */ struct wb35_tx Wb35Tx; /* Need Wb35Tx.h */ struct wb35_rx Wb35Rx; /* Need Wb35Rx.h */ @@ -510,16 +506,8 @@ struct hw_data { u32 RxByteCountLast; u32 TxByteCountLast; - atomic_t SurpriseRemoveCount; - /* For global timer */ u32 time_count; /* TICK_TIME_100ms 1 = 100ms */ - - /* For error recover */ - u32 HwStop; - - /* For avoid AP disconnect */ - u32 NullPacketCount; }; #endif diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h deleted file mode 100644 index fc78c14ae58..00000000000 --- a/drivers/staging/winbond/wbhal_f.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ===================================================================== - * Device related include - * ===================================================================== -*/ -#include "wb35reg_f.h" -#include "wb35tx_f.h" -#include "wb35rx_f.h" - -#include "core.h" - -/* ===================================================================== - * Function declaration - * ===================================================================== - */ -void hal_remove_mapping_key(struct hw_data *hw_data, u8 *mac_addr); -void hal_remove_default_key(struct hw_data *hw_data, u32 index); -unsigned char hal_set_mapping_key(struct hw_data *adapter, u8 *mac_addr, - u8 null_key, u8 wep_on, u8 *tx_tsc, - u8 *rx_tsc, u8 key_type, u8 key_len, - u8 *key_data); -unsigned char hal_set_default_key(struct hw_data *adapter, u8 index, - u8 null_key, u8 wep_on, u8 *tx_tsc, - u8 *rx_tsc, u8 key_type, u8 key_len, - u8 *key_data); -void hal_clear_all_default_key(struct hw_data *hw_data); -void hal_clear_all_group_key(struct hw_data *hw_data); -void hal_clear_all_mapping_key(struct hw_data *hw_data); -void hal_clear_all_key(struct hw_data *hw_data); -void hal_set_power_save_mode(struct hw_data *hw_data, unsigned char power_save, - unsigned char wakeup, unsigned char dtim); -void hal_get_power_save_mode(struct hw_data *hw_data, u8 *in_pwr_save); -void hal_set_slot_time(struct hw_data *hw_data, u8 type); - -#define hal_set_atim_window(_A, _ATM) - -void hal_start_bss(struct hw_data *hw_data, u8 mac_op_mode); - -/* 0:BSS STA 1:IBSS STA */ -void hal_join_request(struct hw_data *hw_data, u8 bss_type); - -void hal_stop_sync_bss(struct hw_data *hw_data); -void hal_resume_sync_bss(struct hw_data *hw_data); -void hal_set_aid(struct hw_data *hw_data, u16 aid); -void hal_set_bssid(struct hw_data *hw_data, u8 *bssid); -void hal_get_bssid(struct hw_data *hw_data, u8 *bssid); -void hal_set_listen_interval(struct hw_data *hw_data, u16 listen_interval); -void hal_set_cap_info(struct hw_data *hw_data, u16 capability_info); -void hal_set_ssid(struct hw_data *hw_data, u8 *ssid, u8 ssid_len); -void hal_start_tx0(struct hw_data *hw_data); - -#define hal_get_cwmin(_A) ((_A)->cwmin) - -void hal_set_cwmax(struct hw_data *hw_data, u16 cwin_max); - -#define hal_get_cwmax(_A) ((_A)->cwmax) - -void hal_set_rsn_wpa(struct hw_data *hw_data, u32 *rsn_ie_bitmap, - u32 *rsn_oui_type , unsigned char desired_auth_mode); -void hal_set_connect_info(struct hw_data *hw_data, unsigned char bo_connect); -u8 hal_get_est_sq3(struct hw_data *hw_data, u8 count); -void hal_descriptor_indicate(struct hw_data *hw_data, - struct wb35_descriptor *des); -u8 hal_get_antenna_number(struct hw_data *hw_data); -u32 hal_get_bss_pk_cnt(struct hw_data *hw_data); - -#define hal_get_region_from_EEPROM(_A) ((_A)->reg.EEPROMRegion) -#define hal_get_tx_buffer(_A, _B) Wb35Tx_get_tx_buffer(_A, _B) -#define hal_software_set(_A) (_A->SoftwareSet) -#define hal_driver_init_OK(_A) (_A->IsInitOK) -#define hal_rssi_boundary_high(_A) (_A->RSSI_high) -#define hal_rssi_boundary_low(_A) (_A->RSSI_low) -#define hal_scan_interval(_A) (_A->Scan_Interval) - -#define PHY_DEBUG(msg, args...) - -/* return 100ms count */ -#define hal_get_time_count(_P) (_P->time_count / 10) -#define hal_detect_error(_P) (_P->WbUsb.DetectCount) - -#define hal_ibss_disconnect(_A) (hal_stop_sync_bss(_A)) diff --git a/drivers/staging/winbond/wblinux_f.h b/drivers/staging/winbond/wblinux_f.h deleted file mode 100644 index 0a9d214f718..00000000000 --- a/drivers/staging/winbond/wblinux_f.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __WBLINUX_F_H -#define __WBLINUX_F_H - -#include "core.h" -#include "mds_s.h" - -/* - * ==================================================================== - * Copyright (c) 1996-2004 Winbond Electronic Corporation - * - * wblinux_f.h - * ==================================================================== - */ -int wb35_start_xmit(struct sk_buff *skb, struct net_device *netdev); -void wb35_set_multicast(struct net_device *netdev); -struct net_device_stats *wb35_netdev_stats(struct net_device *netdev); -#endif diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 3f60cf7e6ec..0d29624416c 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -11,19 +11,21 @@ */ #include <net/mac80211.h> #include <linux/usb.h> +#include <linux/module.h> #include "core.h" #include "mds_f.h" -#include "mlmetxrx_f.h" #include "mto.h" -#include "wbhal_f.h" -#include "wblinux_f.h" +#include "wbhal.h" +#include "wb35reg_f.h" +#include "wb35tx_f.h" +#include "wb35rx_f.h" MODULE_DESCRIPTION("IS89C35 802.11bg WLAN USB Driver"); MODULE_LICENSE("GPL"); MODULE_VERSION("0.1"); -static const struct usb_device_id wb35_table[] __devinitconst = { +static const struct usb_device_id wb35_table[] = { { USB_DEVICE(0x0416, 0x0035) }, { USB_DEVICE(0x18E8, 0x6201) }, { USB_DEVICE(0x18E8, 0x6206) }, @@ -77,18 +79,15 @@ static int wbsoft_add_interface(struct ieee80211_hw *dev, static void wbsoft_remove_interface(struct ieee80211_hw *dev, struct ieee80211_vif *vif) { - printk("wbsoft_remove interface called\n"); } static void wbsoft_stop(struct ieee80211_hw *hw) { - printk(KERN_INFO "%s called\n", __func__); } static int wbsoft_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) { - printk(KERN_INFO "%s called\n", __func__); return 0; } @@ -117,19 +116,22 @@ static void wbsoft_configure_filter(struct ieee80211_hw *dev, *total_flags = new_flags; } -static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) +static void wbsoft_tx(struct ieee80211_hw *dev, + struct ieee80211_tx_control *control, + struct sk_buff *skb) { struct wbsoft_priv *priv = dev->priv; - if (priv->sMlmeFrame.IsInUsed != PACKET_FREE_TO_USE) { + if (priv->sMlmeFrame.is_in_used != PACKET_FREE_TO_USE) { priv->sMlmeFrame.wNumTxMMPDUDiscarded++; - return NETDEV_TX_BUSY; + kfree_skb(skb); + return; } - priv->sMlmeFrame.IsInUsed = PACKET_COME_FROM_MLME; + priv->sMlmeFrame.is_in_used = PACKET_COME_FROM_MLME; priv->sMlmeFrame.pMMPDU = skb->data; - priv->sMlmeFrame.DataType = FRAME_TYPE_802_11_MANAGEMENT; + priv->sMlmeFrame.data_type = FRAME_TYPE_802_11_MANAGEMENT; priv->sMlmeFrame.len = skb->len; priv->sMlmeFrame.wNumTxMMPDU++; @@ -139,8 +141,6 @@ static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) */ Mds_Tx(priv); - - return NETDEV_TX_OK; } static int wbsoft_start(struct ieee80211_hw *dev) @@ -176,15 +176,9 @@ static void hal_set_current_channel_ex(struct hw_data *pHwData, struct chan_info if (pHwData->SurpriseRemove) return; - printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo); - RFSynthesizer_SwitchingChannel(pHwData, channel); /* Switch channel */ pHwData->Channel = channel.ChanNo; pHwData->band = channel.band; -#ifdef _PE_STATE_DUMP_ - printk("Set channel is %d, band =%d\n", pHwData->Channel, - pHwData->band); -#endif reg->M28_MacControl &= ~0xff; /* Clean channel information field */ reg->M28_MacControl |= channel.ChanNo; Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl, @@ -264,8 +258,6 @@ static int wbsoft_config(struct ieee80211_hw *dev, u32 changed) struct wbsoft_priv *priv = dev->priv; struct chan_info ch; - printk("wbsoft_config called\n"); - /* Should use channel_num, or something, as that is already pre-translated */ ch.band = 1; ch.ChanNo = 1; @@ -280,9 +272,8 @@ static int wbsoft_config(struct ieee80211_hw *dev, u32 changed) return 0; } -static u64 wbsoft_get_tsf(struct ieee80211_hw *dev) +static u64 wbsoft_get_tsf(struct ieee80211_hw *dev, struct ieee80211_vif *vif) { - printk("wbsoft_get_tsf called\n"); return 0; } @@ -339,10 +330,8 @@ static void hal_stop(struct hw_data *pHwData) static unsigned char hal_idle(struct hw_data *pHwData) { struct wb35_reg *reg = &pHwData->reg; - struct wb_usb *pWbUsb = &pHwData->WbUsb; - if (!pHwData->SurpriseRemove - && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP)) + if (!pHwData->SurpriseRemove && reg->EP0vm_state != VM_STOP) return false; return true; @@ -608,15 +597,6 @@ static void hal_led_control(unsigned long data) } break; } - - /* Active send null packet to avoid AP disconnect */ - if (pHwData->LED_LinkOn) { - pHwData->NullPacketCount += TimeInterval; - if (pHwData->NullPacketCount >= - DEFAULT_NULL_PACKET_COUNT) { - pHwData->NullPacketCount = 0; - } - } } pHwData->time_count += TimeInterval; @@ -651,13 +631,6 @@ static int hal_init_hardware(struct ieee80211_hw *hw) SoftwareSet = hal_software_set(pHwData); -#ifdef Vendor2 - /* Try to make sure the EEPROM contain */ - SoftwareSet >>= 8; - if (SoftwareSet != 0x82) - return false; -#endif - Wb35Rx_start(hw); Wb35Tx_EP2VM_start(priv); @@ -734,9 +707,6 @@ static int wb35_hw_init(struct ieee80211_hw *hw) } priv->sLocalPara.bAntennaNo = hal_get_antenna_number(pHwData); -#ifdef _PE_STATE_DUMP_ - printk("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo); -#endif hal_get_hw_radio_off(pHwData); /* Waiting for HAL setting OK */ @@ -769,21 +739,18 @@ static int wb35_probe(struct usb_interface *intf, struct usb_host_interface *interface; struct ieee80211_hw *dev; struct wbsoft_priv *priv; - struct wb_usb *pWbUsb; - int nr, err; + int err; u32 ltmp; usb_get_dev(udev); /* Check the device if it already be opened */ - nr = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + err = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x01, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x0, 0x400, <mp, 4, HZ * 100); - if (nr < 0) { - err = nr; + if (err < 0) goto error; - } /* Is already initialized? */ ltmp = cpu_to_le32(ltmp); @@ -800,17 +767,11 @@ static int wb35_probe(struct usb_interface *intf, priv = dev->priv; - pWbUsb = &priv->sHwData.WbUsb; - pWbUsb->udev = udev; + priv->sHwData.udev = udev; interface = intf->cur_altsetting; endpoint = &interface->endpoint[0].desc; - if (endpoint[2].wMaxPacketSize == 512) { - printk("[w35und] Working on USB 2.0\n"); - pWbUsb->IsUsb20 = 1; - } - err = wb35_hw_init(dev); if (err) goto error_free_hw; @@ -827,7 +788,6 @@ static int wb35_probe(struct usb_interface *intf, dev->flags = IEEE80211_HW_SIGNAL_UNSPEC; dev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); - dev->channel_change_time = 1000; dev->max_signal = 100; dev->queues = 1; @@ -860,13 +820,8 @@ static void hal_halt(struct hw_data *pHwData) static void wb35_hw_halt(struct wbsoft_priv *adapter) { - Mds_Destroy(adapter); - /* Turn off Rx and Tx hardware ability */ hal_stop(&adapter->sHwData); -#ifdef _PE_USB_INI_DUMP_ - printk("[w35und] Hal_stop O.K.\n"); -#endif /* Waiting Irp completed */ msleep(100); @@ -895,15 +850,4 @@ static struct usb_driver wb35_driver = { .disconnect = wb35_disconnect, }; -static int __init wb35_init(void) -{ - return usb_register(&wb35_driver); -} - -static void __exit wb35_exit(void) -{ - usb_deregister(&wb35_driver); -} - -module_init(wb35_init); -module_exit(wb35_exit); +module_usb_driver(wb35_driver); diff --git a/drivers/staging/winbond/wbusb_s.h b/drivers/staging/winbond/wbusb_s.h deleted file mode 100644 index 8961ae594c4..00000000000 --- a/drivers/staging/winbond/wbusb_s.h +++ /dev/null @@ -1,18 +0,0 @@ -/* ========================================================= - * Copyright (c) 1996-2004 Winbond Electronic Corporation - * - * Module Name: - * wbusb_s.h - * ========================================================= - */ -#ifndef __WINBOND_WBUSB_S_H -#define __WINBOND_WBUSB_S_H - -#include <linux/types.h> - -struct wb_usb { - u32 IsUsb20; - struct usb_device *udev; - u32 DetectCount; -}; -#endif |
