Staging: rt2870: prepare for rt{28,30}70/common/*.[ch] merge

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2009-04-26 16:06:22 +02:00 committed by Greg Kroah-Hartman
parent 9e4dab715b
commit ffbc7b854e
13 changed files with 2926 additions and 31 deletions

View File

@ -639,7 +639,7 @@ VOID RTMPFreeTxRxRingMemory(
// Free Tx frame resource
for (acidx = 0; acidx < 4; acidx++)
for(acidx=0; acidx<4; acidx++)
{
PHT_TX_CONTEXT pHTTXContext = &(pAd->TxContext[acidx]);
if (pHTTXContext)
@ -699,9 +699,14 @@ NDIS_STATUS AdapterBlockAllocateMemory(
usb_dev = pObj->pUsb_Dev;
#ifndef RT30xx
pObj->MLMEThr_task = NULL;
pObj->RTUSBCmdThr_task = NULL;
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = NULL;
pObj->RTUSBCmdThr_pid = NULL;
#endif
*ppAd = (PVOID)vmalloc(sizeof(RTMP_ADAPTER));
if (*ppAd)
@ -737,7 +742,12 @@ NDIS_STATUS CreateThreads(
{
PRTMP_ADAPTER pAd = net_dev->ml_priv;
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
#ifndef RT30xx
struct task_struct *tsk;
#endif
#ifdef RT30xx
pid_t pid_number;
#endif
//init_MUTEX(&(pAd->usbdev_semaphore));
@ -751,39 +761,76 @@ NDIS_STATUS CreateThreads(
init_completion (&pAd->TimerQComplete);
// Creat MLME Thread
#ifndef RT30xx
pObj->MLMEThr_task = NULL;
tsk = kthread_run(MlmeThread, pAd, pAd->net_dev->name);
if (IS_ERR(tsk)) {
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = NULL;
pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM);
if (pid_number < 0)
{
#endif
printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name);
return NDIS_STATUS_FAILURE;
}
#ifndef RT30xx
pObj->MLMEThr_task = tsk;
#endif
#ifdef RT30xx
pObj->MLMEThr_pid = find_get_pid(pid_number);
#endif
// Wait for the thread to start
wait_for_completion(&(pAd->mlmeComplete));
// Creat Command Thread
#ifndef RT30xx
pObj->RTUSBCmdThr_task = NULL;
tsk = kthread_run(RTUSBCmdThread, pAd, pAd->net_dev->name);
if (IS_ERR(tsk) < 0)
#endif
#ifdef RT30xx
pObj->RTUSBCmdThr_pid = NULL;
pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM);
if (pid_number < 0)
#endif
{
printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name);
return NDIS_STATUS_FAILURE;
}
#ifndef RT30xx
pObj->RTUSBCmdThr_task = tsk;
#endif
#ifdef RT30xx
pObj->RTUSBCmdThr_pid = find_get_pid(pid_number);
#endif
wait_for_completion(&(pAd->CmdQComplete));
#ifndef RT30xx
pObj->TimerQThr_task = NULL;
tsk = kthread_run(TimerQThread, pAd, pAd->net_dev->name);
if (IS_ERR(tsk) < 0)
#endif
#ifdef RT30xx
pObj->TimerQThr_pid = NULL;
pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM);
if (pid_number < 0)
#endif
{
printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name);
return NDIS_STATUS_FAILURE;
}
#ifndef RT30xx
pObj->TimerQThr_task = tsk;
#endif
#ifdef RT30xx
pObj->TimerQThr_pid = find_get_pid(pid_number);
#endif
// Wait for the thread to start
wait_for_completion(&(pAd->TimerQComplete));
@ -1260,9 +1307,9 @@ static void rt2870_hcca_dma_done_tasklet(unsigned long data)
UCHAR BulkOutPipeId = 4;
purbb_t pUrb;
#ifndef RT30xx
DBGPRINT_RAW(RT_DEBUG_ERROR, ("--->hcca_dma_done_tasklet\n"));
#endif
pUrb = (purbb_t)data;
pHTTXContext = (PHT_TX_CONTEXT)pUrb->context;
@ -1292,13 +1339,19 @@ static void rt2870_hcca_dma_done_tasklet(unsigned long data)
RTMPDeQueuePacket(pAd, FALSE, BulkOutPipeId, MAX_TX_PROCESS);
}
#ifndef RT30xx
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL);
#endif
#ifdef RT30xx
RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL<<4);
#endif
RTUSBKickBulkOut(pAd);
}
}
#ifndef RT30xx
DBGPRINT_RAW(RT_DEBUG_ERROR, ("<---hcca_dma_done_tasklet\n"));
#endif
return;
}

View File

@ -533,7 +533,12 @@ VOID SendRefreshBAR(
if (1) // Now we always send BAR.
{
#ifndef RT30xx
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
#endif
#ifdef RT30xx
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
#endif
}
MlmeFreeMemory(pAd, pOutBuffer);
}

View File

@ -532,6 +532,13 @@ VOID BAOriSessionSetUp(
pBAEntry->TimeOutValue = TimeOut;
pBAEntry->pAdapter = pAd;
#ifdef RT30xx
DBGPRINT(RT_DEBUG_TRACE,("Send AddBA to %02x:%02x:%02x:%02x:%02x:%02x Tid:%d isForced:%d Wcid:%d\n"
,pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2]
,pEntry->Addr[3],pEntry->Addr[4],pEntry->Addr[5]
,TID,isForced,pEntry->Aid));
#endif
if (!(pEntry->TXBAbitmap & (1<<TID)))
{
RTMPInitTimer(pAd, &pBAEntry->ORIBATimer, GET_TIMER_FUNCTION(BAOriSessionSetupTimeout), pBAEntry, FALSE);
@ -1072,8 +1079,16 @@ VOID BAOriSessionSetupTimeout(
AddbaReq.Token = pBAEntry->Token;
MlmeEnqueue(pAd, ACTION_STATE_MACHINE, MT2_MLME_ADD_BA_CATE, sizeof(MLME_ADDBA_REQ_STRUCT), (PVOID)&AddbaReq);
RT28XX_MLME_HANDLER(pAd);
#ifndef RT30xx
DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) : Send ADD BA again\n", pBAEntry->Token));
#endif
#ifdef RT30xx
DBGPRINT(RT_DEBUG_TRACE,("BA Ori Session Timeout(%d) to %02x:%02x:%02x:%02x:%02x:%02x Tid:%d Wcid:%d\n"
,pBAEntry->Token
,pEntry->Addr[0],pEntry->Addr[1],pEntry->Addr[2]
,pEntry->Addr[3],pEntry->Addr[4],pEntry->Addr[5]
,pBAEntry->TID,pEntry->Aid));
#endif
pBAEntry->Token++;
RTMPSetTimer(&pBAEntry->ORIBATimer, ORI_BA_SESSION_TIMEOUT);
}
@ -1377,6 +1392,10 @@ VOID SendPSMPAction(
//ULONG Idx;
FRAME_PSMP_ACTION Frame;
ULONG FrameLen;
#ifdef RT30xx
UCHAR bbpdata=0;
UINT32 macdata;
#endif // RT30xx //
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
if (NStatus != NDIS_STATUS_SUCCESS)
@ -1392,12 +1411,54 @@ VOID SendPSMPAction(
switch (Psmp)
{
case MMPS_ENABLE:
#ifdef RT30xx
if (IS_RT3090(pAd))
{
// disable MMPS BBP control register
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &bbpdata);
bbpdata &= ~(0x04); //bit 2
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, bbpdata);
// disable MMPS MAC control register
RTMP_IO_READ32(pAd, 0x1210, &macdata);
macdata &= ~(0x09); //bit 0, 3
RTMP_IO_WRITE32(pAd, 0x1210, macdata);
}
#endif // RT30xx //
Frame.Psmp = 0;
break;
case MMPS_DYNAMIC:
#ifdef RT30xx
if (IS_RT3090(pAd))
{
// enable MMPS BBP control register
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &bbpdata);
bbpdata |= 0x04; //bit 2
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, bbpdata);
// enable MMPS MAC control register
RTMP_IO_READ32(pAd, 0x1210, &macdata);
macdata |= 0x09; //bit 0, 3
RTMP_IO_WRITE32(pAd, 0x1210, macdata);
}
#endif // RT30xx //
Frame.Psmp = 3;
break;
case MMPS_STATIC:
#ifdef RT30xx
if (IS_RT3090(pAd))
{
// enable MMPS BBP control register
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &bbpdata);
bbpdata |= 0x04; //bit 2
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, bbpdata);
// enable MMPS MAC control register
RTMP_IO_READ32(pAd, 0x1210, &macdata);
macdata |= 0x09; //bit 0, 3
RTMP_IO_WRITE32(pAd, 0x1210, macdata);
}
#endif // RT30xx //
Frame.Psmp = 1;
break;
}

View File

@ -172,7 +172,114 @@ NDIS_STATUS MiniportMMRequest(
return Status;
}
#ifdef RT30xx
NDIS_STATUS MlmeDataHardTransmit(
IN PRTMP_ADAPTER pAd,
IN UCHAR QueIdx,
IN PNDIS_PACKET pPacket);
#define MAX_DATAMM_RETRY 3
/*
========================================================================
Routine Description:
API for MLME to transmit management frame to AP (BSS Mode)
or station (IBSS Mode)
Arguments:
pAd Pointer to our adapter
pData Pointer to the outgoing 802.11 frame
Length Size of outgoing management frame
Return Value:
NDIS_STATUS_FAILURE
NDIS_STATUS_PENDING
NDIS_STATUS_SUCCESS
IRQL = PASSIVE_LEVEL
IRQL = DISPATCH_LEVEL
Note:
========================================================================
*/
NDIS_STATUS MiniportDataMMRequest(
IN PRTMP_ADAPTER pAd,
IN UCHAR QueIdx,
IN PUCHAR pData,
IN UINT Length)
{
PNDIS_PACKET pPacket;
NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
ULONG FreeNum;
int retry = 0;
UCHAR IrqState;
UCHAR rtmpHwHdr[TXINFO_SIZE + TXWI_SIZE]; //RTMP_HW_HDR_LEN];
ASSERT(Length <= MGMT_DMA_BUFFER_SIZE);
// 2860C use Tx Ring
IrqState = pAd->irq_disabled;
do
{
// Reset is in progress, stop immediately
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS) ||
RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST)||
!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_START_UP))
{
Status = NDIS_STATUS_FAILURE;
break;
}
// Check Free priority queue
// Since we use PBF Queue2 for management frame. Its corresponding DMA ring should be using TxRing.
// 2860C use Tx Ring
// free Tx(QueIdx) resources
FreeNum = GET_TXRING_FREENO(pAd, QueIdx);
if ((FreeNum > 0))
{
// We need to reserve space for rtmp hardware header. i.e., TxWI for RT2860 and TxInfo+TxWI for RT2870
NdisZeroMemory(&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE));
Status = RTMPAllocateNdisPacket(pAd, &pPacket, (PUCHAR)&rtmpHwHdr, (TXINFO_SIZE + TXWI_SIZE), pData, Length);
if (Status != NDIS_STATUS_SUCCESS)
{
DBGPRINT(RT_DEBUG_WARN, ("MiniportMMRequest (error:: can't allocate NDIS PACKET)\n"));
break;
}
//pAd->CommonCfg.MlmeTransmit.field.MODE = MODE_CCK;
//pAd->CommonCfg.MlmeRate = RATE_2;
Status = MlmeDataHardTransmit(pAd, QueIdx, pPacket);
if (Status != NDIS_STATUS_SUCCESS)
RTMPFreeNdisPacket(pAd, pPacket);
retry = MAX_DATAMM_RETRY;
}
else
{
retry ++;
printk("retry %d\n", retry);
pAd->RalinkCounters.MgmtRingFullCount++;
if (retry >= MAX_DATAMM_RETRY)
{
DBGPRINT(RT_DEBUG_ERROR, ("Qidx(%d), not enough space in DataRing, MgmtRingFullCount=%ld!\n",
QueIdx, pAd->RalinkCounters.MgmtRingFullCount));
}
}
} while (retry < MAX_DATAMM_RETRY);
return Status;
}
#endif /* RT30xx */
/*
@ -214,7 +321,23 @@ NDIS_STATUS MlmeHardTransmit(
}
#ifdef RT30xx
NDIS_STATUS MlmeDataHardTransmit(
IN PRTMP_ADAPTER pAd,
IN UCHAR QueIdx,
IN PNDIS_PACKET pPacket)
{
if ((pAd->CommonCfg.RadarDetect.RDMode != RD_NORMAL_MODE)
)
{
return NDIS_STATUS_FAILURE;
}
#ifdef RT2870
return MlmeHardTransmitMgmtRing(pAd,QueIdx,pPacket);
#endif // RT2870 //
}
#endif /* RT30xx */
NDIS_STATUS MlmeHardTransmitMgmtRing(
IN PRTMP_ADAPTER pAd,
@ -614,6 +737,11 @@ BOOLEAN RTMP_FillTxBlkInfo(
}
return TRUE;
#ifdef RT30xx
FillTxBlkErr:
return FALSE;
#endif
}
@ -701,6 +829,7 @@ VOID RTMPDeQueuePacket(
if (QIdx == NUM_OF_TX_RING)
{
sQIdx = 0;
//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
eQIdx = 3; // 4 ACs, start from 0.
}
else
@ -1413,7 +1542,15 @@ VOID RTMPResumeMsduTransmission(
{
DBGPRINT(RT_DEBUG_TRACE,("SCAN done, resume MSDU transmission ...\n"));
#ifdef RT30xx
// After finish BSS_SCAN_IN_PROGRESS, we need to restore Current R66 value
// R66 should not be 0
if (pAd->BbpTuning.R66CurrentValue == 0)
{
pAd->BbpTuning.R66CurrentValue = 0x38;
DBGPRINT_ERR(("RTMPResumeMsduTransmission, R66CurrentValue=0...\n"));
}
#endif
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R66, pAd->BbpTuning.R66CurrentValue);
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS);
@ -1774,7 +1911,12 @@ BOOLEAN MacTableDeleteEntry(
if (pAd->MacTab.Size == 0)
{
pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode = 0;
#ifndef RT30xx
AsicUpdateProtect(pAd, 0 /*pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode*/, (ALLN_SETPROTECT), TRUE, 0 /*pAd->MacTab.fAnyStationNonGF*/);
#endif
#ifdef RT30xx
RT28XX_UPDATE_PROTECT(pAd); // edit by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
#endif
}
return TRUE;

View File

@ -292,6 +292,7 @@ USHORT RtmpUSB_WriteSingleTxResource(
pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen);
// For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload
//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid*/, FALSE);
if ((pHTTXContext->CurWritePosition + 3906 + pTxBlk->Priv) > MAX_TXBULK_LIMIT)
@ -809,7 +810,12 @@ VOID RT28xxUsbStaAsicForceWakeup(
AutoWakeupCfg.word = 0;
RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word);
#ifndef RT30xx
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x00);
#endif
#ifdef RT30xx
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
#endif
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE);
}
@ -846,7 +852,12 @@ VOID RT28xxUsbMlmeRadioOn(
if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
return;
#ifndef RT30xx
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x00);
#endif
#ifdef RT30xx
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
#endif
RTMPusecDelay(10000);
NICResetFromError(pAd);
@ -854,6 +865,13 @@ VOID RT28xxUsbMlmeRadioOn(
// Enable Tx/Rx
RTMPEnableRxTx(pAd);
#ifdef RT3070
if (IS_RT3071(pAd))
{
RT30xxReverseRFSleepModeSetup(pAd);
}
#endif // RT3070 //
// Clear Radio off flag
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
@ -890,6 +908,7 @@ VOID RT28xxUsbMlmeRadioOFF(
BssTableInit(&pAd->ScanTab);
}
#ifndef RT30xx
// Disable MAC Tx/Rx
RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value);
Value &= (0xfffffff3);
@ -903,6 +922,7 @@ VOID RT28xxUsbMlmeRadioOFF(
// TX_PIN_CFG => value = 0x0 => 20mA
RTMP_IO_WRITE32(pAd, TX_PIN_CFG, 0);
#endif
if (pAd->CommonCfg.BBPCurrentBW == BW_40)
{
@ -915,6 +935,14 @@ VOID RT28xxUsbMlmeRadioOFF(
AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel);
}
#ifdef RT30xx
// Disable Tx/Rx DMA
RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA
GloCfg.field.EnableTxDMA = 0;
GloCfg.field.EnableRxDMA = 0;
RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings
#endif
// Waiting for DMA idle
i = 0;
do
@ -926,6 +954,13 @@ VOID RT28xxUsbMlmeRadioOFF(
RTMPusecDelay(1000);
}while (i++ < 100);
#ifdef RT30xx
// Disable MAC Tx/Rx
RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value);
Value &= (0xfffffff3);
RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value);
#endif
AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02);
}

View File

@ -1388,6 +1388,7 @@ VOID RTMPSetHT(
pAd->CommonCfg.DesiredHtPhy.RxSTBC = 0;
}
#ifndef RT30xx
#ifdef RT2870
/* Frank recommend ,If not, Tx maybe block in high power. Rx has no problem*/
if(IS_RT3070(pAd) && ((pAd->RfIcType == RFIC_3020) || (pAd->RfIcType == RFIC_2020)))
@ -1396,6 +1397,7 @@ VOID RTMPSetHT(
pAd->CommonCfg.DesiredHtPhy.TxSTBC = 0;
}
#endif // RT2870 //
#endif
if(pHTPhyMode->SHORTGI == GI_400)
{
@ -2454,13 +2456,26 @@ INT Set_HtAutoBa_Proc(
Value = simple_strtol(arg, 0, 10);
if (Value == 0)
{
pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
else if (Value == 1)
#ifdef RT30xx
pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
#endif
}
else if (Value == 1)
{
pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
#ifdef RT30xx
pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
#endif
}
else
return FALSE; //Invalid argument
pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
#ifdef RT30xx
pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
#endif
SetCommonHT(pAd);
DBGPRINT(RT_DEBUG_TRACE, ("Set_HtAutoBa_Proc::(HtAutoBa=%d)\n",pAd->CommonCfg.BACapability.field.AutoBA));
@ -2677,6 +2692,9 @@ PCHAR RTMPGetRalinkAuthModeStr(
{
case Ndis802_11AuthModeOpen:
return "OPEN";
#ifdef RT30xx
default:
#endif
case Ndis802_11AuthModeWPAPSK:
return "WPAPSK";
case Ndis802_11AuthModeShared:
@ -2691,10 +2709,12 @@ PCHAR RTMPGetRalinkAuthModeStr(
return "WPAPSKWPA2PSK";
case Ndis802_11AuthModeWPA1WPA2:
return "WPA1WPA2";
#ifndef RT30xx
case Ndis802_11AuthModeWPANone:
return "WPANONE";
default:
return "UNKNOW";
#endif
}
}
@ -2703,6 +2723,9 @@ PCHAR RTMPGetRalinkEncryModeStr(
{
switch(encryMode)
{
#ifdef RT30xx
default:
#endif
case Ndis802_11WEPDisabled:
return "NONE";
case Ndis802_11WEPEnabled:
@ -2713,8 +2736,10 @@ PCHAR RTMPGetRalinkEncryModeStr(
return "AES";
case Ndis802_11Encryption4Enabled:
return "TKIPAES";
#ifndef RT30xx
default:
return "UNKNOW";
#endif
}
}
@ -2739,7 +2764,12 @@ INT RTMPShowCfgValue(
{
sprintf(pBuf, "\n");
for (PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC = RTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name; PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC++)
#ifndef RT30xx
sprintf(pBuf + strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
#endif
#ifdef RT30xx
sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name);
#endif
}
return Status;

View File

@ -39,10 +39,14 @@
// WPA OUI
UCHAR OUI_WPA_NONE_AKM[4] = {0x00, 0x50, 0xF2, 0x00};
UCHAR OUI_WPA_VERSION[4] = {0x00, 0x50, 0xF2, 0x01};
#ifndef RT30xx
UCHAR OUI_WPA_WEP40[4] = {0x00, 0x50, 0xF2, 0x01};
#endif
UCHAR OUI_WPA_TKIP[4] = {0x00, 0x50, 0xF2, 0x02};
UCHAR OUI_WPA_CCMP[4] = {0x00, 0x50, 0xF2, 0x04};
#ifndef RT30xx
UCHAR OUI_WPA_WEP104[4] = {0x00, 0x50, 0xF2, 0x05};
#endif
UCHAR OUI_WPA_8021X_AKM[4] = {0x00, 0x50, 0xF2, 0x01};
UCHAR OUI_WPA_PSK_AKM[4] = {0x00, 0x50, 0xF2, 0x02};
// WPA2 OUI
@ -51,7 +55,9 @@ UCHAR OUI_WPA2_TKIP[4] = {0x00, 0x0F, 0xAC, 0x02};
UCHAR OUI_WPA2_CCMP[4] = {0x00, 0x0F, 0xAC, 0x04};
UCHAR OUI_WPA2_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x01};
UCHAR OUI_WPA2_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x02};
#ifndef RT30xx
UCHAR OUI_WPA2_WEP104[4] = {0x00, 0x0F, 0xAC, 0x05};
#endif
// MSA OUI
UCHAR OUI_MSA_8021X_AKM[4] = {0x00, 0x0F, 0xAC, 0x05}; // Not yet final - IEEE 802.11s-D1.06
UCHAR OUI_MSA_PSK_AKM[4] = {0x00, 0x0F, 0xAC, 0x06}; // Not yet final - IEEE 802.11s-D1.06
@ -370,6 +376,7 @@ static VOID RTMPInsertRsnIeCipher(
break;
}
#ifndef RT30xx
if ((pAd->OpMode == OPMODE_STA) &&
(pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) &&
(pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled))
@ -385,7 +392,7 @@ static VOID RTMPInsertRsnIeCipher(
break;
}
}
#endif
// swap for big-endian platform
pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version);
pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount);
@ -446,6 +453,7 @@ static VOID RTMPInsertRsnIeCipher(
break;
}
#ifndef RT30xx
if ((pAd->OpMode == OPMODE_STA) &&
(pAd->StaCfg.GroupCipher != Ndis802_11Encryption2Enabled) &&
(pAd->StaCfg.GroupCipher != Ndis802_11Encryption3Enabled))
@ -461,7 +469,7 @@ static VOID RTMPInsertRsnIeCipher(
break;
}
}
#endif
// swap for big-endian platform
pRsnie_cipher->version = cpu2le16(pRsnie_cipher->version);
pRsnie_cipher->ucount = cpu2le16(pRsnie_cipher->ucount);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,12 @@
Jan Lee 2006-09-15 RT2860. Change for 802.11n , EEPROM, Led, BA, HT.
*/
#include "../rt_config.h"
#ifndef RT30xx
#include "firmware.h"
#endif
#ifdef RT30xx
#include "../../rt3070/firmware.h"
#endif
UCHAR BIT8[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
ULONG BIT32[] = {0x00000001, 0x00000002, 0x00000004, 0x00000008,
@ -134,7 +139,12 @@ REG_PAIR RT30xx_RFRegTable[] = {
{RF_R06, 0x02},
{RF_R07, 0x70},
{RF_R09, 0x0F},
#ifndef RT30xx
{RF_R10, 0x71},
#endif
#ifdef RT30xx
{RF_R10, 0x41},
#endif
{RF_R11, 0x21},
{RF_R12, 0x7B},
{RF_R14, 0x90},
@ -147,7 +157,9 @@ REG_PAIR RT30xx_RFRegTable[] = {
{RF_R21, 0xDB},
{RF_R24, 0x16},
{RF_R25, 0x01},
#ifndef RT30xx
{RF_R27, 0x03},
#endif
{RF_R29, 0x1F},
};
#define NUM_RF_REG_PARMS (sizeof(RT30xx_RFRegTable) / sizeof(REG_PAIR))
@ -184,6 +196,7 @@ RTMP_REG_PAIR MACRegTable[] = {
{AUTO_RSP_CFG, 0x00000013}, // Initial Auto_Responder, because QA will turn off Auto-Responder
{CCK_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled.
{OFDM_PROT_CFG, 0x05740003 /*0x01740003*/}, // Initial Auto_Responder, because QA will turn off Auto-Responder. And RTS threshold is enabled.
//PS packets use Tx1Q (for HCCA) when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
#ifdef RT2870
{PBF_CFG, 0xf40006}, // Only enable Queue 2
{MM40_PROT_CFG, 0x3F44084}, // Initial Auto_Responder, because QA will turn off Auto-Responder
@ -1070,6 +1083,7 @@ NDIS_STATUS NICReadRegParameters(
========================================================================
*/
#ifndef RT30xx
VOID RTUSBFilterCalibration(
IN PRTMP_ADAPTER pAd)
{
@ -1206,13 +1220,168 @@ VOID RTUSBFilterCalibration(
DBGPRINT(RT_DEBUG_TRACE, ("RTUSBFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24));
}
#endif /* RT30xx */
#ifdef RT30xx
VOID RTMPFilterCalibration(
IN PRTMP_ADAPTER pAd)
{
UCHAR R55x = 0, value, FilterTarget = 0x1E, BBPValue=0;
UINT loop = 0, count = 0, loopcnt = 0, ReTry = 0;
UCHAR RF_R24_Value = 0;
// Give bbp filter initial value
pAd->Mlme.CaliBW20RfR24 = 0x1F;
pAd->Mlme.CaliBW40RfR24 = 0x2F; //Bit[5] must be 1 for BW 40
do
{
if (loop == 1) //BandWidth = 40 MHz
{
// Write 0x27 to RF_R24 to program filter
RF_R24_Value = 0x27;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
if (IS_RT3090(pAd))
FilterTarget = 0x15;
else
FilterTarget = 0x19;
// when calibrate BW40, BBP mask must set to BW40.
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue&= (~0x18);
BBPValue|= (0x10);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
// set to BW40
RT30xxReadRFRegister(pAd, RF_R31, &value);
value |= 0x20;
RT30xxWriteRFRegister(pAd, RF_R31, value);
}
else //BandWidth = 20 MHz
{
// Write 0x07 to RF_R24 to program filter
RF_R24_Value = 0x07;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
if (IS_RT3090(pAd))
FilterTarget = 0x13;
else
FilterTarget = 0x16;
// set to BW20
RT30xxReadRFRegister(pAd, RF_R31, &value);
value &= (~0x20);
RT30xxWriteRFRegister(pAd, RF_R31, value);
}
// Write 0x01 to RF_R22 to enable baseband loopback mode
RT30xxReadRFRegister(pAd, RF_R22, &value);
value |= 0x01;
RT30xxWriteRFRegister(pAd, RF_R22, value);
// Write 0x00 to BBP_R24 to set power & frequency of passband test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
do
{
// Write 0x90 to BBP_R25 to transmit test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
RTMPusecDelay(1000);
// Read BBP_R55[6:0] for received power, set R55x = BBP_R55[6:0]
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
R55x = value & 0xFF;
} while ((ReTry++ < 100) && (R55x == 0));
// Write 0x06 to BBP_R24 to set power & frequency of stopband test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0x06);
while(TRUE)
{
// Write 0x90 to BBP_R25 to transmit test tone
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R25, 0x90);
//We need to wait for calibration
RTMPusecDelay(1000);
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R55, &value);
value &= 0xFF;
if ((R55x - value) < FilterTarget)
{
RF_R24_Value ++;
}
else if ((R55x - value) == FilterTarget)
{
RF_R24_Value ++;
count ++;
}
else
{
break;
}
// prevent infinite loop cause driver hang.
if (loopcnt++ > 100)
{
DBGPRINT(RT_DEBUG_ERROR, ("RTMPFilterCalibration - can't find a valid value, loopcnt=%d stop calibrating", loopcnt));
break;
}
// Write RF_R24 to program filter
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
}
if (count > 0)
{
RF_R24_Value = RF_R24_Value - ((count) ? (1) : (0));
}
// Store for future usage
if (loopcnt < 100)
{
if (loop++ == 0)
{
//BandWidth = 20 MHz
pAd->Mlme.CaliBW20RfR24 = (UCHAR)RF_R24_Value;
}
else
{
//BandWidth = 40 MHz
pAd->Mlme.CaliBW40RfR24 = (UCHAR)RF_R24_Value;
break;
}
}
else
break;
RT30xxWriteRFRegister(pAd, RF_R24, RF_R24_Value);
// reset count
count = 0;
} while(TRUE);
//
// Set back to initial state
//
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R24, 0);
RT30xxReadRFRegister(pAd, RF_R22, &value);
value &= ~(0x01);
RT30xxWriteRFRegister(pAd, RF_R22, value);
// set BBP back to BW20
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &BBPValue);
BBPValue&= (~0x18);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, BBPValue);
DBGPRINT(RT_DEBUG_TRACE, ("RTMPFilterCalibration - CaliBW20RfR24=0x%x, CaliBW40RfR24=0x%x\n", pAd->Mlme.CaliBW20RfR24, pAd->Mlme.CaliBW40RfR24));
}
#endif /* RT30xx */
VOID NICInitRT30xxRFRegisters(IN PRTMP_ADAPTER pAd)
{
INT i;
// Driver must read EEPROM to get RfIcType before initial RF registers
// Initialize RF register to default value
#ifndef RT30xx
if (IS_RT3070(pAd) && ((pAd->RfIcType == RFIC_3020) ||(pAd->RfIcType == RFIC_2020)))
{
// Init RF calibration
@ -1234,7 +1403,86 @@ VOID NICInitRT30xxRFRegisters(IN PRTMP_ADAPTER pAd)
//For RF filter Calibration
RTUSBFilterCalibration(pAd);
}
#endif
#ifdef RT30xx
if (IS_RT3070(pAd) || IS_RT3071(pAd))
{
// Init RF calibration
// Driver should toggle RF R30 bit7 before init RF registers
UINT32 RfReg = 0;
UINT32 data;
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
RfReg |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
RTMPusecDelay(1000);
RfReg &= 0x7F;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
// Initialize RF register to default value
for (i = 0; i < NUM_RF_REG_PARMS; i++)
{
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
}
// add by johnli
if (IS_RT3070(pAd))
{
// Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
data = ((data & 0xF0FFFFFF) | 0x0D000000);
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
}
else if (IS_RT3071(pAd))
{
// Driver should set RF R6 bit6 on before init RF registers
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
RfReg |= 0x40;
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
// init R31
RT30xxWriteRFRegister(pAd, RF_R31, 0x14);
// RT3071 version E has fixed this issue
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
// patch tx EVM issue temporarily
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
data = ((data & 0xE0FFFFFF) | 0x0D000000);
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
}
else
{
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
data = ((data & 0xE0FFFFFF) | 0x01000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
}
// patch LNA_PE_G1 failed issue
RTUSBReadMACRegister(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data);
}
//For RF filter Calibration
RTMPFilterCalibration(pAd);
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
if ((pAd->MACVersion & 0xffff) < 0x0211)
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
// set led open drain enable
RTUSBReadMACRegister(pAd, OPT_14, &data);
data |= 0x01;
RTUSBWriteMACRegister(pAd, OPT_14, data);
if (IS_RT3071(pAd))
{
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
RT30xxLoadRFNormalModeSetup(pAd);
}
}
#endif
}
#endif // RT2870 //
@ -1411,11 +1659,25 @@ VOID NICReadEEPROMParameters(
Antenna.word = pAd->EEPROMDefaultValue[0];
if (Antenna.word == 0xFFFF)
{
Antenna.word = 0;
Antenna.field.RfIcType = RFIC_2820;
Antenna.field.TxPath = 1;
Antenna.field.RxPath = 2;
DBGPRINT(RT_DEBUG_WARN, ("E2PROM error, hard code as 0x%04x\n", Antenna.word));
#ifdef RT30xx
if(IS_RT3090(pAd))
{
Antenna.word = 0;
Antenna.field.RfIcType = RFIC_3020;
Antenna.field.TxPath = 1;
Antenna.field.RxPath = 1;
}
else
{
#endif // RT30xx //
Antenna.word = 0;
Antenna.field.RfIcType = RFIC_2820;
Antenna.field.TxPath = 1;
Antenna.field.RxPath = 2;
DBGPRINT(RT_DEBUG_WARN, ("E2PROM error, hard code as 0x%04x\n", Antenna.word));
#ifdef RT30xx
}
#endif // RT30xx //
}
// Choose the desired Tx&Rx stream.
@ -1444,7 +1706,9 @@ VOID NICReadEEPROMParameters(
NicConfig2.word = pAd->EEPROMDefaultValue[1];
{
#ifndef RT30xx
NicConfig2.word = 0;
#endif
if ((NicConfig2.word & 0x00ff) == 0xff)
{
NicConfig2.word &= 0xff00;
@ -1637,6 +1901,14 @@ VOID NICReadEEPROMParameters(
RTMPReadTxPwrPerRate(pAd);
#ifdef RT30xx
if (IS_RT30xx(pAd))
{
eFusePhysicalReadRegisters(pAd, EFUSE_TAG, 2, &value);
pAd->EFuseTag = (value & 0xff);
}
#endif // RT30xx //
DBGPRINT(RT_DEBUG_TRACE, ("<-- NICReadEEPROMParameters\n"));
}
@ -1681,16 +1953,49 @@ VOID NICInitAsicFromEEPROM(
}
}
#ifndef RT30xx
Antenna.word = pAd->Antenna.word;
#endif
#ifdef RT30xx
Antenna.word = pAd->EEPROMDefaultValue[0];
if (Antenna.word == 0xFFFF)
{
DBGPRINT(RT_DEBUG_ERROR, ("E2PROM error, hard code as 0x%04x\n", Antenna.word));
BUG_ON(Antenna.word == 0xFFFF);
}
#endif
pAd->Mlme.RealRxPath = (UCHAR) Antenna.field.RxPath;
pAd->RfIcType = (UCHAR) Antenna.field.RfIcType;
#ifdef RT30xx
DBGPRINT(RT_DEBUG_WARN, ("pAd->RfIcType = %d, RealRxPath=%d, TxPath = %d\n", pAd->RfIcType, pAd->Mlme.RealRxPath,Antenna.field.TxPath));
// Save the antenna for future use
pAd->Antenna.word = Antenna.word;
#endif
NicConfig2.word = pAd->EEPROMDefaultValue[1];
#ifdef RT30xx
{
if ((NicConfig2.word & 0x00ff) == 0xff)
{
NicConfig2.word &= 0xff00;
}
if ((NicConfig2.word >> 8) == 0xff)
{
NicConfig2.word &= 0x00ff;
}
}
#endif
// Save the antenna for future use
pAd->NicConfig2.word = NicConfig2.word;
#ifdef RT30xx
// set default antenna as main
if (pAd->RfIcType == RFIC_3020)
AsicSetRxAnt(pAd, pAd->RxAnt.Pair1PrimaryRxAnt);
#endif
//
// Send LED Setting to MCU.
//
@ -1919,6 +2224,9 @@ NDIS_STATUS NICInitializeAsic(
NTSTATUS Status;
UCHAR Value = 0xff;
#endif // RT2870 //
#ifdef RT30xx
UINT32 eFuseCtrl;
#endif // RT30xx //
USHORT KeyIdx;
INT i,apidx;
@ -1959,9 +2267,16 @@ NDIS_STATUS NICInitializeAsic(
// Initialize MAC register to default value
for(Index=0; Index<NUM_MAC_REG_PARMS; Index++)
{
#ifdef RT3070
if ((MACRegTable[Index].Register == TX_SW_CFG0) && (IS_RT3070(pAd) || IS_RT3071(pAd)))
{
MACRegTable[Index].Value = 0x00000400;
}
#endif // RT3070 //
RTMP_IO_WRITE32(pAd, (USHORT)MACRegTable[Index].Register, MACRegTable[Index].Value);
}
#ifndef RT30xx
if(IS_RT3070(pAd))
{
// According to Frank Hsu (from Gary Tsao)
@ -1971,7 +2286,7 @@ NDIS_STATUS NICInitializeAsic(
RTUSBWriteMACRegister(pAd, TX_SW_CFG1, 0);
RTUSBWriteMACRegister(pAd, TX_SW_CFG2, 0);
}
#endif
{
for (Index = 0; Index < NUM_STA_MAC_REG_PARMS; Index++)
@ -1981,6 +2296,36 @@ NDIS_STATUS NICInitializeAsic(
}
#endif // RT2870 //
#ifdef RT30xx
// Initialize RT3070 serial MAc registers which is different from RT2870 serial
if (IS_RT3090(pAd))
{
RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0);
// RT3071 version E has fixed this issue
if ((pAd->MACVersion & 0xffff) < 0x0211)
{
if (pAd->NicConfig2.field.DACTestBit == 1)
{
RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x1F); // To fix throughput drop drastically
}
else
{
RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0F); // To fix throughput drop drastically
}
}
else
{
RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x0);
}
}
else if (IS_RT3070(pAd))
{
RTMP_IO_WRITE32(pAd, TX_SW_CFG1, 0);
RTMP_IO_WRITE32(pAd, TX_SW_CFG2, 0x1F); // To fix throughput drop drastically
}
#endif // RT30xx //
//
// Before program BBP, we need to wait BBP/RF get wake up.
//
@ -2020,6 +2365,7 @@ NDIS_STATUS NICInitializeAsic(
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBPRegTable[Index].Register, BBPRegTable[Index].Value);
}
#ifndef RT30xx
// for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT.
if ((pAd->MACVersion&0xffff) != 0x0101)
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19);
@ -2033,7 +2379,55 @@ NDIS_STATUS NICInitializeAsic(
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R105, 0x05);
}
#endif // RT2870 //
#endif
#ifdef RT30xx
// for rt2860E and after, init BBP_R84 with 0x19. This is for extension channel overlapping IOT.
// RT3090 should not program BBP R84 to 0x19, otherwise TX will block.
if (((pAd->MACVersion&0xffff) != 0x0101) && (!IS_RT30xx(pAd)))
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R84, 0x19);
// add by johnli, RF power sequence setup
if (IS_RT30xx(pAd))
{ //update for RT3070/71/72/90/91/92.
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R79, 0x13);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R80, 0x05);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R81, 0x33);
}
if (IS_RT3090(pAd))
{
UCHAR bbpreg=0;
// enable DC filter
if ((pAd->MACVersion & 0xffff) >= 0x0211)
{
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R103, 0xc0);
}
// improve power consumption
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R138, &bbpreg);
if (pAd->Antenna.field.TxPath == 1)
{
// turn off tx DAC_1
bbpreg = (bbpreg | 0x20);
}
if (pAd->Antenna.field.RxPath == 1)
{
// turn off tx ADC_1
bbpreg &= (~0x2);
}
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R138, bbpreg);
// improve power consumption in RT3071 Ver.E
if ((pAd->MACVersion & 0xffff) >= 0x0211)
{
RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R31, &bbpreg);
bbpreg &= (~0x3);
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R31, bbpreg);
}
}
#endif
if (pAd->MACVersion == 0x28600100)
{
RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R69, 0x16);
@ -2123,6 +2517,20 @@ NDIS_STATUS NICInitializeAsic(
Counter|=0x000001e;
RTMP_IO_WRITE32(pAd, USB_CYC_CFG, Counter);
#endif // RT2870 //
#ifdef RT30xx
pAd->bUseEfuse=FALSE;
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl);
pAd->bUseEfuse = ( (eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0;
if(pAd->bUseEfuse)
{
DBGPRINT(RT_DEBUG_TRACE, ("NVM is Efuse\n"));
}
else
{
DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n"));
}
#endif // RT30xx //
{
// for rt2860E and after, init TXOP_CTRL_CFG with 0x583f. This is for extension channel overlapping IOT.
@ -2635,19 +3043,18 @@ NDIS_STATUS NICLoadFirmware(
ULONG FileLength, Index;
//ULONG firm;
UINT32 MacReg = 0;
#ifdef RT2870
UINT32 Version = (pAd->MACVersion >> 16);
#endif // RT2870 //
pFirmwareImage = FirmwareImage;
FileLength = sizeof(FirmwareImage);
#ifdef RT2870
// New 8k byte firmware size for RT3071/RT3072
//printk("Usb Chip\n");
if (FIRMWAREIMAGE_LENGTH == FIRMWAREIMAGE_MAX_LENGTH)
//The firmware image consists of two parts. One is the origianl and the other is the new.
//Use Second Part
{
#ifdef RT2870
if ((Version != 0x2860) && (Version != 0x2872) && (Version != 0x3070))
{ // Use Firmware V2.
//printk("KH:Use New Version,part2\n");
@ -2660,6 +3067,7 @@ NDIS_STATUS NICLoadFirmware(
pFirmwareImage = FirmwareImage;
FileLength = FIRMWAREIMAGEV1_LENGTH;
}
#endif // RT2870 //
}
else
{
@ -2667,8 +3075,6 @@ NDIS_STATUS NICLoadFirmware(
Status = NDIS_STATUS_FAILURE;
}
#endif // RT2870 //
RT28XX_WRITE_FIRMWARE(pAd, pFirmwareImage, FileLength);
/* check if MCU is ready */
@ -2969,7 +3375,9 @@ VOID UserCfgInit(
pAd->SharedKey[bss_index][key_index].CipherAlg = CIPHER_NONE;
}
}
#ifdef RT30xx
pAd->EepromAccess = FALSE;
#endif
pAd->Antenna.word = 0;
pAd->CommonCfg.BBPCurrentBW = BW_20;

View File

@ -317,6 +317,7 @@ VOID RTUSBBulkOutDataPacket(
break;
}
//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
if (pTxInfo->QSEL != FIFO_EDCA)
{
printk("%s(): ====> pTxInfo->QueueSel(%d)!= FIFO_EDCA!!!!\n", __func__, pTxInfo->QSEL);
@ -349,7 +350,7 @@ VOID RTUSBBulkOutDataPacket(
pLastTxInfo = pTxInfo;
// Make sure we use EDCA QUEUE.
pTxInfo->QSEL = FIFO_EDCA;
pTxInfo->QSEL = FIFO_EDCA; //PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
ThisBulkSize += (pTxInfo->USBDMATxPktLen+4);
TmpBulkEndPos += (pTxInfo->USBDMATxPktLen+4);
@ -975,6 +976,17 @@ VOID RTUSBKickBulkOut(
RTUSBBulkOutDataPacket(pAd, 3, pAd->NextBulkOutIndex[3]);
}
}
#ifdef RT30xx
//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NORMAL_5))
{
if (((!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) ||
(!OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED))
))
{
}
}
#endif
// 7. Null frame is the last
else if (RTUSB_TEST_BULK_FLAG(pAd, fRTUSB_BULK_OUT_DATA_NULL))

View File

@ -110,6 +110,12 @@ NTSTATUS RTUSBFirmwareWrite(
Status = RTUSBWriteMACRegister(pAd, 0x701c, 0xffffffff);
Status = RTUSBFirmwareRun(pAd);
#ifdef RT30xx
RTMPusecDelay(10000);
RTUSBWriteMACRegister(pAd,H2M_MAILBOX_CSR,0);
AsicSendCommandToMcu(pAd, 0x72, 0x00, 0x00, 0x00);//reset rf by MCU supported by new firmware
#endif
return Status;
}
@ -665,6 +671,7 @@ NTSTATUS RTUSBWriteRFRegister(
return STATUS_SUCCESS;
}
#ifndef RT30xx
/*
========================================================================
@ -772,6 +779,7 @@ NTSTATUS RT30xxReadRFRegister(
return STATUS_SUCCESS;
}
#endif /* RT30xx */
/*
========================================================================
@ -796,6 +804,14 @@ NTSTATUS RTUSBReadEEPROM(
{
NTSTATUS Status = STATUS_SUCCESS;
#ifdef RT30xx
if(pAd->bUseEfuse)
{
Status =eFuseRead(pAd, Offset, pData, length);
}
else
#endif // RT30xx //
{
Status = RTUSB_VendorRequest(
pAd,
(USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK),
@ -805,6 +821,7 @@ NTSTATUS RTUSBReadEEPROM(
Offset,
pData,
length);
}
return Status;
}
@ -832,6 +849,14 @@ NTSTATUS RTUSBWriteEEPROM(
{
NTSTATUS Status = STATUS_SUCCESS;
#ifdef RT30xx
if(pAd->bUseEfuse)
{
Status = eFuseWrite(pAd, Offset, pData, length);
}
else
#endif // RT30xx //
{
Status = RTUSB_VendorRequest(
pAd,
USBD_TRANSFER_DIRECTION_OUT,
@ -841,6 +866,7 @@ NTSTATUS RTUSBWriteEEPROM(
Offset,
pData,
length);
}
return Status;
}
@ -957,9 +983,13 @@ NDIS_STATUS RTUSBEnqueueCmdFromNdis(
PCmdQElmt cmdqelmt = NULL;
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
#ifndef RT30xx
BUG_ON(pObj->RTUSBCmdThr_task == NULL);
CHECK_PID_LEGALITY(task_pid(pObj->RTUSBCmdThr_task))
#endif
#ifdef RT30xx
if (pObj->RTUSBCmdThr_pid < 0)
#endif
return (NDIS_STATUS_RESOURCES);
status = RTMPAllocateMemory((PVOID *)&cmdqelmt, sizeof(CmdQElmt));
@ -1710,6 +1740,38 @@ VOID CMDHandler(
}
break;
#ifdef RT30xx
//Benson modified for USB interface, avoid in interrupt when write key, 20080724 -->
case RT_CMD_SET_KEY_TABLE: //General call for AsicAddPairwiseKeyEntry()
{
RT_ADD_PAIRWISE_KEY_ENTRY KeyInfo;
KeyInfo = *((PRT_ADD_PAIRWISE_KEY_ENTRY)(pData));
AsicAddPairwiseKeyEntry(pAd,
KeyInfo.MacAddr,
(UCHAR)KeyInfo.MacTabMatchWCID,
&KeyInfo.CipherKey);
}
break;
case RT_CMD_SET_RX_WCID_TABLE: //General call for RTMPAddWcidAttributeEntry()
{
PMAC_TABLE_ENTRY pEntry;
UCHAR KeyIdx;
UCHAR CipherAlg;
UCHAR ApIdx;
pEntry = (PMAC_TABLE_ENTRY)(pData);
RTMPAddWcidAttributeEntry(
pAd,
ApIdx,
KeyIdx,
CipherAlg,
pEntry);
}
break;
//Benson modified for USB interface, avoid in interrupt when write key, 20080724 <--
#endif
case CMDTHREAD_SET_CLIENT_MAC_ENTRY:
{
MAC_TABLE_ENTRY *pEntry;
@ -1756,6 +1818,16 @@ VOID CMDHandler(
}
break;
#ifdef RT30xx
// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
case CMDTHREAD_UPDATE_PROTECT:
{
AsicUpdateProtect(pAd, 0, (ALLN_SETPROTECT), TRUE, 0);
}
break;
// end johnli
#endif
case OID_802_11_ADD_WEP:
{
UINT i;

View File

@ -1569,7 +1569,12 @@ static VOID PeerMeasureReportAction(
if ((pMeasureReportInfo = kmalloc(sizeof(MEASURE_RPI_REPORT), GFP_ATOMIC)) == NULL)
{
#ifndef RT30xx
DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%zu).\n", __func__, sizeof(MEASURE_RPI_REPORT)));
#endif
#ifdef RT30xx
DBGPRINT(RT_DEBUG_ERROR, ("%s unable to alloc memory for measure report buffer (size=%d).\n", __func__, sizeof(MEASURE_RPI_REPORT)));
#endif
return;
}