]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/staging/winbond/wbhal.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[linux-2.6-omap-h63xx.git] / drivers / staging / winbond / wbhal.c
index 163ca3c4f117b320c58d5c5f00de720b2ce55700..8a9d21cbb0c0778b091417be9c22f0d297ca60a4 100644 (file)
@@ -2,13 +2,6 @@
 #include "wbhal_f.h"
 #include "wblinux_f.h"
 
-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, u8 *current_address )
 {
        u32 ltmp[2];
@@ -315,9 +308,10 @@ static void hal_led_control(unsigned long data)
        add_timer(&pHwData->LEDTimer);
 }
 
-
-u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
+u8 hal_init_hardware(struct ieee80211_hw *hw)
 {
+       struct wbsoft_priv *priv = hw->priv;
+       phw_data_t pHwData = &priv->sHwData;
        u16 SoftwareSet;
 
        // Initial the variable
@@ -333,7 +327,7 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
                                pHwData->InitialResource = 4;
                                init_timer(&pHwData->LEDTimer);
                                pHwData->LEDTimer.function = hal_led_control;
-                               pHwData->LEDTimer.data = (unsigned long) adapter;
+                               pHwData->LEDTimer.data = (unsigned long) priv;
                                pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(1000);
                                add_timer(&pHwData->LEDTimer);
 
@@ -349,8 +343,8 @@ u8 hal_init_hardware(phw_data_t pHwData, struct wbsoft_priv * adapter)
                                        return false;
                                #endif
 
-                               Wb35Rx_start( pHwData );
-                               Wb35Tx_EP2VM_start(adapter);
+                               Wb35Rx_start(hw);
+                               Wb35Tx_EP2VM_start(priv);
 
                                return true;
                        }
@@ -375,92 +369,6 @@ void hal_halt(phw_data_t pHwData, void *ppa_data)
        }
 }
 
-//---------------------------------------------------------------------------------------------------
-void hal_set_rates(phw_data_t pHwData, u8 *pbss_rates,
-                  u8 length, unsigned char basic_rate_set)
-{
-       struct wb35_reg *reg = &pHwData->reg;
-       u32             tmp, tmp1;
-       u8              Rate[12]={ 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 };
-       u8              SupportedRate[16];
-       u8              i, j, k, Count1, Count2, Byte;
-
-       if( pHwData->SurpriseRemove ) return;
-
-       if (basic_rate_set) {
-               reg->M28_MacControl &= ~0x000fff00;
-               tmp1 = 0x00000100;
-       } else {
-               reg->M28_MacControl &= ~0xfff00000;
-               tmp1 = 0x00100000;
-       }
-
-       tmp = 0;
-       for (i=0; i<length; i++) {
-               Byte = pbss_rates[i] & 0x7f;
-               for (j=0; j<12; j++) {
-                       if( Byte == Rate[j] )
-                               break;
-               }
-
-               if (j < 12)
-                       tmp |= (tmp1<<j);
-       }
-
-       reg->M28_MacControl |= tmp;
-       Wb35Reg_Write( pHwData, 0x0828, reg->M28_MacControl );
-
-       // 930206.2.c M78 setting
-       j = k = Count1 = Count2 = 0;
-       memset( SupportedRate, 0, 16 );
-       tmp = 0x00100000;
-       tmp1 = 0x00000100;
-       for (i=0; i<12; i++) { // Get the supported rate
-               if (tmp & reg->M28_MacControl) {
-                       SupportedRate[j] = Rate[i];
-
-                       if (tmp1 & reg->M28_MacControl)
-                               SupportedRate[j] |= 0x80;
-
-                       if (k)
-                               Count2++;
-                       else
-                               Count1++;
-
-                       j++;
-               }
-
-               if (i==4 && k==0) {
-                       if( !(reg->M28_MacControl & 0x000ff000) ) // if basic rate in 11g domain)
-                       {
-                               k = 1;
-                               j = 8;
-                       }
-               }
-
-               tmp <<= 1;
-               tmp1 <<= 1;
-       }
-
-       // Fill data into support rate until buffer full
-       //---20060926 add by anson's endian
-       for (i=0; i<4; i++)
-               *(u32 *)(SupportedRate+(i<<2)) = cpu_to_le32( *(u32 *)(SupportedRate+(i<<2)) );
-       //--- end 20060926 add by anson's endian
-       Wb35Reg_BurstWrite( pHwData,0x087c, (u32 *)SupportedRate, 4, AUTO_INCREMENT );
-       reg->M7C_MacControl = ((u32 *)SupportedRate)[0];
-       reg->M80_MacControl = ((u32 *)SupportedRate)[1];
-       reg->M84_MacControl = ((u32 *)SupportedRate)[2];
-       reg->M88_MacControl = ((u32 *)SupportedRate)[3];
-
-       // Fill length
-       tmp = Count1<<28 | Count2<<24;
-       reg->M78_ERPInformation &= ~0xff000000;
-       reg->M78_ERPInformation |= tmp;
-       Wb35Reg_Write( pHwData, 0x0878, reg->M78_ERPInformation );
-}
-
-
 //---------------------------------------------------------------------------------------------------
 void hal_set_beacon_period(  phw_data_t pHwData,  u16 beacon_period )
 {
@@ -475,7 +383,7 @@ void hal_set_beacon_period(  phw_data_t pHwData,  u16 beacon_period )
 }
 
 
-void hal_set_current_channel_ex(  phw_data_t pHwData,  ChanInfo channel )
+static void hal_set_current_channel_ex(  phw_data_t pHwData,  ChanInfo channel )
 {
        struct wb35_reg *reg = &pHwData->reg;
 
@@ -501,12 +409,6 @@ void hal_set_current_channel(  phw_data_t pHwData,  ChanInfo channel )
        hal_set_current_channel_ex( pHwData, channel );
 }
 //---------------------------------------------------------------------------------------------------
-void hal_get_current_channel(  phw_data_t pHwData,  ChanInfo *channel )
-{
-       channel->ChanNo = pHwData->Channel;
-       channel->band = pHwData->band;
-}
-//---------------------------------------------------------------------------------------------------
 void hal_set_accept_broadcast(  phw_data_t pHwData,  u8 enable )
 {
        struct wb35_reg *reg = &pHwData->reg;
@@ -564,46 +466,6 @@ void hal_set_accept_beacon(  phw_data_t pHwData,  u8 enable )
        Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
 }
 //---------------------------------------------------------------------------------------------------
-void hal_set_multicast_address( phw_data_t pHwData, u8 *address, u8 number )
-{
-       struct wb35_reg *reg = &pHwData->reg;
-       u8              Byte, Bit;
-
-       if( pHwData->SurpriseRemove ) return;
-
-       //Erases and refills the card multicast registers. Used when an address
-       //    has been deleted and all bits must be recomputed.
-       reg->M04_MulticastAddress1 = 0;
-       reg->M08_MulticastAddress2 = 0;
-
-       while( number )
-       {
-               number--;
-               CardGetMulticastBit( (address+(number*ETH_LENGTH_OF_ADDRESS)), &Byte, &Bit);
-               reg->Multicast[Byte] |= Bit;
-       }
-
-       // Updating register
-       Wb35Reg_BurstWrite( pHwData, 0x0804, (u32 *)reg->Multicast, 2, AUTO_INCREMENT );
-}
-//---------------------------------------------------------------------------------------------------
-u8 hal_get_accept_beacon(  phw_data_t pHwData )
-{
-       struct wb35_reg *reg = &pHwData->reg;
-
-       if( pHwData->SurpriseRemove ) return 0;
-
-       if( reg->M00_MacControl & 0x04000000 )
-               return 1;
-       else
-               return 0;
-}
-
-unsigned char hal_reset_hardware( phw_data_t pHwData, void* ppa )
-{
-       // Not implement yet
-       return true;
-}
 
 void hal_stop(  phw_data_t pHwData )
 {
@@ -630,115 +492,11 @@ unsigned char hal_idle(phw_data_t pHwData)
        return true;
 }
 //---------------------------------------------------------------------------------------------------
-void hal_set_cwmin(  phw_data_t pHwData,  u8   cwin_min )
-{
-       struct wb35_reg *reg = &pHwData->reg;
-
-       if( pHwData->SurpriseRemove ) return;
-
-       pHwData->cwmin = cwin_min;
-       reg->M2C_MacControl &= ~0x7c00; //bit 10 ~ 14
-       reg->M2C_MacControl |= (pHwData->cwmin<<10);
-       Wb35Reg_Write( pHwData, 0x082c, reg->M2C_MacControl );
-}
-
-s32 hal_get_rssi(  phw_data_t pHwData,  u32 *HalRssiArry,  u8 Count )
-{
-       struct wb35_reg *reg = &pHwData->reg;
-       R01_DESCRIPTOR  r01;
-       s32 ltmp = 0, tmp;
-       u8      i;
-
-       if( pHwData->SurpriseRemove ) return -200;
-       if( Count > MAX_ACC_RSSI_COUNT ) // Because the TS may use this funtion
-               Count = MAX_ACC_RSSI_COUNT;
-
-       // RSSI = C1 + C2 * (agc_state[7:0] + offset_map(lna_state[1:0]))
-       // C1 = -195, C2 = 0.66 = 85/128
-       for (i=0; i<Count; i++)
-       {
-               r01.value = HalRssiArry[i];
-               tmp = ((( r01.R01_AGC_state + reg->LNAValue[r01.R01_LNA_state]) * 85 ) >>7 ) - 195;
-               ltmp += tmp;
-       }
-       ltmp /= Count;
-       if( pHwData->phy_type == RF_AIROHA_2230 ) ltmp -= 5; // 10;
-       if( pHwData->phy_type == RF_AIROHA_2230S ) ltmp -= 5; // 10; 20060420 Add this
-
-       //if( ltmp < -200 ) ltmp = -200;
-       if( ltmp < -110 ) ltmp = -110;// 1.0.24.0 For NJRC
-
-       return ltmp;
-}
-//----------------------------------------------------------------------------------------------------
-s32 hal_get_rssi_bss(struct wbsoft_priv *adapter,  u16 idx,  u8 Count)
-{
-       phw_data_t pHwData = &adapter->sHwData;
-       struct wb35_reg *reg = &pHwData->reg;
-       R01_DESCRIPTOR  r01;
-       s32 ltmp = 0, tmp;
-       u8      i, j;
-//     u32 *HalRssiArry = psBSS(idx)->HalRssi;
-
-       if( pHwData->SurpriseRemove ) return -200;
-       if( Count > MAX_ACC_RSSI_COUNT ) // Because the TS may use this funtion
-               Count = MAX_ACC_RSSI_COUNT;
-
-       // RSSI = C1 + C2 * (agc_state[7:0] + offset_map(lna_state[1:0]))
-       // C1 = -195, C2 = 0.66 = 85/128
-#if 0
-       for (i=0; i<Count; i++)
-       {
-               r01.value = HalRssiArry[i];
-               tmp = ((( r01.R01_AGC_state + reg->LNAValue[r01.R01_LNA_state]) * 85 ) >>7 ) - 195;
-               ltmp += tmp;
-       }
-#else
-       if (psBSS(idx)->HalRssiIndex == 0)
-               psBSS(idx)->HalRssiIndex = MAX_ACC_RSSI_COUNT;
-       j = (u8)psBSS(idx)->HalRssiIndex-1;
-
-       for (i=0; i<Count; i++)
-       {
-               r01.value = psBSS(idx)->HalRssi[j];
-               tmp = ((( r01.R01_AGC_state + reg->LNAValue[r01.R01_LNA_state]) * 85 ) >>7 ) - 195;
-               ltmp += tmp;
-               if (j == 0)
-               {
-                       j = MAX_ACC_RSSI_COUNT;
-               }
-               j--;
-       }
-#endif
-       ltmp /= Count;
-       if( pHwData->phy_type == RF_AIROHA_2230 ) ltmp -= 5; // 10;
-       if( pHwData->phy_type == RF_AIROHA_2230S ) ltmp -= 5; // 10; 20060420 Add this
-
-       //if( ltmp < -200 ) ltmp = -200;
-       if( ltmp < -110 ) ltmp = -110;// 1.0.24.0 For NJRC
-
-       return ltmp;
-}
-
-//---------------------------------------------------------------------------
-
 void hal_set_phy_type(  phw_data_t pHwData,  u8 PhyType )
 {
        pHwData->phy_type = PhyType;
 }
 
-void hal_get_phy_type(  phw_data_t pHwData,  u8 *PhyType )
-{
-       *PhyType = pHwData->phy_type;
-}
-
-void hal_reset_counter(  phw_data_t pHwData )
-{
-       pHwData->dto_tx_retry_count = 0;
-       pHwData->dto_tx_frag_count = 0;
-       memset( pHwData->tx_retry_count, 0, 8);
-}
-
 void hal_set_radio_mode( phw_data_t pHwData,  unsigned char radio_off)
 {
        struct wb35_reg *reg = &pHwData->reg;
@@ -768,22 +526,6 @@ u8 hal_get_antenna_number(  phw_data_t pHwData )
                return 1;
 }
 
-void hal_set_antenna_number(  phw_data_t pHwData, u8 number )
-{
-
-       struct wb35_reg *reg = &pHwData->reg;
-
-       if (number == 1) {
-               reg->BB2C |= BIT(11);
-       } else {
-               reg->BB2C &= ~BIT(11);
-       }
-       Wb35Reg_Write( pHwData, 0x102c, reg->BB2C );
-#ifdef _PE_STATE_DUMP_
-       WBDEBUG(("Current antenna number : %d\n", number));
-#endif
-}
-
 //----------------------------------------------------------------------------------------------------
 //0 : radio on; 1: radio off
 u8 hal_get_hw_radio_off(  phw_data_t pHwData )
@@ -820,58 +562,7 @@ unsigned char hal_set_dxx_reg(  phw_data_t pHwData,  u16 number,  u32 value )
        return ret;
 }
 
-void hal_scan_status_indicate(phw_data_t pHwData, unsigned char IsOnProgress)
-{
-       if( pHwData->SurpriseRemove ) return;
-       pHwData->LED_Scanning = IsOnProgress ? 1 : 0;
-}
-
-void hal_system_power_change(phw_data_t pHwData, u32 PowerState)
-{
-       if( PowerState != 0 )
-       {
-               pHwData->SurpriseRemove = 1;
-               if( pHwData->WbUsb.IsUsb20 )
-                       hal_stop( pHwData );
-       }
-       else
-       {
-               if( !pHwData->WbUsb.IsUsb20 )
-                       hal_stop( pHwData );
-       }
-}
-
-void hal_surprise_remove(struct wbsoft_priv *adapter)
-{
-       phw_data_t pHwData = &adapter->sHwData;
-
-       if (atomic_inc_return( &pHwData->SurpriseRemoveCount ) == 1) {
-               #ifdef _PE_STATE_DUMP_
-               WBDEBUG(("Calling hal_surprise_remove\n"));
-               #endif
-               WBLINUX_stop( adapter );
-       }
-}
-
-void hal_rate_change(struct wbsoft_priv *adapter) // Notify the HAL rate is changing 20060613.1
-{
-       phw_data_t pHwData = &adapter->sHwData;
-       u8              rate = CURRENT_TX_RATE;
-
-       BBProcessor_RateChanging( pHwData, rate );
-}
-
 void hal_set_rf_power(phw_data_t pHwData, u8 PowerIndex)
 {
        RFSynthesizer_SetPowerIndex( pHwData, PowerIndex );
 }
-
-unsigned char hal_set_LED(phw_data_t pHwData, u32 Mode) // 20061108 for WPS led control
-{
-       pHwData->LED_Blinking = 0;
-       pHwData->LED_control = Mode;
-       pHwData->LEDTimer.expires = jiffies + msecs_to_jiffies(10);
-       add_timer(&pHwData->LEDTimer);
-       return true;
-}
-