diff options
Diffstat (limited to 'drivers/staging/winbond')
27 files changed, 502 insertions, 544 deletions
diff --git a/drivers/staging/winbond/Kconfig b/drivers/staging/winbond/Kconfig index 10d72bec88a..425219ed7ab 100644 --- a/drivers/staging/winbond/Kconfig +++ b/drivers/staging/winbond/Kconfig @@ -1,6 +1,6 @@ config W35UND tristate "Winbond driver" - depends on MAC80211 && WLAN_80211 && EXPERIMENTAL && !4KSTACKS + depends on MAC80211 && WLAN_80211 && USB && EXPERIMENTAL && !4KSTACKS default n ---help--- This is highly experimental driver for winbond wifi card on some Kohjinsha notebooks diff --git a/drivers/staging/winbond/README b/drivers/staging/winbond/README index 707b6b354dc..cb944e4bf17 100644 --- a/drivers/staging/winbond/README +++ b/drivers/staging/winbond/README @@ -5,6 +5,7 @@ TODO: - remove typedefs - remove unused ioctls - use cfg80211 for regulatory stuff + - fix 4k stack problems Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Pavel Machek <pavel@suse.cz> diff --git a/drivers/staging/winbond/bss_f.h b/drivers/staging/winbond/bss_f.h index c957bc94f08..01318315399 100644 --- a/drivers/staging/winbond/bss_f.h +++ b/drivers/staging/winbond/bss_f.h @@ -24,7 +24,7 @@ void DesiredRate2InfoElement(PWB32_ADAPTER Adapter, u8 *addr, u16 *iFildOffset, u8 *pBasicRateSet, u8 BasicRateCount, u8 *pOperationRateSet, u8 OperationRateCount); void BSSAddIBSSdata(PWB32_ADAPTER Adapter, PWB_BSSDESCRIPTION psDesData); -unsigned char boCmpMacAddr( PUCHAR, PUCHAR ); +unsigned char boCmpMacAddr( u8 *, u8 *); unsigned char boCmpSSID(struct SSID_Element *psSSID1, struct SSID_Element *psSSID2); u16 wBSSfindSSID(PWB32_ADAPTER Adapter, struct SSID_Element *psSsid); u16 wRoamingQuery(PWB32_ADAPTER Adapter); @@ -42,11 +42,11 @@ void RateReSortForSRate(PWB32_ADAPTER Adapter, u8 *RateArray, u8 num); void Assemble_IE(PWB32_ADAPTER Adapter, u16 wBssIdx); void SetMaxTxRate(PWB32_ADAPTER Adapter); -void CreateWpaIE(PWB32_ADAPTER Adapter, u16* iFildOffset, PUCHAR msg, struct Management_Frame* msgHeader, +void CreateWpaIE(PWB32_ADAPTER Adapter, u16* iFildOffset, u8 *msg, struct Management_Frame* msgHeader, struct Association_Request_Frame_Body* msgBody, u16 iMSindex); //added by WS 05/14/05 #ifdef _WPA2_ -void CreateRsnIE(PWB32_ADAPTER Adapter, u16* iFildOffset, PUCHAR msg, struct Management_Frame* msgHeader, +void CreateRsnIE(PWB32_ADAPTER Adapter, u16* iFildOffset, u8 *msg, struct Management_Frame* msgHeader, struct Association_Request_Frame_Body* msgBody, u16 iMSindex);//added by WS 05/14/05 u16 SearchPmkid(PWB32_ADAPTER Adapter, struct Management_Frame* msgHeader, diff --git a/drivers/staging/winbond/ds_tkip.h b/drivers/staging/winbond/ds_tkip.h index 29e5055b45a..6841d66e7e8 100644 --- a/drivers/staging/winbond/ds_tkip.h +++ b/drivers/staging/winbond/ds_tkip.h @@ -25,9 +25,9 @@ typedef struct tkip s32 bytes_in_M; // # bytes in M } tkip_t; -//void _append_data( PUCHAR pData, u16 size, tkip_t *p ); -void Mds_MicGet( void* Adapter, void* pRxLayer1, PUCHAR pKey, PUCHAR pMic ); -void Mds_MicFill( void* Adapter, void* pDes, PUCHAR XmitBufAddress ); +//void _append_data( u8 *pData, u16 size, tkip_t *p ); +void Mds_MicGet( void* Adapter, void* pRxLayer1, u8 *pKey, u8 *pMic ); +void Mds_MicFill( void* Adapter, void* pDes, u8 *XmitBufAddress ); diff --git a/drivers/staging/winbond/linux/common.h b/drivers/staging/winbond/linux/common.h index 6b00bad74f7..712a86cfa68 100644 --- a/drivers/staging/winbond/linux/common.h +++ b/drivers/staging/winbond/linux/common.h @@ -39,14 +39,6 @@ // Common type definition //=============================================================== -typedef u8* PUCHAR; -typedef s8* PCHAR; -typedef u8* PBOOLEAN; -typedef u16* PUSHORT; -typedef u32* PULONG; -typedef s16* PSHORT; - - //=========================================== #define IGNORE 2 #define SUCCESS 1 @@ -110,16 +102,9 @@ typedef struct urb * PURB; #define OS_ATOMIC_READ( _A, _V ) _V #define OS_ATOMIC_INC( _A, _V ) EncapAtomicInc( _A, (void*)_V ) #define OS_ATOMIC_DEC( _A, _V ) EncapAtomicDec( _A, (void*)_V ) -#define OS_MEMORY_CLEAR( _A, _S ) memset( (PUCHAR)_A,0,_S) +#define OS_MEMORY_CLEAR( _A, _S ) memset( (u8 *)_A,0,_S) #define OS_MEMORY_COMPARE( _A, _B, _S ) (memcmp(_A,_B,_S)? 0 : 1) // Definition is reverse with Ndis 1: the same 0: different - -#define OS_SPIN_LOCK spinlock_t -#define OS_SPIN_LOCK_ALLOCATE( _S ) spin_lock_init( _S ); -#define OS_SPIN_LOCK_FREE( _S ) -#define OS_SPIN_LOCK_ACQUIRED( _S ) spin_lock_irq( _S ) -#define OS_SPIN_LOCK_RELEASED( _S ) spin_unlock_irq( _S ); - #define OS_TIMER struct timer_list #define OS_TIMER_INITIAL( _T, _F, _P ) \ { \ diff --git a/drivers/staging/winbond/linux/wb35reg.c b/drivers/staging/winbond/linux/wb35reg.c index 2c0b454e8ca..ebb6db5438a 100644 --- a/drivers/staging/winbond/linux/wb35reg.c +++ b/drivers/staging/winbond/linux/wb35reg.c @@ -10,7 +10,7 @@ extern void phy_calibration_winbond(hw_data_t *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(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 NumberOfData, u8 Flag) +Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 NumberOfData, u8 Flag) { PWB35REG pWb35Reg = &pHwData->Wb35Reg; PURB pUrb = NULL; @@ -30,13 +30,13 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 if( pUrb && pRegQueue ) { pRegQueue->DIRECT = 2;// burst write register pRegQueue->INDEX = RegisterNo; - pRegQueue->pBuffer = (PULONG)((PUCHAR)pRegQueue + sizeof(REG_QUEUE)); + pRegQueue->pBuffer = (u32 *)((u8 *)pRegQueue + sizeof(REG_QUEUE)); memcpy( pRegQueue->pBuffer, pRegisterData, DataSize ); //the function for reversing register data from little endian to big endian for( i=0; i<NumberOfData ; i++ ) pRegQueue->pBuffer[i] = cpu_to_le32( pRegQueue->pBuffer[i] ); - dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE) + DataSize); + dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(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 @@ -46,14 +46,14 @@ Wb35Reg_BurstWrite(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 pRegQueue->pUsbReq = dr; pRegQueue->pUrb = pUrb; - OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq( &pWb35Reg->EP0VM_spin_lock ); if (pWb35Reg->pRegFirst == NULL) pWb35Reg->pRegFirst = pRegQueue; else pWb35Reg->pRegLast->Next = pRegQueue; pWb35Reg->pRegLast = pRegQueue; - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); // Start EP0VM Wb35Reg_EP0VM_start(pHwData); @@ -181,7 +181,7 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue ) pRegQueue->INDEX = RegisterNo; pRegQueue->VALUE = cpu_to_le32(RegisterValue); pRegQueue->RESERVED_VALID = FALSE; - dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE)); + dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(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); @@ -193,14 +193,14 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue ) pRegQueue->pUsbReq = dr; pRegQueue->pUrb = pUrb; - OS_SPIN_LOCK_ACQUIRED(&pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq(&pWb35Reg->EP0VM_spin_lock ); if (pWb35Reg->pRegFirst == NULL) pWb35Reg->pRegFirst = pRegQueue; else pWb35Reg->pRegLast->Next = pRegQueue; pWb35Reg->pRegLast = pRegQueue; - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); // Start EP0VM Wb35Reg_EP0VM_start(pHwData); @@ -220,7 +220,7 @@ Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue ) // FALSE : register not support unsigned char Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue, - PCHAR pValue, s8 Len) + s8 *pValue, s8 Len) { PWB35REG pWb35Reg = &pHwData->Wb35Reg; struct usb_ctrlrequest *dr; @@ -243,7 +243,7 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register //NOTE : Users must guarantee the size of value will not exceed the buffer size. memcpy(pRegQueue->RESERVED, pValue, Len); pRegQueue->RESERVED_VALID = TRUE; - dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE)); + dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(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); @@ -254,14 +254,14 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register pRegQueue->Next = NULL; pRegQueue->pUsbReq = dr; pRegQueue->pUrb = pUrb; - OS_SPIN_LOCK_ACQUIRED (&pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq (&pWb35Reg->EP0VM_spin_lock ); if( pWb35Reg->pRegFirst == NULL ) pWb35Reg->pRegFirst = pRegQueue; else pWb35Reg->pRegLast->Next = pRegQueue; pWb35Reg->pRegLast = pRegQueue; - OS_SPIN_LOCK_RELEASED ( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq ( &pWb35Reg->EP0VM_spin_lock ); // Start EP0VM Wb35Reg_EP0VM_start(pHwData); @@ -278,10 +278,10 @@ Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 Register // FALSE : register not support // pRegisterValue : It must be a resident buffer due to asynchronous read register. unsigned char -Wb35Reg_ReadSync( phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue ) +Wb35Reg_ReadSync( phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue ) { PWB35REG pWb35Reg = &pHwData->Wb35Reg; - PULONG pltmp = pRegisterValue; + u32 * pltmp = pRegisterValue; int ret = -1; // Module shutdown @@ -327,7 +327,7 @@ Wb35Reg_ReadSync( phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue // FALSE : register not support // pRegisterValue : It must be a resident buffer due to asynchronous read register. unsigned char -Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue ) +Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue ) { PWB35REG pWb35Reg = &pHwData->Wb35Reg; struct usb_ctrlrequest * dr; @@ -348,7 +348,7 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue ) pRegQueue->DIRECT = 0;// read register pRegQueue->INDEX = RegisterNo; pRegQueue->pBuffer = pRegisterValue; - dr = (struct usb_ctrlrequest *)((PUCHAR)pRegQueue + sizeof(REG_QUEUE)); + dr = (struct usb_ctrlrequest *)((u8 *)pRegQueue + sizeof(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); @@ -359,14 +359,14 @@ Wb35Reg_Read(phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue ) pRegQueue->Next = NULL; pRegQueue->pUsbReq = dr; pRegQueue->pUrb = pUrb; - OS_SPIN_LOCK_ACQUIRED ( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq ( &pWb35Reg->EP0VM_spin_lock ); if( pWb35Reg->pRegFirst == NULL ) pWb35Reg->pRegFirst = pRegQueue; else pWb35Reg->pRegLast->Next = pRegQueue; pWb35Reg->pRegLast = pRegQueue; - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); // Start EP0VM Wb35Reg_EP0VM_start( pHwData ); @@ -399,7 +399,7 @@ Wb35Reg_EP0VM(phw_data_t pHwData ) PWB35REG pWb35Reg = &pHwData->Wb35Reg; PURB pUrb; struct usb_ctrlrequest *dr; - PULONG pBuffer; + u32 * pBuffer; int ret = -1; PREG_QUEUE pRegQueue; @@ -411,9 +411,9 @@ Wb35Reg_EP0VM(phw_data_t pHwData ) goto cleanup; // Get the register data and send to USB through Irp - OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq( &pWb35Reg->EP0VM_spin_lock ); pRegQueue = pWb35Reg->pRegFirst; - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); if (!pRegQueue) goto cleanup; @@ -429,7 +429,7 @@ Wb35Reg_EP0VM(phw_data_t pHwData ) usb_fill_control_urb( pUrb, pHwData->WbUsb.udev, REG_DIRECTION(pHwData->WbUsb.udev,pRegQueue), - (PUCHAR)dr,pBuffer,cpu_to_le16(dr->wLength), + (u8 *)dr,pBuffer,cpu_to_le16(dr->wLength), Wb35Reg_EP0VM_complete, (void*)pHwData); pWb35Reg->EP0vm_state = VM_RUNNING; @@ -468,12 +468,12 @@ Wb35Reg_EP0VM_complete(PURB pUrb) OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Reg->RegFireCount ); } else { // Complete to send, remove the URB from the first - OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq( &pWb35Reg->EP0VM_spin_lock ); pRegQueue = pWb35Reg->pRegFirst; if (pRegQueue == pWb35Reg->pRegLast) pWb35Reg->pRegLast = NULL; pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next; - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); if (pWb35Reg->EP0VM_status) { #ifdef _PE_REG_DUMP_ @@ -513,7 +513,7 @@ Wb35Reg_destroy(phw_data_t pHwData) OS_SLEEP(10000); // Delay for waiting function enter 940623.1.b // Release all the data in RegQueue - OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq( &pWb35Reg->EP0VM_spin_lock ); pRegQueue = pWb35Reg->pRegFirst; while (pRegQueue) { if (pRegQueue == pWb35Reg->pRegLast) @@ -521,7 +521,7 @@ Wb35Reg_destroy(phw_data_t pHwData) pWb35Reg->pRegFirst = pWb35Reg->pRegFirst->Next; pUrb = pRegQueue->pUrb; - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); if (pUrb) { usb_free_urb(pUrb); kfree(pRegQueue); @@ -530,14 +530,11 @@ Wb35Reg_destroy(phw_data_t pHwData) WBDEBUG(("EP0 queue release error\n")); #endif } - OS_SPIN_LOCK_ACQUIRED( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_irq( &pWb35Reg->EP0VM_spin_lock ); pRegQueue = pWb35Reg->pRegFirst; } - OS_SPIN_LOCK_RELEASED( &pWb35Reg->EP0VM_spin_lock ); - - // Free resource - OS_SPIN_LOCK_FREE( &pWb35Reg->EP0VM_spin_lock ); + spin_unlock_irq( &pWb35Reg->EP0VM_spin_lock ); } //==================================================================================== @@ -550,7 +547,7 @@ unsigned char Wb35Reg_initial(phw_data_t pHwData) u32 SoftwareSet, VCO_trim, TxVga, Region_ScanInterval; // Spin lock is acquired for read and write IRP command - OS_SPIN_LOCK_ALLOCATE( &pWb35Reg->EP0VM_spin_lock ); + spin_lock_init( &pWb35Reg->EP0VM_spin_lock ); // Getting RF module type from EEPROM ------------------------------------ Wb35Reg_WriteSync( pHwData, 0x03b4, 0x080d0000 ); // Start EEPROM access + Read + address(0x0d) @@ -655,7 +652,7 @@ unsigned char Wb35Reg_initial(phw_data_t pHwData) // version in _GENREQ.ASM of the DWB NE1000/2000 driver. //================================================================================== u32 -CardComputeCrc(PUCHAR Buffer, u32 Length) +CardComputeCrc(u8 * Buffer, u32 Length) { u32 Crc, Carry; u32 i, j; diff --git a/drivers/staging/winbond/linux/wb35reg_f.h b/drivers/staging/winbond/linux/wb35reg_f.h index 38e2906b51a..3006cfe99cc 100644 --- a/drivers/staging/winbond/linux/wb35reg_f.h +++ b/drivers/staging/winbond/linux/wb35reg_f.h @@ -29,16 +29,16 @@ void EEPROMTxVgaAdjust( phw_data_t pHwData ); // 20060619.5 Add void Wb35Reg_destroy( phw_data_t pHwData ); -unsigned char Wb35Reg_Read( phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue ); -unsigned char Wb35Reg_ReadSync( phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterValue ); +unsigned char Wb35Reg_Read( phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue ); +unsigned char Wb35Reg_ReadSync( phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterValue ); unsigned char Wb35Reg_Write( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue ); unsigned char Wb35Reg_WriteSync( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue ); unsigned char Wb35Reg_WriteWithCallbackValue( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue, - PCHAR pValue, - s8 Len); -unsigned char Wb35Reg_BurstWrite( phw_data_t pHwData, u16 RegisterNo, PULONG pRegisterData, u8 NumberOfData, u8 Flag ); + s8 *pValue, + s8 Len); +unsigned char Wb35Reg_BurstWrite( phw_data_t pHwData, u16 RegisterNo, u32 * pRegisterData, u8 NumberOfData, u8 Flag ); void Wb35Reg_EP0VM( phw_data_t pHwData ); void Wb35Reg_EP0VM_start( phw_data_t pHwData ); @@ -47,7 +47,7 @@ void Wb35Reg_EP0VM_complete( PURB pUrb ); u32 BitReverse( u32 dwData, u32 DataLength); void CardGetMulticastBit( u8 Address[MAC_ADDR_LENGTH], u8 *Byte, u8 *Value ); -u32 CardComputeCrc( PUCHAR Buffer, u32 Length ); +u32 CardComputeCrc( u8 * Buffer, u32 Length ); void Wb35Reg_phy_calibration( phw_data_t pHwData ); void Wb35Reg_Update( phw_data_t pHwData, u16 RegisterNo, u32 RegisterValue ); diff --git a/drivers/staging/winbond/linux/wb35reg_s.h b/drivers/staging/winbond/linux/wb35reg_s.h index a7595b1e733..8b35b93f7f0 100644 --- a/drivers/staging/winbond/linux/wb35reg_s.h +++ b/drivers/staging/winbond/linux/wb35reg_s.h @@ -75,7 +75,7 @@ typedef struct _REG_QUEUE union { u32 VALUE; - PULONG pBuffer; + u32 * pBuffer; }; u8 RESERVED[4];// space reserved for communication @@ -143,7 +143,7 @@ typedef struct _WB35REG //------------------- // VM //------------------- - OS_SPIN_LOCK EP0VM_spin_lock; // 4B + spinlock_t EP0VM_spin_lock; // 4B u32 EP0VM_status;//$$ PREG_QUEUE pRegFirst; PREG_QUEUE pRegLast; diff --git a/drivers/staging/winbond/linux/wb35rx.c b/drivers/staging/winbond/linux/wb35rx.c index 26157eb3d5a..b4b9f5f371d 100644 --- a/drivers/staging/winbond/linux/wb35rx.c +++ b/drivers/staging/winbond/linux/wb35rx.c @@ -27,7 +27,7 @@ void Wb35Rx_start(phw_data_t pHwData) void Wb35Rx( phw_data_t pHwData ) { PWB35RX pWb35Rx = &pHwData->Wb35Rx; - PUCHAR pRxBufferAddress; + u8 * pRxBufferAddress; PURB pUrb = (PURB)pWb35Rx->RxUrb; int retv; u32 RxBufferId; @@ -35,51 +35,50 @@ void Wb35Rx( phw_data_t pHwData ) // // Issuing URB // - do { - if (pHwData->SurpriseRemove || pHwData->HwStop) - break; + if (pHwData->SurpriseRemove || pHwData->HwStop) + goto error; - if (pWb35Rx->rx_halt) - break; + if (pWb35Rx->rx_halt) + goto error; - // Get RxBuffer's ID - RxBufferId = pWb35Rx->RxBufferId; - if (!pWb35Rx->RxOwner[RxBufferId]) { - // It's impossible to run here. - #ifdef _PE_RX_DUMP_ - WBDEBUG(("Rx driver fifo unavailable\n")); - #endif - break; - } + // Get RxBuffer's ID + RxBufferId = pWb35Rx->RxBufferId; + if (!pWb35Rx->RxOwner[RxBufferId]) { + // It's impossible to run here. + #ifdef _PE_RX_DUMP_ + WBDEBUG(("Rx driver fifo unavailable\n")); + #endif + goto error; + } - // Update buffer point, then start to bulkin the data from USB - pWb35Rx->RxBufferId++; - pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER; + // Update buffer point, then start to bulkin the data from USB + pWb35Rx->RxBufferId++; + pWb35Rx->RxBufferId %= MAX_USB_RX_BUFFER_NUMBER; - pWb35Rx->CurrentRxBufferId = RxBufferId; + pWb35Rx->CurrentRxBufferId = RxBufferId; - if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) { - printk("w35und: Rx memory alloc failed\n"); - break; - } - pRxBufferAddress = pWb35Rx->pDRx; + if (1 != OS_MEMORY_ALLOC((void* *)&pWb35Rx->pDRx, MAX_USB_RX_BUFFER)) { + printk("w35und: Rx memory alloc failed\n"); + goto error; + } + pRxBufferAddress = pWb35Rx->pDRx; - usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev, - usb_rcvbulkpipe(pHwData->WbUsb.udev, 3), - pRxBufferAddress, MAX_USB_RX_BUFFER, - Wb35Rx_Complete, pHwData); + usb_fill_bulk_urb(pUrb, pHwData->WbUsb.udev, + usb_rcvbulkpipe(pHwData->WbUsb.udev, 3), + pRxBufferAddress, MAX_USB_RX_BUFFER, + Wb35Rx_Complete, pHwData); - pWb35Rx->EP3vm_state = VM_RUNNING; + pWb35Rx->EP3vm_state = VM_RUNNING; - retv = wb_usb_submit_urb(pUrb); + retv = wb_usb_submit_urb(pUrb); - if (retv != 0) { - printk("Rx URB sending error\n"); - break; - } - return; - } while(FALSE); + if (retv != 0) { + printk("Rx URB sending error\n"); + goto error; + } + return; +error: // VM stop pWb35Rx->EP3vm_state = VM_STOP; OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter ); @@ -89,7 +88,7 @@ void Wb35Rx_Complete(PURB pUrb) { phw_data_t pHwData = pUrb->context; PWB35RX pWb35Rx = &pHwData->Wb35Rx; - PUCHAR pRxBufferAddress; + u8 * pRxBufferAddress; u32 SizeCheck; u16 BulkLength; u32 RxBufferId; @@ -99,65 +98,63 @@ void Wb35Rx_Complete(PURB pUrb) pWb35Rx->EP3vm_state = VM_COMPLETED; pWb35Rx->EP3VM_status = pUrb->status;//Store the last result of Irp - do { - RxBufferId = pWb35Rx->CurrentRxBufferId; + RxBufferId = pWb35Rx->CurrentRxBufferId; - pRxBufferAddress = pWb35Rx->pDRx; - BulkLength = (u16)pUrb->actual_length; + pRxBufferAddress = pWb35Rx->pDRx; + BulkLength = (u16)pUrb->actual_length; - // The IRP is completed - pWb35Rx->EP3vm_state = VM_COMPLETED; + // The IRP is completed + pWb35Rx->EP3vm_state = VM_COMPLETED; - if (pHwData->SurpriseRemove || pHwData->HwStop) // Must be here, or RxBufferId is invalid - break; + if (pHwData->SurpriseRemove || pHwData->HwStop) // Must be here, or RxBufferId is invalid + goto error; - if (pWb35Rx->rx_halt) - break; + if (pWb35Rx->rx_halt) + goto error; - // Start to process the data only in successful condition - pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver - R00.value = le32_to_cpu(*(PULONG)pRxBufferAddress); + // Start to process the data only in successful condition + pWb35Rx->RxOwner[ RxBufferId ] = 0; // Set the owner to driver + R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress); - // The URB is completed, check the result - if (pWb35Rx->EP3VM_status != 0) { - #ifdef _PE_USB_STATE_DUMP_ - WBDEBUG(("EP3 IoCompleteRoutine return error\n")); - DebugUsbdStatusInformation( pWb35Rx->EP3VM_status ); - #endif - pWb35Rx->EP3vm_state = VM_STOP; - break; - } + // The URB is completed, check the result + if (pWb35Rx->EP3VM_status != 0) { + #ifdef _PE_USB_STATE_DUMP_ + WBDEBUG(("EP3 IoCompleteRoutine return error\n")); + DebugUsbdStatusInformation( pWb35Rx->EP3VM_status ); + #endif + pWb35Rx->EP3vm_state = VM_STOP; + goto error; + } - // 20060220 For recovering. check if operating in single USB mode - if (!HAL_USB_MODE_BURST(pHwData)) { - SizeCheck = R00.R00_receive_byte_count; //20060926 anson's endian - if ((SizeCheck & 0x03) > 0) - SizeCheck -= 4; - SizeCheck = (SizeCheck + 3) & ~0x03; - SizeCheck += 12; // 8 + 4 badbeef - if ((BulkLength > 1600) || - (SizeCheck > 1600) || - (BulkLength != SizeCheck) || - (BulkLength == 0)) { // Add for fail Urb - pWb35Rx->EP3vm_state = VM_STOP; - pWb35Rx->Ep3ErrorCount2++; - } + // 20060220 For recovering. check if operating in single USB mode + if (!HAL_USB_MODE_BURST(pHwData)) { + SizeCheck = R00.R00_receive_byte_count; //20060926 anson's endian + if ((SizeCheck & 0x03) > 0) + SizeCheck -= 4; + SizeCheck = (SizeCheck + 3) & ~0x03; + SizeCheck += 12; // 8 + 4 badbeef + if ((BulkLength > 1600) || + (SizeCheck > 1600) || + (BulkLength != SizeCheck) || + (BulkLength == 0)) { // Add for fail Urb + pWb35Rx->EP3vm_state = VM_STOP; + pWb35Rx->Ep3ErrorCount2++; } + } - // Indicating the receiving data - pWb35Rx->ByteReceived += BulkLength; - pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength; - - if (!pWb35Rx->RxOwner[ RxBufferId ]) - Wb35Rx_indicate(pHwData); + // Indicating the receiving data + pWb35Rx->ByteReceived += BulkLength; + pWb35Rx->RxBufferSize[ RxBufferId ] = BulkLength; - kfree(pWb35Rx->pDRx); - // Do the next receive - Wb35Rx(pHwData); - return; + if (!pWb35Rx->RxOwner[ RxBufferId ]) + Wb35Rx_indicate(pHwData); - } while(FALSE); + kfree(pWb35Rx->pDRx); + // Do the next receive + Wb35Rx(pHwData); + return; +error: pWb35Rx->RxOwner[ RxBufferId ] = 1; // Set the owner to hardware OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Rx->RxFireCounter ); pWb35Rx->EP3vm_state = VM_STOP; @@ -223,7 +220,7 @@ void Wb35Rx_reset_descriptor( phw_data_t pHwData ) void Wb35Rx_adjust(PDESCRIPTOR pRxDes) { - PULONG pRxBufferAddress; + u32 * pRxBufferAddress; u32 DecryptionMethod; u32 i; u16 BufferSize; @@ -264,7 +261,7 @@ u16 Wb35Rx_indicate(phw_data_t pHwData) { DESCRIPTOR RxDes; PWB35RX pWb35Rx = &pHwData->Wb35Rx; - PUCHAR pRxBufferAddress; + u8 * pRxBufferAddress; u16 PacketSize; u16 stmp, BufferSize, stmp2 = 0; u32 RxBufferId; @@ -283,13 +280,13 @@ u16 Wb35Rx_indicate(phw_data_t pHwData) // Parse the bulkin buffer while (BufferSize >= 4) { - if ((cpu_to_le32(*(PULONG)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) //Is ending? 921002.9.a + if ((cpu_to_le32(*(u32 *)pRxBufferAddress) & 0x0fffffff) == RX_END_TAG) //Is ending? 921002.9.a break; // Get the R00 R01 first - RxDes.R00.value = le32_to_cpu(*(PULONG)pRxBufferAddress); + RxDes.R00.value = le32_to_cpu(*(u32 *)pRxBufferAddress); PacketSize = (u16)RxDes.R00.R00_receive_byte_count; - RxDes.R01.value = le32_to_cpu(*((PULONG)(pRxBufferAddress+4))); + RxDes.R01.value = le32_to_cpu(*((u32 *)(pRxBufferAddress+4))); // For new DMA 4k if ((PacketSize & 0x03) > 0) PacketSize -= 4; diff --git a/drivers/staging/winbond/linux/wb35rx_s.h b/drivers/staging/winbond/linux/wb35rx_s.h index 53b831fdeb7..b90c269e6ad 100644 --- a/drivers/staging/winbond/linux/wb35rx_s.h +++ b/drivers/staging/winbond/linux/wb35rx_s.h @@ -41,7 +41,7 @@ typedef struct _WB35RX u32 Ep3ErrorCount2; // 20060625.1 Usbd for Rx DMA error count int EP3VM_status; - PUCHAR pDRx; + u8 * pDRx; } WB35RX, *PWB35RX; diff --git a/drivers/staging/winbond/linux/wb35tx.c b/drivers/staging/winbond/linux/wb35tx.c index cf19c3bc524..ba9d51244e2 100644 --- a/drivers/staging/winbond/linux/wb35tx.c +++ b/drivers/staging/winbond/linux/wb35tx.c @@ -12,7 +12,7 @@ unsigned char -Wb35Tx_get_tx_buffer(phw_data_t pHwData, PUCHAR *pBuffer ) +Wb35Tx_get_tx_buffer(phw_data_t pHwData, u8 **pBuffer) { PWB35TX pWb35Tx = &pHwData->Wb35Tx; @@ -37,7 +37,7 @@ void Wb35Tx(phw_data_t pHwData) { PWB35TX pWb35Tx = &pHwData->Wb35Tx; PADAPTER Adapter = pHwData->Adapter; - PUCHAR pTxBufferAddress; + u8 *pTxBufferAddress; PMDS pMds = &Adapter->Mds; struct urb * pUrb = (struct urb *)pWb35Tx->Tx4Urb; int retv; @@ -100,25 +100,24 @@ void Wb35Tx_complete(struct urb * pUrb) pWb35Tx->TxSendIndex++; pWb35Tx->TxSendIndex %= MAX_USB_TX_BUFFER_NUMBER; - do { - if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove - break; + if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove + goto error; - if (pWb35Tx->tx_halt) - break; + if (pWb35Tx->tx_halt) + goto error; - // The URB is completed, check the result - if (pWb35Tx->EP4VM_status != 0) { - printk("URB submission failed\n"); - pWb35Tx->EP4vm_state = VM_STOP; - break; // Exit while(FALSE); - } + // The URB is completed, check the result + if (pWb35Tx->EP4VM_status != 0) { + printk("URB submission failed\n"); + pWb35Tx->EP4vm_state = VM_STOP; + goto error; + } - Mds_Tx(Adapter); - Wb35Tx(pHwData); - return; - } while(FALSE); + Mds_Tx(Adapter); + Wb35Tx(pHwData); + return; +error: OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxFireCounter ); pWb35Tx->EP4vm_state = VM_STOP; } @@ -225,36 +224,33 @@ void Wb35Tx_EP2VM(phw_data_t pHwData) { PWB35TX pWb35Tx = &pHwData->Wb35Tx; struct urb * pUrb = (struct urb *)pWb35Tx->Tx2Urb; - PULONG pltmp = (PULONG)pWb35Tx->EP2_buf; + u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; int retv; - do { - if (pHwData->SurpriseRemove || pHwData->HwStop) - break; - - if (pWb35Tx->tx_halt) - break; - - // - // Issuing URB - // - usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2), - pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, pHwData, 32); + if (pHwData->SurpriseRemove || pHwData->HwStop) + goto error; - pWb35Tx->EP2vm_state = VM_RUNNING; - retv = wb_usb_submit_urb( pUrb ); + if (pWb35Tx->tx_halt) + goto error; - if(retv < 0) { - #ifdef _PE_TX_DUMP_ - WBDEBUG(("EP2 Tx Irp sending error\n")); - #endif - break; - } + // + // Issuing URB + // + usb_fill_int_urb( pUrb, pHwData->WbUsb.udev, usb_rcvintpipe(pHwData->WbUsb.udev,2), + pltmp, MAX_INTERRUPT_LENGTH, Wb35Tx_EP2VM_complete, pHwData, 32); - return; + pWb35Tx->EP2vm_state = VM_RUNNING; + retv = wb_usb_submit_urb( pUrb ); - } while(FALSE); + if (retv < 0) { + #ifdef _PE_TX_DUMP_ + WBDEBUG(("EP2 Tx Irp sending error\n")); + #endif + goto error; + } + return; +error: pWb35Tx->EP2vm_state = VM_STOP; OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxResultCount ); } @@ -266,7 +262,7 @@ void Wb35Tx_EP2VM_complete(struct urb * pUrb) T02_DESCRIPTOR T02, TSTATUS; PADAPTER Adapter = (PADAPTER)pHwData->Adapter; PWB35TX pWb35Tx = &pHwData->Wb35Tx; - PULONG pltmp = (PULONG)pWb35Tx->EP2_buf; + u32 * pltmp = (u32 *)pWb35Tx->EP2_buf; u32 i; u16 InterruptInLength; @@ -275,38 +271,36 @@ void Wb35Tx_EP2VM_complete(struct urb * pUrb) pWb35Tx->EP2vm_state = VM_COMPLETED; pWb35Tx->EP2VM_status = pUrb->status; - do { - // For Linux 2.4. Interrupt will always trigger - if( pHwData->SurpriseRemove || pHwData->HwStop ) // Let WbWlanHalt to handle surprise remove - break; - - if( pWb35Tx->tx_halt ) - break; - - //The Urb is completed, check the result - if (pWb35Tx->EP2VM_status != 0) { - WBDEBUG(("EP2 IoCompleteRoutine return error\n")); - pWb35Tx->EP2vm_state= VM_STOP; - break; // Exit while(FALSE); - } - - // 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 - 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 ); - T02.value = cpu_to_le32(pltmp[i]) >> 8; - } - - return; - } while(FALSE); + // For Linux 2.4. Interrupt will always trigger + if (pHwData->SurpriseRemove || pHwData->HwStop) // Let WbWlanHalt to handle surprise remove + goto error; + + if (pWb35Tx->tx_halt) + goto error; + + //The Urb is completed, check the result + if (pWb35Tx->EP2VM_status != 0) { + WBDEBUG(("EP2 IoCompleteRoutine return error\n")); + pWb35Tx->EP2vm_state= VM_STOP; + goto error; + } + // 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 + 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 ); + T02.value = cpu_to_le32(pltmp[i]) >> 8; + } + + return; +error: OS_ATOMIC_DEC( pHwData->Adapter, &pWb35Tx->TxResultCount ); pWb35Tx->EP2vm_state = VM_STOP; } diff --git a/drivers/staging/winbond/linux/wb35tx_f.h b/drivers/staging/winbond/linux/wb35tx_f.h index 7705a8454dc..107b1291813 100644 --- a/drivers/staging/winbond/linux/wb35tx_f.h +++ b/drivers/staging/winbond/linux/wb35tx_f.h @@ -3,7 +3,7 @@ //==================================== unsigned char Wb35Tx_initial( phw_data_t pHwData ); void Wb35Tx_destroy( phw_data_t pHwData ); -unsigned char Wb35Tx_get_tx_buffer( phw_data_t pHwData, PUCHAR *pBuffer ); +unsigned char Wb35Tx_get_tx_buffer( phw_data_t pHwData, u8 **pBuffer ); void Wb35Tx_EP2VM( phw_data_t pHwData ); void Wb35Tx_EP2VM_start( phw_data_t pHwData ); diff --git a/drivers/staging/winbond/linux/wbusb.c b/drivers/staging/winbond/linux/wbusb.c index cbad5fb0595..f4a7875f238 100644 --- a/drivers/staging/winbond/linux/wbusb.c +++ b/drivers/staging/winbond/linux/wbusb.c @@ -6,42 +6,29 @@ #include "sysdef.h" #include <net/mac80211.h> - -MODULE_AUTHOR( DRIVER_AUTHOR ); -MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); MODULE_VERSION("0.1"); - -//============================================================ -// vendor ID and product ID can into here for others -//============================================================ -static struct usb_device_id Id_Table[] = -{ - {USB_DEVICE( 0x0416, 0x0035 )}, - {USB_DEVICE( 0x18E8, 0x6201 )}, - {USB_DEVICE( 0x18E8, 0x6206 )}, - {USB_DEVICE( 0x18E8, 0x6217 )}, - {USB_DEVICE( 0x18E8, 0x6230 )}, - {USB_DEVICE( 0x18E8, 0x6233 )}, - {USB_DEVICE( 0x1131, 0x2035 )}, - { } +static struct usb_device_id wb35_table[] __devinitdata = { + {USB_DEVICE(0x0416, 0x0035)}, + {USB_DEVICE(0x18E8, 0x6201)}, + {USB_DEVICE(0x18E8, 0x6206)}, + {USB_DEVICE(0x18E8, 0x6217)}, + {USB_DEVICE(0x18E8, 0x6230)}, + {USB_DEVICE(0x18E8, 0x6233)}, + {USB_DEVICE(0x1131, 0x2035)}, + { 0, } }; -MODULE_DEVICE_TABLE(usb, Id_Table); +MODULE_DEVICE_TABLE(usb, wb35_table); -static struct usb_driver wb35_driver = { - .name = "w35und", - .probe = wb35_probe, - .disconnect = wb35_disconnect, - .id_table = Id_Table, -}; - -static const struct ieee80211_rate wbsoft_rates[] = { +static struct ieee80211_rate wbsoft_rates[] = { { .bitrate = 10, .flags = IEEE80211_RATE_SHORT_PREAMBLE }, }; -static const struct ieee80211_channel wbsoft_channels[] = { +static struct ieee80211_channel wbsoft_channels[] = { { .center_freq = 2412}, }; @@ -62,9 +49,22 @@ static void wbsoft_remove_interface(struct ieee80211_hw *dev, printk("wbsoft_remove interface called\n"); } -static int wbsoft_nop(void) +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("wbsoft_nop called\n"); + printk(KERN_INFO "%s called\n", __func__); + return 0; +} + +static int wbsoft_get_tx_stats(struct ieee80211_hw *hw, + struct ieee80211_tx_queue_stats *stats) +{ + printk(KERN_INFO "%s called\n", __func__); return 0; } @@ -105,8 +105,7 @@ 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, - struct ieee80211_tx_control *control) +static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) { char *buffer = kmalloc(skb->len, GFP_ATOMIC); printk("Sending frame %d bytes\n", skb->len); @@ -136,7 +135,7 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) hal_set_current_channel(&my_adapter->sHwData, ch); hal_set_beacon_period(&my_adapter->sHwData, conf->beacon_int); // hal_set_cap_info(&my_adapter->sHwData, ?? ); -// hal_set_ssid(phw_data_t pHwData, PUCHAR pssid, u8 ssid_len); ?? +// hal_set_ssid(phw_data_t pHwData, u8 * pssid, u8 ssid_len); ?? hal_set_accept_broadcast(&my_adapter->sHwData, 1); hal_set_accept_promiscuous(&my_adapter->sHwData, 1); hal_set_accept_multicast(&my_adapter->sHwData, 1); @@ -148,7 +147,7 @@ static int wbsoft_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) // hal_start_bss(&my_adapter->sHwData, WLAN_BSSTYPE_INFRASTRUCTURE); ?? -//void hal_set_rates(phw_data_t pHwData, PUCHAR pbss_rates, +//void hal_set_rates(phw_data_t pHwData, u8 * pbss_rates, // u8 length, unsigned char basic_rate_set) return 0; @@ -171,14 +170,14 @@ static u64 wbsoft_get_tsf(struct ieee80211_hw *dev) static const struct ieee80211_ops wbsoft_ops = { .tx = wbsoft_tx, .start = wbsoft_start, /* Start can be pretty much empty as we do WbWLanInitialize() during probe? */ - .stop = wbsoft_nop, + .stop = wbsoft_stop, .add_interface = wbsoft_add_interface, .remove_interface = wbsoft_remove_interface, .config = wbsoft_config, .config_interface = wbsoft_config_interface, .configure_filter = wbsoft_configure_filter, - .get_stats = wbsoft_nop, - .get_tx_stats = wbsoft_nop, + .get_stats = wbsoft_get_stats, + .get_tx_stats = wbsoft_get_tx_stats, .get_tsf = wbsoft_get_tsf, // conf_tx: hal_set_cwmin()/hal_set_cwmax; }; @@ -187,21 +186,6 @@ struct wbsoft_priv { }; -int __init wb35_init(void) -{ - printk("[w35und]driver init\n"); - return usb_register(&wb35_driver); -} - -void __exit wb35_exit(void) -{ - printk("[w35und]driver exit\n"); - usb_deregister( &wb35_driver ); -} - -module_init(wb35_init); -module_exit(wb35_exit); - // Usb kernel subsystem will call this function when a new device is plugged into. int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) { @@ -210,7 +194,7 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) PWBUSB pWbUsb; struct usb_host_interface *interface; struct usb_endpoint_descriptor *endpoint; - int i, ret = -1; + int ret = -1; u32 ltmp; struct usb_device *udev = interface_to_usbdev(intf); @@ -218,114 +202,95 @@ int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id_table) printk("[w35und]wb35_probe ->\n"); - do { - for (i=0; i<(sizeof(Id_Table)/sizeof(struct usb_device_id)); i++ ) { - if ((udev->descriptor.idVendor == Id_Table[i].idVendor) && - (udev->descriptor.idProduct == Id_Table[i].idProduct)) { - printk("[w35und]Found supported hardware\n"); - break; - } - } - if ((i == (sizeof(Id_Table)/sizeof(struct usb_device_id)))) { - #ifdef _PE_USB_INI_DUMP_ - WBDEBUG(("[w35und] This is not the one we are interested about\n")); - #endif - return -ENODEV; - } - - // 20060630.2 Check the device if it already be opened - ret = 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( ret < 0 ) - break; + // 20060630.2 Check the device if it already be opened + ret = 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 (ret < 0) + goto error; - ltmp = cpu_to_le32(ltmp); - if (ltmp) // Is already initialized? - break; + ltmp = cpu_to_le32(ltmp); + if (ltmp) // Is already initialized? + goto error; + Adapter = kzalloc(sizeof(ADAPTER), GFP_KERNEL); - Adapter = kzalloc(sizeof(ADAPTER), GFP_KERNEL); + my_adapter = Adapter; + pWbLinux = &Adapter->WbLinux; + pWbUsb = &Adapter->sHwData.WbUsb; + pWbUsb->udev = udev; - my_adapter = Adapter; - pWbLinux = &Adapter->WbLinux; - pWbUsb = &Adapter->sHwData.WbUsb; - pWbUsb->udev = udev; + interface = intf->cur_altsetting; + endpoint = &interface->endpoint[0].desc; - 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; - } - - if (!WbWLanInitialize(Adapter)) { - printk("[w35und]WbWLanInitialize fail\n"); - break; - } + if (endpoint[2].wMaxPacketSize == 512) { + printk("[w35und] Working on USB 2.0\n"); + pWbUsb->IsUsb20 = 1; + } - { - struct wbsoft_priv *priv; - struct ieee80211_hw *dev; - int res; + if (!WbWLanInitialize(Adapter)) { + printk("[w35und]WbWLanInitialize fail\n"); + goto error; + } - dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); + { + struct wbsoft_priv *priv; + struct ieee80211_hw *dev; + static struct ieee80211_supported_band band; + int res; - if (!dev) { - printk("w35und: ieee80211 alloc failed\n" ); - BUG(); - } + dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); - my_dev = dev; + if (!dev) { + printk("w35und: ieee80211 alloc failed\n" ); + BUG(); + } - SET_IEEE80211_DEV(dev, &udev->dev); - { - phw_data_t pHwData = &Adapter->sHwData; - unsigned char dev_addr[MAX_ADDR_LEN]; - hal_get_permanent_address(pHwData, dev_addr); - SET_IEEE80211_PERM_ADDR(dev, dev_addr); - } + my_dev = dev; + SET_IEEE80211_DEV(dev, &udev->dev); + { + phw_data_t pHwData = &Adapter->sHwData; + unsigned char dev_addr[MAX_ADDR_LEN]; + hal_get_permanent_address(pHwData, dev_addr); + SET_IEEE80211_PERM_ADDR(dev, dev_addr); + } - dev->extra_tx_headroom = 12; /* FIXME */ - dev->flags = 0; - dev->channel_change_time = 1000; -// dev->max_rssi = 100; + dev->extra_tx_headroom = 12; /* FIXME */ + dev->flags = 0; - dev->queues = 1; + dev->channel_change_time = 1000; +// dev->max_rssi = 100; - static struct ieee80211_supported_band band; + dev->queues = 1; - band.channels = wbsoft_channels; - band.n_channels = ARRAY_SIZE(wbsoft_channels); - band.bitrates = wbsoft_rates; - band.n_bitrates = ARRAY_SIZE(wbsoft_rates); + band.channels = wbsoft_channels; + band.n_channels = ARRAY_SIZE(wbsoft_channels); + band.bitrates = wbsoft_rates; + band.n_bitrates = ARRAY_SIZE(wbsoft_rates); - dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band; + dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band; #if 0 - wbsoft_modes[0].num_channels = 1; - wbsoft_modes[0].channels = wbsoft_channels; - wbsoft_modes[0].mode = MODE_IEEE80211B; - wbsoft_modes[0].num_rates = ARRAY_SIZE(wbsoft_rates); - wbsoft_modes[0].rates = wbsoft_rates; - - res = ieee80211_register_hwmode(dev, &wbsoft_modes[0]); - BUG_ON(res); + wbsoft_modes[0].num_channels = 1; + wbsoft_modes[0].channels = wbsoft_channels; + wbsoft_modes[0].mode = MODE_IEEE80211B; + wbsoft_modes[0].num_rates = ARRAY_SIZE(wbsoft_rates); + wbsoft_modes[0].rates = wbsoft_rates; + + res = ieee80211_register_hwmode(dev, &wbsoft_modes[0]); + BUG_ON(res); #endif - res = ieee80211_register_hw(dev); - BUG_ON(res); - } - - usb_set_intfdata( intf, Adapter ); - - printk("[w35und] _probe OK\n"); - return 0; + res = ieee80211_register_hw(dev); + BUG_ON(res); + } - } while(FALSE); + usb_set_intfdata( intf, Adapter ); + printk("[w35und] _probe OK\n"); + return 0; +error: return -ENOMEM; } @@ -401,4 +366,22 @@ void wb35_disconnect(struct usb_interface *intf) } +static struct usb_driver wb35_driver = { + .name = "w35und", + .id_table = wb35_table, + .probe = wb35_probe, + .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); diff --git a/drivers/staging/winbond/mds.c b/drivers/staging/winbond/mds.c index 8ce6389c413..f1de813f9c7 100644 --- a/drivers/staging/winbond/mds.c +++ b/drivers/staging/winbond/mds.c @@ -40,7 +40,7 @@ Mds_Tx(PADAPTER Adapter) PMDS pMds = &Adapter->Mds; DESCRIPTOR TxDes; PDESCRIPTOR pTxDes = &TxDes; - PUCHAR XmitBufAddress; + u8 *XmitBufAddress; u16 XmitBufSize, PacketSize, stmp, CurrentSize, FragmentThreshold; u8 FillIndex, TxDesIndex, FragmentCount, FillCount; unsigned char BufferFilled = FALSE, MICAdd = 0; @@ -90,7 +90,7 @@ Mds_Tx(PADAPTER Adapter) BufferFilled = TRUE; /* Leaves first u8 intact */ - memset((PUCHAR)pTxDes + 1, 0, sizeof(DESCRIPTOR) - 1); + memset((u8 *)pTxDes + 1, 0, sizeof(DESCRIPTOR) - 1); TxDesIndex = pMds->TxDesIndex;//Get the current ID pTxDes->Descriptor_ID = TxDesIndex; @@ -229,10 +229,10 @@ Mds_SendComplete(PADAPTER Adapter, PT02_DESCRIPTOR pT02) } void -Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) +Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer) { PMDS pMds = &Adapter->Mds; - PUCHAR src_buffer = pDes->buffer_address[0];//931130.5.g + u8 *src_buffer = pDes->buffer_address[0];//931130.5.g PT00_DESCRIPTOR pT00; PT01_DESCRIPTOR pT01; u16 stmp; @@ -276,7 +276,7 @@ Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) // // Set tx rate // - stmp = *(PUSHORT)(TargetBuffer+30); // 2n alignment address + stmp = *(u16 *)(TargetBuffer+30); // 2n alignment address //Use basic rate ctmp1 = ctmpf = CURRENT_TX_RATE_FOR_MNG; @@ -326,11 +326,13 @@ Mds_HeaderCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) // The function return the 4n size of usb pk u16 -Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) +Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer) { PT00_DESCRIPTOR pT00; PMDS pMds = &Adapter->Mds; - PUCHAR buffer, src_buffer, pctmp; + u8 *buffer; + u8 *src_buffer; + u8 *pctmp; u16 Size = 0; u16 SizeLeft, CopySize, CopyLeft, stmp; u8 buf_index, FragmentCount = 0; @@ -354,7 +356,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) SizeLeft -= CopySize; // 1 Byte operation - pctmp = (PUCHAR)( buffer + 8 + DOT_11_SEQUENCE_OFFSET ); + pctmp = (u8 *)( buffer + 8 + DOT_11_SEQUENCE_OFFSET ); *pctmp &= 0xf0; *pctmp |= FragmentCount;//931130.5.m if( !FragmentCount ) @@ -379,7 +381,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) buf_index++; buf_index %= MAX_DESCRIPTOR_BUFFER_INDEX; } else { - PUCHAR 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; @@ -419,7 +421,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) pT00->T00_last_mpdu = 1; pT00->T00_IsLastMpdu = 1; - buffer = (PUCHAR)pT00 + 8; // +8 for USB hdr + 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 return Size; @@ -427,7 +429,7 @@ Mds_BodyCopy(PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer) void -Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR buffer ) +Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, u8 *buffer ) { PT00_DESCRIPTOR pT00; PT01_DESCRIPTOR pT01; @@ -435,7 +437,7 @@ Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR buffer ) u8 Rate, i; unsigned char CTS_on = FALSE, RTS_on = FALSE; PT00_DESCRIPTOR pNextT00; - u16 BodyLen; + u16 BodyLen = 0; unsigned char boGroupAddr = FALSE; @@ -574,7 +576,7 @@ Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR buffer ) DEFAULT_SIFSTIME*3 ); } - ((PUSHORT)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration + ((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration //----20061009 add by anson's endian pNextT00->value = cpu_to_le32(pNextT00->value); @@ -615,7 +617,7 @@ Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR buffer ) } } - ((PUSHORT)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration + ((u16 *)buffer)[5] = cpu_to_le16(Duration);// 4 USHOR for skip 8B USB, 2USHORT=FC + Duration pT00->value = cpu_to_le32(pT00->value); pT01->value = cpu_to_le32(pT01->value); //--end 20061009 add diff --git a/drivers/staging/winbond/mds_f.h b/drivers/staging/winbond/mds_f.h index 651188be106..7a682d4cfbd 100644 --- a/drivers/staging/winbond/mds_f.h +++ b/drivers/staging/winbond/mds_f.h @@ -1,9 +1,9 @@ unsigned char Mds_initial( PADAPTER Adapter ); void Mds_Destroy( PADAPTER Adapter ); void Mds_Tx( PADAPTER Adapter ); -void Mds_HeaderCopy( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer ); -u16 Mds_BodyCopy( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer ); -void Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, PUCHAR TargetBuffer ); +void Mds_HeaderCopy( PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer ); +u16 Mds_BodyCopy( PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer ); +void Mds_DurationSet( PADAPTER Adapter, PDESCRIPTOR pDes, u8 *TargetBuffer ); void Mds_SendComplete( PADAPTER Adapter, PT02_DESCRIPTOR pT02 ); void Mds_MpduProcess( PADAPTER Adapter, PDESCRIPTOR pRxDes ); void Mds_reset_descriptor( PADAPTER Adapter ); diff --git a/drivers/staging/winbond/mds_s.h b/drivers/staging/winbond/mds_s.h index 4738279d5f3..9df2e0936bf 100644 --- a/drivers/staging/winbond/mds_s.h +++ b/drivers/staging/winbond/mds_s.h @@ -86,7 +86,7 @@ typedef struct _MDS { // For Tx usage u8 TxOwner[ ((MAX_USB_TX_BUFFER_NUMBER + 3) & ~0x03) ]; - PUCHAR pTxBuffer; + u8 *pTxBuffer; u16 TxBufferSize[ ((MAX_USB_TX_BUFFER_NUMBER + 1) & ~0x01) ]; u8 TxDesFrom[ ((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03) ];//931130.4.u // 1: MLME 2: NDIS control 3: NDIS data u8 TxCountInBuffer[ ((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03) ]; // 20060928 @@ -103,7 +103,7 @@ typedef struct _MDS u16 TxResult[ ((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01) ];//Collect the sending result of Mpdu u8 MicRedundant[8]; // For tmp use - PUCHAR MicWriteAddress[2]; //The start address to fill the Mic, use 2 point due to Mic maybe fragment + u8 *MicWriteAddress[2]; //The start address to fill the Mic, use 2 point due to Mic maybe fragment u16 MicWriteSize[2]; //931130.4.x @@ -144,7 +144,7 @@ typedef struct _MDS typedef struct _RxBuffer { - PUCHAR pBufferAddress; // Pointer the received data buffer. + u8 * pBufferAddress; // Pointer the received data buffer. u16 BufferSize; u8 RESERVED; u8 BufferIndex;// Only 1 byte @@ -176,7 +176,7 @@ typedef struct _RXLAYER1 ///////////////////////////////////////////////////////////////////////////////////////////// // For brand-new Rx system u8 ReservedBuffer[ 2400 ];//If Buffer ID is reserved one, it must copy the data into this area - PUCHAR ReservedBufferPoint;// Point to the next availabe address of reserved buffer + u8 *ReservedBufferPoint;// Point to the next availabe address of reserved buffer }RXLAYER1, * PRXLAYER1; diff --git a/drivers/staging/winbond/mlme_s.h b/drivers/staging/winbond/mlme_s.h index 58094f61c03..039fd408ba6 100644 --- a/drivers/staging/winbond/mlme_s.h +++ b/drivers/staging/winbond/mlme_s.h @@ -125,12 +125,12 @@ typedef struct _MLME_FRAME { //NDIS_PACKET MLME_Packet; - PCHAR pMMPDU; + s8 * pMMPDU; u16 len; u8 DataType; u8 IsInUsed; - OS_SPIN_LOCK MLMESpinLock; + spinlock_t MLMESpinLock; u8 TxMMPDU[MAX_NUM_TX_MMPDU][MAX_MMPDU_SIZE]; u8 TxMMPDUInUse[ (MAX_NUM_TX_MMPDU+3) & ~0x03 ]; diff --git a/drivers/staging/winbond/mlmetxrx.c b/drivers/staging/winbond/mlmetxrx.c index 46b091e9679..e8533b8d197 100644 --- a/drivers/staging/winbond/mlmetxrx.c +++ b/drivers/staging/winbond/mlmetxrx.c @@ -113,13 +113,13 @@ MLME_GetNextPacket(PADAPTER Adapter, PDESCRIPTOR pDes) pDes->Type = Adapter->sMlmeFrame.DataType; } -void MLMEfreeMMPDUBuffer(PWB32_ADAPTER Adapter, PCHAR pData) +void MLMEfreeMMPDUBuffer(PWB32_ADAPTER Adapter, s8 *pData) { int i; // Reclaim the data buffer for (i = 0; i < MAX_NUM_TX_MMPDU; i++) { - if (pData == (PCHAR)&(Adapter->sMlmeFrame.TxMMPDU[i])) + if (pData == (s8 *)&(Adapter->sMlmeFrame.TxMMPDU[i])) break; } if (Adapter->sMlmeFrame.TxMMPDUInUse[i]) diff --git a/drivers/staging/winbond/mlmetxrx_f.h b/drivers/staging/winbond/mlmetxrx_f.h index d74e225be21..24cd5f308d9 100644 --- a/drivers/staging/winbond/mlmetxrx_f.h +++ b/drivers/staging/winbond/mlmetxrx_f.h @@ -20,7 +20,7 @@ MLMEGetMMPDUBuffer( PWB32_ADAPTER Adapter ); -void MLMEfreeMMPDUBuffer( PWB32_ADAPTER Adapter, PCHAR pData); +void MLMEfreeMMPDUBuffer( PWB32_ADAPTER Adapter, s8 * pData); void MLME_GetNextPacket( PADAPTER Adapter, PDESCRIPTOR pDes ); u8 MLMESendFrame( PWB32_ADAPTER Adapter, @@ -42,7 +42,7 @@ MLMERcvFrame( void MLMEReturnPacket( PWB32_ADAPTER Adapter, - PUCHAR pRxBufer + u8 * pRxBufer ); #ifdef _IBSS_BEACON_SEQ_STICK_ s8 SendBCNullData(PWB32_ADAPTER Adapter, u16 wIdx); diff --git a/drivers/staging/winbond/reg.c b/drivers/staging/winbond/reg.c index b475c7a7c42..57af5b83150 100644 --- a/drivers/staging/winbond/reg.c +++ b/drivers/staging/winbond/reg.c @@ -922,16 +922,16 @@ Uxx_ReadEthernetAddress( phw_data_t pHwData ) // Only unplug and plug again can make hardware read EEPROM again. 20060727 Wb35Reg_WriteSync( pHwData, 0x03b4, 0x08000000 ); // Start EEPROM access + Read + address(0x0d) Wb35Reg_ReadSync( pHwData, 0x03b4, <mp ); - *(PUSHORT)pHwData->PermanentMacAddress = cpu_to_le16((u16)ltmp); //20060926 anson's endian + *(u16 *)pHwData->PermanentMacAddress = cpu_to_le16((u16)ltmp); //20060926 anson's endian Wb35Reg_WriteSync( pHwData, 0x03b4, 0x08010000 ); // Start EEPROM access + Read + address(0x0d) Wb35Reg_ReadSync( pHwData, 0x03b4, <mp ); - *(PUSHORT)(pHwData->PermanentMacAddress + 2) = cpu_to_le16((u16)ltmp); //20060926 anson's endian + *(u16 *)(pHwData->PermanentMacAddress + 2) = cpu_to_le16((u16)ltmp); //20060926 anson's endian Wb35Reg_WriteSync( pHwData, 0x03b4, 0x08020000 ); // Start EEPROM access + Read + address(0x0d) Wb35Reg_ReadSync( pHwData, 0x03b4, <mp ); - *(PUSHORT)(pHwData->PermanentMacAddress + 4) = cpu_to_le16((u16)ltmp); //20060926 anson's endian - *(PUSHORT)(pHwData->PermanentMacAddress + 6) = 0; - Wb35Reg_WriteSync( pHwData, 0x03e8, cpu_to_le32(*(PULONG)pHwData->PermanentMacAddress) ); //20060926 anson's endian - Wb35Reg_WriteSync( pHwData, 0x03ec, cpu_to_le32(*(PULONG)(pHwData->PermanentMacAddress+4)) ); //20060926 anson's endian + *(u16 *)(pHwData->PermanentMacAddress + 4) = cpu_to_le16((u16)ltmp); //20060926 anson's endian + *(u16 *)(pHwData->PermanentMacAddress + 6) = 0; + Wb35Reg_WriteSync( pHwData, 0x03e8, cpu_to_le32(*(u32 *)pHwData->PermanentMacAddress) ); //20060926 anson's endian + Wb35Reg_WriteSync( pHwData, 0x03ec, cpu_to_le32(*(u32 *)(pHwData->PermanentMacAddress+4)) ); //20060926 anson's endian } @@ -1038,7 +1038,7 @@ void RFSynthesizer_initial(phw_data_t pHwData) { u32 altmp[32]; - PULONG pltmp = altmp; + u32 * pltmp = altmp; u32 ltmp; u8 number=0x00; // The number of register vale u8 i; @@ -2358,11 +2358,11 @@ void Mxx_initial( phw_data_t pHwData ) pltmp[2] = pWb35Reg->M2C_MacControl; // M30 BSSID - pltmp[3] = *(PULONG)pHwData->bssid; + pltmp[3] = *(u32 *)pHwData->bssid; // M34 pHwData->AID = DEFAULT_AID; - tmp = *(PUSHORT)(pHwData->bssid+4); + tmp = *(u16 *)(pHwData->bssid+4); tmp |= DEFAULT_AID << 16; pltmp[4] = tmp; @@ -2428,7 +2428,7 @@ void GetTxVgaFromEEPROM( phw_data_t pHwData ) { u32 i, j, ltmp; u16 Value[MAX_TXVGA_EEPROM]; - PUCHAR pctmp; + u8 *pctmp; u8 ctmp=0; // Get the entire TxVga setting in EEPROM @@ -2441,7 +2441,7 @@ void GetTxVgaFromEEPROM( phw_data_t pHwData ) } // Adjust the filed which fills with reserved value. - pctmp = (PUCHAR)Value; + pctmp = (u8 *)Value; for( i=0; i<(MAX_TXVGA_EEPROM*2); i++ ) { if( pctmp[i] != 0xff ) @@ -2480,7 +2480,7 @@ void GetTxVgaFromEEPROM( phw_data_t pHwData ) // This function will use default TxVgaSettingInEEPROM data to calculate new TxVga. void EEPROMTxVgaAdjust( phw_data_t pHwData ) // 20060619.5 Add { - PUCHAR pTxVga = pHwData->TxVgaSettingInEEPROM; + u8 * pTxVga = pHwData->TxVgaSettingInEEPROM; s16 i, stmp; //-- 2.4G -- 20060704.2 Request from Tiger diff --git a/drivers/staging/winbond/sme_api.c b/drivers/staging/winbond/sme_api.c index 40e93b7600e..31c9673ea86 100644 --- a/drivers/staging/winbond/sme_api.c +++ b/drivers/staging/winbond/sme_api.c @@ -10,4 +10,5 @@ s8 sme_get_rssi(void *pcore_data, s32 *prssi) { BUG(); + return 0; } diff --git a/drivers/staging/winbond/sme_api.h b/drivers/staging/winbond/sme_api.h index 016b225ca4a..745eb376bc7 100644 --- a/drivers/staging/winbond/sme_api.h +++ b/drivers/staging/winbond/sme_api.h @@ -208,7 +208,7 @@ s8 sme_set_tx_antenna(void *pcore_data, u32 TxAntenna); s8 sme_set_IBSS_chan(void *pcore_data, ChanInfo chan); //20061108 WPS -s8 sme_set_IE_append(void *pcore_data, PUCHAR buffer, u16 buf_len); +s8 sme_set_IE_append(void *pcore_data, u8 *buffer, u16 buf_len); diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c index daf44224755..5d68ecec34c 100644 --- a/drivers/staging/winbond/wbhal.c +++ b/drivers/staging/winbond/wbhal.c @@ -1,13 +1,13 @@ #include "os_common.h" -void hal_get_ethernet_address( phw_data_t pHwData, PUCHAR current_address ) +void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address ) { if( pHwData->SurpriseRemove ) return; memcpy( current_address, pHwData->CurrentMacAddress, ETH_LENGTH_OF_ADDRESS ); } -void hal_set_ethernet_address( phw_data_t pHwData, PUCHAR current_address ) +void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address ) { u32 ltmp[2]; @@ -15,13 +15,13 @@ void hal_set_ethernet_address( phw_data_t pHwData, PUCHAR current_address ) memcpy( pHwData->CurrentMacAddress, current_address, ETH_LENGTH_OF_ADDRESS ); - ltmp[0]= cpu_to_le32( *(PULONG)pHwData->CurrentMacAddress ); - ltmp[1]= cpu_to_le32( *(PULONG)(pHwData->CurrentMacAddress + 4) ) & 0xffff; + ltmp[0]= cpu_to_le32( *(u32 *)pHwData->CurrentMacAddress ); + ltmp[1]= cpu_to_le32( *(u32 *)(pHwData->CurrentMacAddress + 4) ) & 0xffff; Wb35Reg_BurstWrite( pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT ); } -void hal_get_permanent_address( phw_data_t pHwData, PUCHAR pethernet_address ) +void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address ) { if( pHwData->SurpriseRemove ) return; @@ -89,7 +89,7 @@ void hal_halt(phw_data_t pHwData, void *ppa_data) } //--------------------------------------------------------------------------------------------------- -void hal_set_rates(phw_data_t pHwData, PUCHAR pbss_rates, +void hal_set_rates(phw_data_t pHwData, u8 *pbss_rates, u8 length, unsigned char basic_rate_set) { PWB35REG pWb35Reg = &pHwData->Wb35Reg; @@ -158,13 +158,13 @@ void hal_set_rates(phw_data_t pHwData, PUCHAR pbss_rates, // Fill data into support rate until buffer full //---20060926 add by anson's endian for (i=0; i<4; i++) - *(PULONG)(SupportedRate+(i<<2)) = cpu_to_le32( *(PULONG)(SupportedRate+(i<<2)) ); + *(u32 *)(SupportedRate+(i<<2)) = cpu_to_le32( *(u32 *)(SupportedRate+(i<<2)) ); //--- end 20060926 add by anson's endian - Wb35Reg_BurstWrite( pHwData,0x087c, (PULONG)SupportedRate, 4, AUTO_INCREMENT ); - pWb35Reg->M7C_MacControl = ((PULONG)SupportedRate)[0]; - pWb35Reg->M80_MacControl = ((PULONG)SupportedRate)[1]; - pWb35Reg->M84_MacControl = ((PULONG)SupportedRate)[2]; - pWb35Reg->M88_MacControl = ((PULONG)SupportedRate)[3]; + Wb35Reg_BurstWrite( pHwData,0x087c, (u32 *)SupportedRate, 4, AUTO_INCREMENT ); + pWb35Reg->M7C_MacControl = ((u32 *)SupportedRate)[0]; + pWb35Reg->M80_MacControl = ((u32 *)SupportedRate)[1]; + pWb35Reg->M84_MacControl = ((u32 *)SupportedRate)[2]; + pWb35Reg->M88_MacControl = ((u32 *)SupportedRate)[3]; // Fill length tmp = Count1<<28 | Count2<<24; @@ -206,7 +206,7 @@ void hal_set_current_channel_ex( phw_data_t pHwData, ChanInfo channel ) pWb35Reg->M28_MacControl &= ~0xff; // Clean channel information field pWb35Reg->M28_MacControl |= channel.ChanNo; Wb35Reg_WriteWithCallbackValue( pHwData, 0x0828, pWb35Reg->M28_MacControl, - (PCHAR)&channel, sizeof(ChanInfo)); + (s8 *)&channel, sizeof(ChanInfo)); } //--------------------------------------------------------------------------------------------------- void hal_set_current_channel( phw_data_t pHwData, ChanInfo channel ) @@ -277,7 +277,7 @@ void hal_set_accept_beacon( phw_data_t pHwData, u8 enable ) Wb35Reg_Write( pHwData, 0x0800, pWb35Reg->M00_MacControl ); } //--------------------------------------------------------------------------------------------------- -void hal_set_multicast_address( phw_data_t pHwData, PUCHAR address, u8 number ) +void hal_set_multicast_address( phw_data_t pHwData, u8 *address, u8 number ) { PWB35REG pWb35Reg = &pHwData->Wb35Reg; u8 Byte, Bit; @@ -297,7 +297,7 @@ void hal_set_multicast_address( phw_data_t pHwData, PUCHAR address, u8 number ) } // Updating register - Wb35Reg_BurstWrite( pHwData, 0x0804, (PULONG)pWb35Reg->Multicast, 2, AUTO_INCREMENT ); + Wb35Reg_BurstWrite( pHwData, 0x0804, (u32 *)pWb35Reg->Multicast, 2, AUTO_INCREMENT ); } //--------------------------------------------------------------------------------------------------- u8 hal_get_accept_beacon( phw_data_t pHwData ) @@ -806,7 +806,7 @@ u8 hal_get_hw_radio_off( phw_data_t pHwData ) } } -unsigned char hal_get_dxx_reg( phw_data_t pHwData, u16 number, PULONG pValue ) +unsigned char hal_get_dxx_reg( phw_data_t pHwData, u16 number, u32 * pValue ) { if( number < 0x1000 ) number += 0x1000; diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h index fe25f97af72..ea9531ac847 100644 --- a/drivers/staging/winbond/wbhal_f.h +++ b/drivers/staging/winbond/wbhal_f.h @@ -16,23 +16,23 @@ //==================================================================================== // Function declaration //==================================================================================== -void hal_remove_mapping_key( phw_data_t pHwData, PUCHAR pmac_addr ); +void hal_remove_mapping_key( phw_data_t pHwData, u8 *pmac_addr ); void hal_remove_default_key( phw_data_t pHwData, u32 index ); -unsigned char hal_set_mapping_key( phw_data_t Adapter, PUCHAR pmac_addr, u8 null_key, u8 wep_on, PUCHAR ptx_tsc, PUCHAR prx_tsc, u8 key_type, u8 key_len, PUCHAR pkey_data ); -unsigned char hal_set_default_key( phw_data_t Adapter, u8 index, u8 null_key, u8 wep_on, PUCHAR ptx_tsc, PUCHAR prx_tsc, u8 key_type, u8 key_len, PUCHAR pkey_data ); +unsigned char hal_set_mapping_key( phw_data_t Adapter, u8 *pmac_addr, u8 null_key, u8 wep_on, u8 *ptx_tsc, u8 *prx_tsc, u8 key_type, u8 key_len, u8 *pkey_data ); +unsigned char hal_set_default_key( phw_data_t Adapter, u8 index, u8 null_key, u8 wep_on, u8 *ptx_tsc, u8 *prx_tsc, u8 key_type, u8 key_len, u8 *pkey_data ); void hal_clear_all_default_key( phw_data_t pHwData ); void hal_clear_all_group_key( phw_data_t pHwData ); void hal_clear_all_mapping_key( phw_data_t pHwData ); void hal_clear_all_key( phw_data_t pHwData ); -void hal_get_ethernet_address( phw_data_t pHwData, PUCHAR current_address ); -void hal_set_ethernet_address( phw_data_t pHwData, PUCHAR current_address ); -void hal_get_permanent_address( phw_data_t pHwData, PUCHAR pethernet_address ); +void hal_get_ethernet_address( phw_data_t pHwData, u8 *current_address ); +void hal_set_ethernet_address( phw_data_t pHwData, u8 *current_address ); +void hal_get_permanent_address( phw_data_t pHwData, u8 *pethernet_address ); unsigned char hal_init_hardware( phw_data_t pHwData, PADAPTER Adapter ); void hal_set_power_save_mode( phw_data_t pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim ); -void hal_get_power_save_mode( phw_data_t pHwData, PBOOLEAN pin_pwr_save ); +void hal_get_power_save_mode( phw_data_t pHwData, u8 *pin_pwr_save ); void hal_set_slot_time( phw_data_t pHwData, u8 type ); #define hal_set_atim_window( _A, _ATM ) -void hal_set_rates( phw_data_t pHwData, PUCHAR pbss_rates, u8 length, unsigned char basic_rate_set ); +void hal_set_rates( phw_data_t pHwData, u8 *pbss_rates, u8 length, unsigned char basic_rate_set ); #define hal_set_basic_rates( _A, _R, _L ) hal_set_rates( _A, _R, _L, TRUE ) #define hal_set_op_rates( _A, _R, _L ) hal_set_rates( _A, _R, _L, FALSE ) void hal_start_bss( phw_data_t pHwData, u8 mac_op_mode ); @@ -40,19 +40,19 @@ void hal_join_request( phw_data_t pHwData, u8 bss_type ); // 0:BSS STA 1:IBSS void hal_stop_sync_bss( phw_data_t pHwData ); void hal_resume_sync_bss( phw_data_t pHwData); void hal_set_aid( phw_data_t pHwData, u16 aid ); -void hal_set_bssid( phw_data_t pHwData, PUCHAR pbssid ); -void hal_get_bssid( phw_data_t pHwData, PUCHAR pbssid ); +void hal_set_bssid( phw_data_t pHwData, u8 *pbssid ); +void hal_get_bssid( phw_data_t pHwData, u8 *pbssid ); void hal_set_beacon_period( phw_data_t pHwData, u16 beacon_period ); void hal_set_listen_interval( phw_data_t pHwData, u16 listen_interval ); void hal_set_cap_info( phw_data_t pHwData, u16 capability_info ); -void hal_set_ssid( phw_data_t pHwData, PUCHAR pssid, u8 ssid_len ); +void hal_set_ssid( phw_data_t pHwData, u8 *pssid, u8 ssid_len ); void hal_set_current_channel( phw_data_t pHwData, ChanInfo channel ); void hal_set_current_channel_ex( phw_data_t pHwData, ChanInfo channel ); void hal_get_current_channel( phw_data_t pHwData, ChanInfo *channel ); void hal_set_accept_broadcast( phw_data_t pHwData, u8 enable ); void hal_set_accept_multicast( phw_data_t pHwData, u8 enable ); void hal_set_accept_beacon( phw_data_t pHwData, u8 enable ); -void hal_set_multicast_address( phw_data_t pHwData, PUCHAR address, u8 number ); +void hal_set_multicast_address( phw_data_t pHwData, u8 *address, u8 number ); u8 hal_get_accept_beacon( phw_data_t pHwData ); void hal_stop( phw_data_t pHwData ); void hal_halt( phw_data_t pHwData, void *ppa_data ); @@ -97,7 +97,7 @@ void hal_surprise_remove( phw_data_t pHwData ); void hal_rate_change( phw_data_t pHwData ); // Notify the HAL rate is changing 20060613.1 -unsigned char hal_get_dxx_reg( phw_data_t pHwData, u16 number, PULONG pValue ); +unsigned char hal_get_dxx_reg( phw_data_t pHwData, u16 number, u32 * pValue ); unsigned char hal_set_dxx_reg( phw_data_t pHwData, u16 number, u32 value ); #define hal_get_time_count( _P ) (_P->time_count/10) // return 100ms count #define hal_detect_error( _P ) (_P->WbUsb.DetectCount) @@ -116,7 +116,7 @@ unsigned char hal_idle( phw_data_t pHwData ); #define pa_stall_execution( _A ) //OS_SLEEP( 1 ) #define hw_get_cxx_reg( _A, _B, _C ) #define hw_set_cxx_reg( _A, _B, _C ) -#define hw_get_dxx_reg( _A, _B, _C ) hal_get_dxx_reg( _A, _B, (PULONG)_C ) +#define hw_get_dxx_reg( _A, _B, _C ) hal_get_dxx_reg( _A, _B, (u32 *)_C ) #define hw_set_dxx_reg( _A, _B, _C ) hal_set_dxx_reg( _A, _B, (u32)_C ) diff --git a/drivers/staging/winbond/wbhal_s.h b/drivers/staging/winbond/wbhal_s.h index 5b862ff357b..2ee3f0fc1ad 100644 --- a/drivers/staging/winbond/wbhal_s.h +++ b/drivers/staging/winbond/wbhal_s.h @@ -461,7 +461,7 @@ typedef struct _HW_DATA_T //===================================================================== // Definition for 802.11 //===================================================================== - PUCHAR bssid_pointer; // Used by hal_get_bssid for return value + u8 *bssid_pointer; // Used by hal_get_bssid for return value u8 bssid[8];// Only 6 byte will be used. 8 byte is required for read buffer u8 ssid[32];// maximum ssid length is 32 byte @@ -486,7 +486,7 @@ typedef struct _HW_DATA_T u32 CurrentRadioSw; // 20060320.2 0:On 1:Off u32 CurrentRadioHw; // 20060825 0:On 1:Off - PUCHAR power_save_point; // Used by hal_get_power_save_mode for return value + u8 *power_save_point; // Used by hal_get_power_save_mode for return value u8 cwmin; u8 desired_power_save; u8 dtim;// Is running dtim diff --git a/drivers/staging/winbond/wblinux.c b/drivers/staging/winbond/wblinux.c index 2eade5a47b1..4ed45e48831 100644 --- a/drivers/staging/winbond/wblinux.c +++ b/drivers/staging/winbond/wblinux.c @@ -25,11 +25,11 @@ EncapAtomicInc(PADAPTER Adapter, void* pAtomic) { PWBLINUX pWbLinux = &Adapter->WbLinux; u32 ltmp; - PULONG pltmp = (PULONG)pAtomic; - OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock ); + u32 * pltmp = (u32 *)pAtomic; + spin_lock_irq( &pWbLinux->AtomicSpinLock ); (*pltmp)++; ltmp = (*pltmp); - OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock ); + spin_unlock_irq( &pWbLinux->AtomicSpinLock ); return ltmp; } @@ -38,11 +38,11 @@ EncapAtomicDec(PADAPTER Adapter, void* pAtomic) { PWBLINUX pWbLinux = &Adapter->WbLinux; u32 ltmp; - PULONG pltmp = (PULONG)pAtomic; - OS_SPIN_LOCK_ACQUIRED( &pWbLinux->AtomicSpinLock ); + u32 * pltmp = (u32 *)pAtomic; + spin_lock_irq( &pWbLinux->AtomicSpinLock ); (*pltmp)--; ltmp = (*pltmp); - OS_SPIN_LOCK_RELEASED( &pWbLinux->AtomicSpinLock ); + spin_unlock_irq( &pWbLinux->AtomicSpinLock ); return ltmp; } @@ -51,8 +51,8 @@ WBLINUX_Initial(PADAPTER Adapter) { PWBLINUX pWbLinux = &Adapter->WbLinux; - OS_SPIN_LOCK_ALLOCATE( &pWbLinux->SpinLock ); - OS_SPIN_LOCK_ALLOCATE( &pWbLinux->AtomicSpinLock ); + spin_lock_init( &pWbLinux->SpinLock ); + spin_lock_init( &pWbLinux->AtomicSpinLock ); return TRUE; } @@ -79,7 +79,6 @@ void WBLINUX_Destroy(PADAPTER Adapter) { WBLINUX_stop( Adapter ); - OS_SPIN_LOCK_FREE( &pWbNdis->SpinLock ); #ifdef _PE_USB_INI_DUMP_ WBDEBUG(("[w35und] unregister_netdev!\n")); #endif @@ -142,119 +141,118 @@ unsigned char WbWLanInitialize(PADAPTER Adapter) { phw_data_t pHwData; - PUCHAR pMacAddr, pMacAddr2; + u8 *pMacAddr; + u8 *pMacAddr2; u32 InitStep = 0; u8 EEPROM_region; u8 HwRadioOff; - do { - // - // Setting default value for Linux - // - Adapter->sLocalPara.region_INF = REGION_AUTO; - Adapter->sLocalPara.TxRateMode = RATE_AUTO; - psLOCAL->bMacOperationMode = MODE_802_11_BG; // B/G mode - Adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; - Adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; - hal_set_phy_type( &Adapter->sHwData, RF_WB_242_1 ); - Adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; - psLOCAL->bPreambleMode = AUTO_MODE; - Adapter->sLocalPara.RadioOffStatus.boSwRadioOff = FALSE; - pHwData = &Adapter->sHwData; - hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); - - // - // Initial each module and variable - // - if (!WBLINUX_Initial(Adapter)) { + // + // Setting default value for Linux + // + Adapter->sLocalPara.region_INF = REGION_AUTO; + Adapter->sLocalPara.TxRateMode = RATE_AUTO; + psLOCAL->bMacOperationMode = MODE_802_11_BG; // B/G mode + Adapter->Mds.TxRTSThreshold = DEFAULT_RTSThreshold; + Adapter->Mds.TxFragmentThreshold = DEFAULT_FRAGMENT_THRESHOLD; + hal_set_phy_type( &Adapter->sHwData, RF_WB_242_1 ); + Adapter->sLocalPara.MTUsize = MAX_ETHERNET_PACKET_SIZE; + psLOCAL->bPreambleMode = AUTO_MODE; + Adapter->sLocalPara.RadioOffStatus.boSwRadioOff = FALSE; + pHwData = &Adapter->sHwData; + hal_set_phy_type( pHwData, RF_DECIDE_BY_INF ); + + // + // Initial each module and variable + // + if (!WBLINUX_Initial(Adapter)) { #ifdef _PE_USB_INI_DUMP_ - WBDEBUG(("[w35und]WBNDIS initialization failed\n")); + WBDEBUG(("[w35und]WBNDIS initialization failed\n")); #endif - break; - } + goto error; + } - // Initial Software variable - Adapter->sLocalPara.ShutDowned = FALSE; - - //added by ws for wep key error detection - Adapter->sLocalPara.bWepKeyError= FALSE; - Adapter->sLocalPara.bToSelfPacketReceived = FALSE; - Adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds - - // Initial USB hal - InitStep = 1; - pHwData = &Adapter->sHwData; - if (!hal_init_hardware(pHwData, Adapter)) - break; - - EEPROM_region = hal_get_region_from_EEPROM( pHwData ); - if (EEPROM_region != REGION_AUTO) - psLOCAL->region = EEPROM_region; - else { - if (psLOCAL->region_INF != REGION_AUTO) - psLOCAL->region = psLOCAL->region_INF; - else - psLOCAL->region = REGION_USA; //default setting - } + // Initial Software variable + Adapter->sLocalPara.ShutDowned = FALSE; + + //added by ws for wep key error detection + Adapter->sLocalPara.bWepKeyError= FALSE; + Adapter->sLocalPara.bToSelfPacketReceived = FALSE; + Adapter->sLocalPara.WepKeyDetectTimerCount= 2 * 100; /// 2 seconds + + // Initial USB hal + InitStep = 1; + pHwData = &Adapter->sHwData; + if (!hal_init_hardware(pHwData, Adapter)) + goto error; + + EEPROM_region = hal_get_region_from_EEPROM( pHwData ); + if (EEPROM_region != REGION_AUTO) + psLOCAL->region = EEPROM_region; + else { + if (psLOCAL->region_INF != REGION_AUTO) + psLOCAL->region = psLOCAL->region_INF; + else + psLOCAL->region = REGION_USA; //default setting + } - // Get Software setting flag from hal - Adapter->sLocalPara.boAntennaDiversity = FALSE; - if (hal_software_set(pHwData) & 0x00000001) - Adapter->sLocalPara.boAntennaDiversity = TRUE; - - // - // For TS module - // - InitStep = 2; - - // For MDS module - InitStep = 3; - Mds_initial(Adapter); - - //======================================= - // Initialize the SME, SCAN, MLME, ROAM - //======================================= - InitStep = 4; - InitStep = 5; - InitStep = 6; - - // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. - pMacAddr = Adapter->sLocalPara.ThisMacAddress; - pMacAddr2 = Adapter->sLocalPara.PermanentAddress; - hal_get_permanent_address( pHwData, Adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM - if (OS_MEMORY_COMPARE(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH )) // Is equal - { - memcpy( pMacAddr, pMacAddr2, MAC_ADDR_LENGTH ); - } else { - // Set the user define MAC address - hal_set_ethernet_address( pHwData, Adapter->sLocalPara.ThisMacAddress ); - } + // Get Software setting flag from hal + Adapter->sLocalPara.boAntennaDiversity = FALSE; + if (hal_software_set(pHwData) & 0x00000001) + Adapter->sLocalPara.boAntennaDiversity = TRUE; + + // + // For TS module + // + InitStep = 2; + + // For MDS module + InitStep = 3; + Mds_initial(Adapter); + + //======================================= + // Initialize the SME, SCAN, MLME, ROAM + //======================================= + InitStep = 4; + InitStep = 5; + InitStep = 6; + + // If no user-defined address in the registry, use the addresss "burned" on the NIC instead. + pMacAddr = Adapter->sLocalPara.ThisMacAddress; + pMacAddr2 = Adapter->sLocalPara.PermanentAddress; + hal_get_permanent_address( pHwData, Adapter->sLocalPara.PermanentAddress );// Reading ethernet address from EEPROM + if (OS_MEMORY_COMPARE(pMacAddr, "\x00\x00\x00\x00\x00\x00", MAC_ADDR_LENGTH )) // Is equal + { + memcpy( pMacAddr, pMacAddr2, MAC_ADDR_LENGTH ); + } else { + // Set the user define MAC address + hal_set_ethernet_address( pHwData, Adapter->sLocalPara.ThisMacAddress ); + } - //get current antenna - psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData); + //get current antenna + psLOCAL->bAntennaNo = hal_get_antenna_number(pHwData); #ifdef _PE_STATE_DUMP_ - WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); + WBDEBUG(("Driver init, antenna no = %d\n", psLOCAL->bAntennaNo)); #endif - hal_get_hw_radio_off( pHwData ); + hal_get_hw_radio_off( pHwData ); - // Waiting for HAL setting OK - while (!hal_idle(pHwData)) - OS_SLEEP(10000); + // Waiting for HAL setting OK + while (!hal_idle(pHwData)) + OS_SLEEP(10000); - MTO_Init(Adapter); + MTO_Init(Adapter); - HwRadioOff = hal_get_hw_radio_off( pHwData ); - psLOCAL->RadioOffStatus.boHwRadioOff = !!HwRadioOff; + HwRadioOff = hal_get_hw_radio_off( pHwData ); + psLOCAL->RadioOffStatus.boHwRadioOff = !!HwRadioOff; - hal_set_radio_mode( pHwData, (unsigned char)(psLOCAL->RadioOffStatus.boSwRadioOff || psLOCAL->RadioOffStatus.boHwRadioOff) ); + hal_set_radio_mode( pHwData, (unsigned char)(psLOCAL->RadioOffStatus.boSwRadioOff || psLOCAL->RadioOffStatus.boHwRadioOff) ); - hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now. - //set a tx power for reference..... -// sme_set_tx_power_level(Adapter, 12); FIXME? - return TRUE; - } - while(FALSE); + hal_driver_init_OK(pHwData) = 1; // Notify hal that the driver is ready now. + //set a tx power for reference..... +// sme_set_tx_power_level(Adapter, 12); FIXME? + return TRUE; +error: switch (InitStep) { case 5: case 4: diff --git a/drivers/staging/winbond/wblinux_s.h b/drivers/staging/winbond/wblinux_s.h index 97e9167ab83..fd2bb43bf3c 100644 --- a/drivers/staging/winbond/wblinux_s.h +++ b/drivers/staging/winbond/wblinux_s.h @@ -24,8 +24,8 @@ typedef struct _WBLINUX { - OS_SPIN_LOCK AtomicSpinLock; - OS_SPIN_LOCK SpinLock; + spinlock_t AtomicSpinLock; + spinlock_t SpinLock; u32 shutdown; OS_ATOMIC ThreadCount; |