diff options
Diffstat (limited to 'drivers/staging/winbond')
25 files changed, 178 insertions, 967 deletions
diff --git a/drivers/staging/winbond/Makefile b/drivers/staging/winbond/Makefile index 79fa227..081d48d 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 2b87a00..d7b3aca 100644 --- a/drivers/staging/winbond/core.h +++ b/drivers/staging/winbond/core.h @@ -4,7 +4,7 @@ #include <linux/wireless.h> #include <linux/types.h> -#include "wbhal_s.h" +#include "wbhal.h" #include "mto.h" #include "mac_structures.h" diff --git a/drivers/staging/winbond/mac_structures.h b/drivers/staging/winbond/mac_structures.h index ed3df29..76c63c7 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 9217762..9cfea94 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,11 +15,6 @@ 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) { struct T00_descriptor *pT00; @@ -350,9 +343,7 @@ 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; @@ -404,6 +395,44 @@ static void Mds_HeaderCopy(struct wbsoft_priv *adapter, struct wb35_descriptor * } +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.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??? */ + } +} + +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.IsInUsed = PACKET_FREE_TO_USE; +} + void Mds_Tx(struct wbsoft_priv *adapter) { @@ -430,9 +459,7 @@ Mds_Tx(struct wbsoft_priv *adapter) 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 + pr_debug("[Mds_Tx] Tx Owner is H/W.\n"); break; } @@ -476,9 +503,7 @@ Mds_Tx(struct wbsoft_priv *adapter) /* 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,11 +517,6 @@ 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 */ MLME_SendComplete(adapter, 0, true); @@ -567,9 +587,7 @@ 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 7f68dea..ce8be07 100644 --- a/drivers/staging/winbond/mds_f.h +++ b/drivers/staging/winbond/mds_f.h @@ -1,11 +1,10 @@ #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); diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h index e2de4bd..eeedf01 100644 --- a/drivers/staging/winbond/mds_s.h +++ b/drivers/staging/winbond/mds_s.h @@ -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 7425a23..0000000 --- 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 012507f..0000000 --- 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 9cd2127..c03e501 100644 --- a/drivers/staging/winbond/mto.c +++ b/drivers/staging/winbond/mto.c @@ -17,9 +17,10 @@ * ============================================================================ */ -#include "sysdef.h" #include "sme_api.h" -#include "wbhal_f.h" +#include "wbhal.h" +#include "wb35reg_f.h" +#include "core.h" /* Declare SQ3 to rate and fragmentation threshold table */ /* Declare fragmentation thresholds table */ diff --git a/drivers/staging/winbond/phy_calibration.c b/drivers/staging/winbond/phy_calibration.c index 2b375ba..09844db 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 ************************/ diff --git a/drivers/staging/winbond/phy_calibration.h b/drivers/staging/winbond/phy_calibration.h index 3032031..84f6e84 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 diff --git a/drivers/staging/winbond/reg.c b/drivers/staging/winbond/reg.c index 990f9d4..1b38d6d 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" /* * ==================================================== @@ -1010,9 +1011,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; @@ -1098,9 +1097,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 +1112,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 +1122,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); @@ -1795,9 +1788,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 +2064,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; @@ -2336,13 +2323,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/sysdef.h b/drivers/staging/winbond/sysdef.h deleted file mode 100644 index d0d71f6..0000000 --- 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 7707223..42ae6101 100644 --- a/drivers/staging/winbond/wb35reg.c +++ b/drivers/staging/winbond/wb35reg.c @@ -1,4 +1,3 @@ -#include "sysdef.h" #include "wb35reg_f.h" #include <linux/usb.h> @@ -140,8 +139,8 @@ 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), + 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; @@ -150,9 +149,7 @@ unsigned char Wb35Reg_WriteSync(struct hw_data *pHwData, u16 RegisterNo, u32 Reg 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; } @@ -305,8 +302,8 @@ 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), + 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); @@ -320,9 +317,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; } @@ -432,8 +427,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 +437,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 +472,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 +517,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); diff --git a/drivers/staging/winbond/wb35reg_f.h b/drivers/staging/winbond/wb35reg_f.h index bf23c10..95dc980 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 4eff009..eb274ff 100644 --- a/drivers/staging/winbond/wb35reg_s.h +++ b/drivers/staging/winbond/wb35reg_s.h @@ -5,6 +5,8 @@ #include <linux/types.h> #include <asm/atomic.h> +struct hw_data; + /* ========================================================================= * * HAL setting function @@ -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 448514a..f118eeb 100644 --- a/drivers/staging/winbond/wb35rx.c +++ b/drivers/staging/winbond/wb35rx.c @@ -14,7 +14,6 @@ #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) @@ -109,10 +108,7 @@ 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; @@ -174,7 +170,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 +182,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 +233,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 +243,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; } @@ -268,8 +260,8 @@ static void Wb35Rx(struct ieee80211_hw *hw) } 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); @@ -337,9 +329,7 @@ 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 + pr_debug("EP3 Rx stop\n"); } } @@ -355,8 +345,6 @@ void Wb35Rx_destroy(struct hw_data *pHwData) if (pWb35Rx->RxUrb) usb_free_urb(pWb35Rx->RxUrb); -#ifdef _PE_RX_DUMP_ - printk("Wb35Rx_destroy OK\n"); -#endif + pr_debug("Wb35Rx_destroy OK\n"); } diff --git a/drivers/staging/winbond/wb35rx_f.h b/drivers/staging/winbond/wb35rx_f.h index 98acce5..1fdf65e 100644 --- a/drivers/staging/winbond/wb35rx_f.h +++ b/drivers/staging/winbond/wb35rx_f.h @@ -2,7 +2,7 @@ #define __WINBOND_WB35RX_F_H #include <net/mac80211.h> -#include "wbhal_s.h" +#include "wbhal.h" //==================================== // Interface function declare diff --git a/drivers/staging/winbond/wb35tx.c b/drivers/staging/winbond/wb35tx.c index 2a9d055..44fc3fe 100644 --- a/drivers/staging/winbond/wb35tx.c +++ b/drivers/staging/winbond/wb35tx.c @@ -13,7 +13,6 @@ #include "wb35tx_f.h" #include "mds_f.h" -#include "sysdef.h" unsigned char Wb35Tx_get_tx_buffer(struct hw_data * pHwData, u8 **pBuffer) @@ -41,7 +40,7 @@ static void Wb35Tx_complete(struct urb * pUrb) 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 to handle surprise remove goto error; if (pWb35Tx->tx_halt) @@ -74,7 +73,7 @@ static void Wb35Tx(struct wbsoft_priv *adapter) u32 SendIndex; - if (pHwData->SurpriseRemove || pHwData->HwStop) + if (pHwData->SurpriseRemove) goto cleanup; if (pWb35Tx->tx_halt) @@ -89,8 +88,8 @@ static void Wb35Tx(struct wbsoft_priv *adapter) // // Issuing URB // - usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev, - usb_sndbulkpipe(pHwData->WbUsb.udev, 4), + usb_fill_bulk_urb(pUrb, pHwData->udev, + usb_sndbulkpipe(pHwData->udev, 4), pTxBufferAddress, pMds->TxBufferSize[ SendIndex ], Wb35Tx_complete, adapter); @@ -153,16 +152,12 @@ void Wb35Tx_stop(struct hw_data * pHwData) // Trying to canceling 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 + pr_debug("EP2 Tx stop\n"); // Trying to canceling 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 + pr_debug("EP4 Tx stop\n"); } //====================================================== @@ -182,9 +177,7 @@ void Wb35Tx_destroy(struct hw_data * pHwData) 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) @@ -222,7 +215,7 @@ static void Wb35Tx_EP2VM_complete(struct urb * pUrb) pWb35Tx->EP2VM_status = pUrb->status; // For Linux 2.4. Interrupt will always trigger - if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove + if (pHwData->SurpriseRemove) // Let WbWlanHalt to handle surprise remove goto error; if (pWb35Tx->tx_halt) @@ -263,7 +256,7 @@ static void Wb35Tx_EP2VM(struct wbsoft_priv *adapter) u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; int retv; - if (pHwData->SurpriseRemove || pHwData->HwStop) + if (pHwData->SurpriseRemove) goto error; if (pWb35Tx->tx_halt) @@ -272,16 +265,14 @@ static void Wb35Tx_EP2VM(struct wbsoft_priv *adapter) // // Issuing URB // - usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2), + 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; } diff --git a/drivers/staging/winbond/wb35tx_f.h b/drivers/staging/winbond/wb35tx_f.h index 1d3b515..018fd35 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/wbhal_s.h b/drivers/staging/winbond/wbhal.h index 821a1b3..39e84a0 100644 --- a/drivers/staging/winbond/wbhal_s.h +++ b/drivers/staging/winbond/wbhal.h @@ -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 fc78c14..0000000 --- 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 0a9d214..0000000 --- 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 3f60cf7..2163d60 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c @@ -14,10 +14,11 @@ #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"); @@ -181,10 +182,7 @@ static void hal_set_current_channel_ex(struct hw_data *pHwData, struct chan_info 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 + pr_debug("Set channel is %d, band =%d\n", pHwData->Channel, pHwData->band); reg->M28_MacControl &= ~0xff; /* Clean channel information field */ reg->M28_MacControl |= channel.ChanNo; Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl, @@ -339,10 +337,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 +604,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 +638,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 +714,7 @@ 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 + pr_debug("Driver init, antenna no = %d\n", priv->sLocalPara.bAntennaNo); hal_get_hw_radio_off(pHwData); /* Waiting for HAL setting OK */ @@ -769,7 +747,6 @@ 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; u32 ltmp; @@ -800,16 +777,13 @@ 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) { + if (endpoint[2].wMaxPacketSize == 512) printk("[w35und] Working on USB 2.0\n"); - pWbUsb->IsUsb20 = 1; - } err = wb35_hw_init(dev); if (err) @@ -860,13 +834,9 @@ 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 + pr_debug("[w35und] Hal_stop O.K.\n"); /* Waiting Irp completed */ msleep(100); diff --git a/drivers/staging/winbond/wbusb_s.h b/drivers/staging/winbond/wbusb_s.h deleted file mode 100644 index 8961ae5..0000000 --- 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 |