Commit 606661ea authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: rt2870: add Antenna Diversity support

rt3070:
* remove non-working AntDiversity config parameter
* remove unused bRxAntDiversity field from COMMON_CONFIG

rt2870:
* propagate Antenna Diversity support from rt3070
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5cc86f28
...@@ -181,14 +181,11 @@ USHORT RTMP_EEPROM_READ16( ...@@ -181,14 +181,11 @@ USHORT RTMP_EEPROM_READ16(
UINT32 x; UINT32 x;
USHORT data; USHORT data;
#ifdef RT30xx #ifdef RT2870
if (pAd->NicConfig2.field.AntDiversity) if (pAd->NicConfig2.field.AntDiversity)
{ {
pAd->EepromAccess = TRUE; pAd->EepromAccess = TRUE;
} }
//2008/09/11:KH add to support efuse<--
//2008/09/11:KH add to support efuse-->
{
#endif #endif
Offset /= 2; Offset /= 2;
// reset bits and set EECS // reset bits and set EECS
...@@ -214,7 +211,7 @@ USHORT RTMP_EEPROM_READ16( ...@@ -214,7 +211,7 @@ USHORT RTMP_EEPROM_READ16(
EEpromCleanup(pAd); EEpromCleanup(pAd);
#ifdef RT30xx #ifdef RT2870
// Antenna and EEPROM access are both using EESK pin, // Antenna and EEPROM access are both using EESK pin,
// Therefor we should avoid accessing EESK at the same time // Therefor we should avoid accessing EESK at the same time
// Then restore antenna after EEPROM access // Then restore antenna after EEPROM access
...@@ -223,7 +220,6 @@ USHORT RTMP_EEPROM_READ16( ...@@ -223,7 +220,6 @@ USHORT RTMP_EEPROM_READ16(
pAd->EepromAccess = FALSE; pAd->EepromAccess = FALSE;
AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
} }
}
#endif #endif
return data; return data;
} //ReadEEprom } //ReadEEprom
...@@ -235,14 +231,11 @@ VOID RTMP_EEPROM_WRITE16( ...@@ -235,14 +231,11 @@ VOID RTMP_EEPROM_WRITE16(
{ {
UINT32 x; UINT32 x;
#ifdef RT30xx #ifdef RT2870
if (pAd->NicConfig2.field.AntDiversity) if (pAd->NicConfig2.field.AntDiversity)
{ {
pAd->EepromAccess = TRUE; pAd->EepromAccess = TRUE;
} }
//2008/09/11:KH add to support efuse<--
//2008/09/11:KH add to support efuse-->
{
#endif #endif
Offset /= 2; Offset /= 2;
...@@ -278,7 +271,7 @@ VOID RTMP_EEPROM_WRITE16( ...@@ -278,7 +271,7 @@ VOID RTMP_EEPROM_WRITE16(
EEpromCleanup(pAd); EEpromCleanup(pAd);
#ifdef RT30xx #ifdef RT2870
// Antenna and EEPROM access are both using EESK pin, // Antenna and EEPROM access are both using EESK pin,
// Therefor we should avoid accessing EESK at the same time // Therefor we should avoid accessing EESK at the same time
// Then restore antenna after EEPROM access // Then restore antenna after EEPROM access
...@@ -287,7 +280,6 @@ VOID RTMP_EEPROM_WRITE16( ...@@ -287,7 +280,6 @@ VOID RTMP_EEPROM_WRITE16(
pAd->EepromAccess = FALSE; pAd->EepromAccess = FALSE;
AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt); AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
} }
}
#endif #endif
} }
......
...@@ -8004,7 +8004,7 @@ CHAR RTMPMaxRssi( ...@@ -8004,7 +8004,7 @@ CHAR RTMPMaxRssi(
return larger; return larger;
} }
#ifdef RT30xx #ifdef RT2870
// Antenna divesity use GPIO3 and EESK pin for control // Antenna divesity use GPIO3 and EESK pin for control
// Antenna and EEPROM access are both using EESK pin, // Antenna and EEPROM access are both using EESK pin,
// Therefor we should avoid accessing EESK at the same time // Therefor we should avoid accessing EESK at the same time
...@@ -8052,7 +8052,7 @@ VOID AsicSetRxAnt( ...@@ -8052,7 +8052,7 @@ VOID AsicSetRxAnt(
DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n")); DBGPRINT_RAW(RT_DEBUG_TRACE, ("AsicSetRxAnt, switch to aux antenna\n"));
} }
} }
#endif /* RT30xx */ #endif
/* /*
======================================================================== ========================================================================
...@@ -8078,7 +8078,7 @@ VOID AsicEvaluateRxAnt( ...@@ -8078,7 +8078,7 @@ VOID AsicEvaluateRxAnt(
fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_NIC_NOT_EXIST |
fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS) fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)
|| OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)
#ifdef RT30xx #ifdef RT2870
|| (pAd->EepromAccess) || (pAd->EepromAccess)
#endif #endif
) )
...@@ -8182,9 +8182,9 @@ VOID AsicRxAntEvalTimeout( ...@@ -8182,9 +8182,9 @@ VOID AsicRxAntEvalTimeout(
fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_RADIO_OFF |
fRTMP_ADAPTER_NIC_NOT_EXIST) fRTMP_ADAPTER_NIC_NOT_EXIST)
|| OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) || OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE)
#ifdef RT30xx #ifdef RT2870
|| (pAd->EepromAccess) || (pAd->EepromAccess)
#endif // RT30xx // #endif
) )
return; return;
......
...@@ -3416,7 +3416,7 @@ VOID UserCfgInit( ...@@ -3416,7 +3416,7 @@ VOID UserCfgInit(
} }
} }
#ifdef RT30xx #ifdef RT2870
pAd->EepromAccess = FALSE; pAd->EepromAccess = FALSE;
#endif #endif
pAd->Antenna.word = 0; pAd->Antenna.word = 0;
......
...@@ -1429,23 +1429,6 @@ NDIS_STATUS RTMPReadParametersHook( ...@@ -1429,23 +1429,6 @@ NDIS_STATUS RTMPReadParametersHook(
DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest)); DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest));
} }
} }
#ifdef RT30xx
{
if(RTMPGetKeyParameter("AntDiversity", tmpbuf, 10, buffer))
{
for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++)
{
if(simple_strtol(macptr, 0, 10) != 0) //Enable
pAd->CommonCfg.bRxAntDiversity = TRUE;
else //Disable
pAd->CommonCfg.bRxAntDiversity = FALSE;
DBGPRINT(RT_DEBUG_ERROR, ("AntDiversity=%d\n", pAd->CommonCfg.bRxAntDiversity));
}
}
}
#endif // RT30xx //
} }
} }
else else
......
...@@ -1295,7 +1295,7 @@ typedef struct _BBP_TUNING_STRUCT { ...@@ -1295,7 +1295,7 @@ typedef struct _BBP_TUNING_STRUCT {
typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT { typedef struct _SOFT_RX_ANT_DIVERSITY_STRUCT {
UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status UCHAR EvaluatePeriod; // 0:not evalute status, 1: evaluate status, 2: switching status
#ifdef RT30xx #ifdef RT2870
UCHAR EvaluateStableCnt; UCHAR EvaluateStableCnt;
#endif #endif
UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2 UCHAR Pair1PrimaryRxAnt; // 0:Ant-E1, 1:Ant-E2
...@@ -1899,9 +1899,6 @@ typedef struct _COMMON_CONFIG { ...@@ -1899,9 +1899,6 @@ typedef struct _COMMON_CONFIG {
BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. BOOLEAN NdisRadioStateOff; //For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff.
ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode. ABGBAND_STATE BandState; // For setting BBP used on B/G or A mode.
#ifdef RT30xx
BOOLEAN bRxAntDiversity; // 0:disable, 1:enable Software Rx Antenna Diversity.
#endif
// IEEE802.11H--DFS. // IEEE802.11H--DFS.
RADAR_DETECT_STRUCT RadarDetect; RADAR_DETECT_STRUCT RadarDetect;
...@@ -2667,7 +2664,7 @@ typedef struct _RTMP_ADAPTER ...@@ -2667,7 +2664,7 @@ typedef struct _RTMP_ADAPTER
ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused ULONG EepromVersion; // byte 0: version, byte 1: revision, byte 2~3: unused
UCHAR EEPROMAddressNum; // 93c46=6 93c66=8 UCHAR EEPROMAddressNum; // 93c46=6 93c66=8
USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS]; USHORT EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
#ifdef RT30xx #ifdef RT2870
BOOLEAN EepromAccess; BOOLEAN EepromAccess;
#endif #endif
ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused. ULONG FirmwareVersion; // byte 0: Minor version, byte 1: Major version, otherwise unused.
......
...@@ -575,10 +575,7 @@ VOID STAHandleRxMgmtFrame( ...@@ -575,10 +575,7 @@ VOID STAHandleRxMgmtFrame(
{ {
// We should collect RSSI not only U2M data but also my beacon // We should collect RSSI not only U2M data but also my beacon
if ( if (pAd->RxAnt.EvaluatePeriod == 0 &&
#ifdef RT30xx
pAd->RxAnt.EvaluatePeriod == 0 &&
#endif
pHeader->FC.SubType == SUBTYPE_BEACON && pHeader->FC.SubType == SUBTYPE_BEACON &&
MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) { MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)) {
Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI); Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI);
...@@ -587,7 +584,7 @@ VOID STAHandleRxMgmtFrame( ...@@ -587,7 +584,7 @@ VOID STAHandleRxMgmtFrame(
pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1); pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1);
} }
#ifdef RT30xx #ifdef RT2870
// collect rssi information for antenna diversity // collect rssi information for antenna diversity
if (pAd->NicConfig2.field.AntDiversity) if (pAd->NicConfig2.field.AntDiversity)
{ {
...@@ -597,7 +594,7 @@ VOID STAHandleRxMgmtFrame( ...@@ -597,7 +594,7 @@ VOID STAHandleRxMgmtFrame(
pAd->StaCfg.NumOfAvgRssiSample ++; pAd->StaCfg.NumOfAvgRssiSample ++;
} }
} }
#endif // RT30xx // #endif
// First check the size, it MUST not exceed the mlme queue size // First check the size, it MUST not exceed the mlme queue size
if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE) if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment