Commit 91961244 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6655: card.c rename pDevice with priv

Removing camel case.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bc667b99
...@@ -197,13 +197,13 @@ s_vCalculateOFDMRParameter( ...@@ -197,13 +197,13 @@ s_vCalculateOFDMRParameter(
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set * priv - The adapter to be set
* Out: * Out:
* none * none
* *
* Return Value: None. * Return Value: None.
*/ */
bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type)
{ {
unsigned char byCWMaxMin = 0; unsigned char byCWMaxMin = 0;
unsigned char bySlot = 0; unsigned char bySlot = 0;
...@@ -214,77 +214,77 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) ...@@ -214,77 +214,77 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type)
/* Set SIFS, DIFS, EIFS, SlotTime, CwMin */ /* Set SIFS, DIFS, EIFS, SlotTime, CwMin */
if (bb_type == BB_TYPE_11A) { if (bb_type == BB_TYPE_11A) {
if (pDevice->byRFType == RF_AIROHA7230) { if (priv->byRFType == RF_AIROHA7230) {
/* AL7230 use single PAPE and connect to PAPE_2.4G */ /* AL7230 use single PAPE and connect to PAPE_2.4G */
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11G); MACvSetBBType(priv->PortOffset, BB_TYPE_11G);
pDevice->abyBBVGA[0] = 0x20; priv->abyBBVGA[0] = 0x20;
pDevice->abyBBVGA[2] = 0x10; priv->abyBBVGA[2] = 0x10;
pDevice->abyBBVGA[3] = 0x10; priv->abyBBVGA[3] = 0x10;
BBbReadEmbedded(pDevice, 0xE7, &byData); BBbReadEmbedded(priv, 0xE7, &byData);
if (byData == 0x1C) if (byData == 0x1C)
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]); BBbWriteEmbedded(priv, 0xE7, priv->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) { } else if (priv->byRFType == RF_UW2452) {
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A); MACvSetBBType(priv->PortOffset, BB_TYPE_11A);
pDevice->abyBBVGA[0] = 0x18; priv->abyBBVGA[0] = 0x18;
BBbReadEmbedded(pDevice, 0xE7, &byData); BBbReadEmbedded(priv, 0xE7, &byData);
if (byData == 0x14) { if (byData == 0x14) {
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]); BBbWriteEmbedded(priv, 0xE7, priv->abyBBVGA[0]);
BBbWriteEmbedded(pDevice, 0xE1, 0x57); BBbWriteEmbedded(priv, 0xE1, 0x57);
} }
} else { } else {
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A); MACvSetBBType(priv->PortOffset, BB_TYPE_11A);
} }
BBbWriteEmbedded(pDevice, 0x88, 0x03); BBbWriteEmbedded(priv, 0x88, 0x03);
bySlot = C_SLOT_SHORT; bySlot = C_SLOT_SHORT;
bySIFS = C_SIFS_A; bySIFS = C_SIFS_A;
byDIFS = C_SIFS_A + 2*C_SLOT_SHORT; byDIFS = C_SIFS_A + 2*C_SLOT_SHORT;
byCWMaxMin = 0xA4; byCWMaxMin = 0xA4;
} else if (bb_type == BB_TYPE_11B) { } else if (bb_type == BB_TYPE_11B) {
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11B); MACvSetBBType(priv->PortOffset, BB_TYPE_11B);
if (pDevice->byRFType == RF_AIROHA7230) { if (priv->byRFType == RF_AIROHA7230) {
pDevice->abyBBVGA[0] = 0x1C; priv->abyBBVGA[0] = 0x1C;
pDevice->abyBBVGA[2] = 0x00; priv->abyBBVGA[2] = 0x00;
pDevice->abyBBVGA[3] = 0x00; priv->abyBBVGA[3] = 0x00;
BBbReadEmbedded(pDevice, 0xE7, &byData); BBbReadEmbedded(priv, 0xE7, &byData);
if (byData == 0x20) if (byData == 0x20)
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]); BBbWriteEmbedded(priv, 0xE7, priv->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) { } else if (priv->byRFType == RF_UW2452) {
pDevice->abyBBVGA[0] = 0x14; priv->abyBBVGA[0] = 0x14;
BBbReadEmbedded(pDevice, 0xE7, &byData); BBbReadEmbedded(priv, 0xE7, &byData);
if (byData == 0x18) { if (byData == 0x18) {
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]); BBbWriteEmbedded(priv, 0xE7, priv->abyBBVGA[0]);
BBbWriteEmbedded(pDevice, 0xE1, 0xD3); BBbWriteEmbedded(priv, 0xE1, 0xD3);
} }
} }
BBbWriteEmbedded(pDevice, 0x88, 0x02); BBbWriteEmbedded(priv, 0x88, 0x02);
bySlot = C_SLOT_LONG; bySlot = C_SLOT_LONG;
bySIFS = C_SIFS_BG; bySIFS = C_SIFS_BG;
byDIFS = C_SIFS_BG + 2*C_SLOT_LONG; byDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
byCWMaxMin = 0xA5; byCWMaxMin = 0xA5;
} else { /* PK_TYPE_11GA & PK_TYPE_11GB */ } else { /* PK_TYPE_11GA & PK_TYPE_11GB */
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11G); MACvSetBBType(priv->PortOffset, BB_TYPE_11G);
if (pDevice->byRFType == RF_AIROHA7230) { if (priv->byRFType == RF_AIROHA7230) {
pDevice->abyBBVGA[0] = 0x1C; priv->abyBBVGA[0] = 0x1C;
pDevice->abyBBVGA[2] = 0x00; priv->abyBBVGA[2] = 0x00;
pDevice->abyBBVGA[3] = 0x00; priv->abyBBVGA[3] = 0x00;
BBbReadEmbedded(pDevice, 0xE7, &byData); BBbReadEmbedded(priv, 0xE7, &byData);
if (byData == 0x20) if (byData == 0x20)
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]); BBbWriteEmbedded(priv, 0xE7, priv->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) { } else if (priv->byRFType == RF_UW2452) {
pDevice->abyBBVGA[0] = 0x14; priv->abyBBVGA[0] = 0x14;
BBbReadEmbedded(pDevice, 0xE7, &byData); BBbReadEmbedded(priv, 0xE7, &byData);
if (byData == 0x18) { if (byData == 0x18) {
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]); BBbWriteEmbedded(priv, 0xE7, priv->abyBBVGA[0]);
BBbWriteEmbedded(pDevice, 0xE1, 0xD3); BBbWriteEmbedded(priv, 0xE1, 0xD3);
} }
} }
BBbWriteEmbedded(pDevice, 0x88, 0x08); BBbWriteEmbedded(priv, 0x88, 0x08);
bySIFS = C_SIFS_BG; bySIFS = C_SIFS_BG;
if (pDevice->bShortSlotTime) { if (priv->bShortSlotTime) {
bySlot = C_SLOT_SHORT; bySlot = C_SLOT_SHORT;
byDIFS = C_SIFS_BG + 2*C_SLOT_SHORT; byDIFS = C_SIFS_BG + 2*C_SLOT_SHORT;
} else { } else {
...@@ -295,14 +295,14 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) ...@@ -295,14 +295,14 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type)
byCWMaxMin = 0xa4; byCWMaxMin = 0xa4;
for (i = RATE_54M; i >= RATE_6M; i--) { for (i = RATE_54M; i >= RATE_6M; i--) {
if (pDevice->basic_rates & ((u32)(0x1 << i))) { if (priv->basic_rates & ((u32)(0x1 << i))) {
byCWMaxMin |= 0x1; byCWMaxMin |= 0x1;
break; break;
} }
} }
} }
if (pDevice->byRFType == RF_RFMD2959) { if (priv->byRFType == RF_RFMD2959) {
/* /*
* bcs TX_PE will reserve 3 us hardware's processing * bcs TX_PE will reserve 3 us hardware's processing
* time here is 2 us. * time here is 2 us.
...@@ -316,32 +316,32 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) ...@@ -316,32 +316,32 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type)
*/ */
} }
if (pDevice->bySIFS != bySIFS) { if (priv->bySIFS != bySIFS) {
pDevice->bySIFS = bySIFS; priv->bySIFS = bySIFS;
VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, pDevice->bySIFS); VNSvOutPortB(priv->PortOffset + MAC_REG_SIFS, priv->bySIFS);
} }
if (pDevice->byDIFS != byDIFS) { if (priv->byDIFS != byDIFS) {
pDevice->byDIFS = byDIFS; priv->byDIFS = byDIFS;
VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, pDevice->byDIFS); VNSvOutPortB(priv->PortOffset + MAC_REG_DIFS, priv->byDIFS);
} }
if (pDevice->byEIFS != C_EIFS) { if (priv->byEIFS != C_EIFS) {
pDevice->byEIFS = C_EIFS; priv->byEIFS = C_EIFS;
VNSvOutPortB(pDevice->PortOffset + MAC_REG_EIFS, pDevice->byEIFS); VNSvOutPortB(priv->PortOffset + MAC_REG_EIFS, priv->byEIFS);
} }
if (pDevice->bySlot != bySlot) { if (priv->bySlot != bySlot) {
pDevice->bySlot = bySlot; priv->bySlot = bySlot;
VNSvOutPortB(pDevice->PortOffset + MAC_REG_SLOT, pDevice->bySlot); VNSvOutPortB(priv->PortOffset + MAC_REG_SLOT, priv->bySlot);
BBvSetShortSlotTime(pDevice); BBvSetShortSlotTime(priv);
} }
if (pDevice->byCWMaxMin != byCWMaxMin) { if (priv->byCWMaxMin != byCWMaxMin) {
pDevice->byCWMaxMin = byCWMaxMin; priv->byCWMaxMin = byCWMaxMin;
VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, pDevice->byCWMaxMin); VNSvOutPortB(priv->PortOffset + MAC_REG_CWMAXMIN0, priv->byCWMaxMin);
} }
pDevice->byPacketType = CARDbyGetPktType(pDevice); priv->byPacketType = CARDbyGetPktType(priv);
CARDvSetRSPINF(pDevice, bb_type); CARDvSetRSPINF(priv, bb_type);
return true; return true;
} }
...@@ -352,7 +352,7 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) ...@@ -352,7 +352,7 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type)
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be sync. * priv - The adapter to be sync.
* byRxRate - data rate of receive beacon * byRxRate - data rate of receive beacon
* qwBSSTimestamp - Rx BCN's TSF * qwBSSTimestamp - Rx BCN's TSF
* qwLocalTSF - Local TSF * qwLocalTSF - Local TSF
...@@ -361,21 +361,21 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type) ...@@ -361,21 +361,21 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, u8 bb_type)
* *
* Return Value: none * Return Value: none
*/ */
bool CARDbUpdateTSF(struct vnt_private *pDevice, unsigned char byRxRate, bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate,
u64 qwBSSTimestamp) u64 qwBSSTimestamp)
{ {
u64 local_tsf; u64 local_tsf;
u64 qwTSFOffset = 0; u64 qwTSFOffset = 0;
CARDbGetCurrentTSF(pDevice, &local_tsf); CARDbGetCurrentTSF(priv, &local_tsf);
if (qwBSSTimestamp != local_tsf) { if (qwBSSTimestamp != local_tsf) {
qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp,
local_tsf); local_tsf);
/* adjust TSF, HW's TSF add TSF Offset reg */ /* adjust TSF, HW's TSF add TSF Offset reg */
VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset); VNSvOutPortD(priv->PortOffset + MAC_REG_TSFOFST, (u32)qwTSFOffset);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32)); VNSvOutPortD(priv->PortOffset + MAC_REG_TSFOFST + 4, (u32)(qwTSFOffset >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN); MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN);
} }
return true; return true;
} }
...@@ -386,29 +386,29 @@ bool CARDbUpdateTSF(struct vnt_private *pDevice, unsigned char byRxRate, ...@@ -386,29 +386,29 @@ bool CARDbUpdateTSF(struct vnt_private *pDevice, unsigned char byRxRate,
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set. * priv - The adapter to be set.
* wBeaconInterval - Beacon Interval * wBeaconInterval - Beacon Interval
* Out: * Out:
* none * none
* *
* Return Value: true if succeed; otherwise false * Return Value: true if succeed; otherwise false
*/ */
bool CARDbSetBeaconPeriod(struct vnt_private *pDevice, bool CARDbSetBeaconPeriod(struct vnt_private *priv,
unsigned short wBeaconInterval) unsigned short wBeaconInterval)
{ {
u64 qwNextTBTT = 0; u64 qwNextTBTT = 0;
CARDbGetCurrentTSF(pDevice, &qwNextTBTT); /* Get Local TSF counter */ CARDbGetCurrentTSF(priv, &qwNextTBTT); /* Get Local TSF counter */
qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
/* set HW beacon interval */ /* set HW beacon interval */
VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval); VNSvOutPortW(priv->PortOffset + MAC_REG_BI, wBeaconInterval);
pDevice->wBeaconInterval = wBeaconInterval; priv->wBeaconInterval = wBeaconInterval;
/* Set NextTBTT */ /* Set NextTBTT */
VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT); VNSvOutPortD(priv->PortOffset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32)); VNSvOutPortD(priv->PortOffset + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32));
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
return true; return true;
} }
...@@ -418,41 +418,41 @@ bool CARDbSetBeaconPeriod(struct vnt_private *pDevice, ...@@ -418,41 +418,41 @@ bool CARDbSetBeaconPeriod(struct vnt_private *pDevice,
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be turned off * priv - The adapter to be turned off
* Out: * Out:
* none * none
* *
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
*/ */
bool CARDbRadioPowerOff(struct vnt_private *pDevice) bool CARDbRadioPowerOff(struct vnt_private *priv)
{ {
bool bResult = true; bool bResult = true;
if (pDevice->bRadioOff) if (priv->bRadioOff)
return true; return true;
switch (pDevice->byRFType) { switch (priv->byRFType) {
case RF_RFMD2959: case RF_RFMD2959:
MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV); MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1); MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
break; break;
case RF_AIROHA: case RF_AIROHA:
case RF_AL2230S: case RF_AL2230S:
case RF_AIROHA7230: case RF_AIROHA7230:
MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE2); MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE2);
MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3); MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
break; break;
} }
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON); MACvRegBitsOff(priv->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
BBvSetDeepSleep(pDevice, pDevice->byLocalID); BBvSetDeepSleep(priv, priv->byLocalID);
pDevice->bRadioOff = true; priv->bRadioOff = true;
pr_debug("chester power off\n"); pr_debug("chester power off\n");
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); /* LED issue */ MACvRegBitsOn(priv->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); /* LED issue */
return bResult; return bResult;
} }
...@@ -461,89 +461,89 @@ bool CARDbRadioPowerOff(struct vnt_private *pDevice) ...@@ -461,89 +461,89 @@ bool CARDbRadioPowerOff(struct vnt_private *pDevice)
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be turned on * priv - The adapter to be turned on
* Out: * Out:
* none * none
* *
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
*/ */
bool CARDbRadioPowerOn(struct vnt_private *pDevice) bool CARDbRadioPowerOn(struct vnt_private *priv)
{ {
bool bResult = true; bool bResult = true;
pr_debug("chester power on\n"); pr_debug("chester power on\n");
if (pDevice->bRadioControlOff) { if (priv->bRadioControlOff) {
if (pDevice->bHWRadioOff) if (priv->bHWRadioOff)
pr_debug("chester bHWRadioOff\n"); pr_debug("chester bHWRadioOff\n");
if (pDevice->bRadioControlOff) if (priv->bRadioControlOff)
pr_debug("chester bRadioControlOff\n"); pr_debug("chester bRadioControlOff\n");
return false; } return false; }
if (!pDevice->bRadioOff) { if (!priv->bRadioOff) {
pr_debug("chester pbRadioOff\n"); pr_debug("chester pbRadioOff\n");
return true; } return true; }
BBvExitDeepSleep(pDevice, pDevice->byLocalID); BBvExitDeepSleep(priv, priv->byLocalID);
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON); MACvRegBitsOn(priv->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
switch (pDevice->byRFType) { switch (priv->byRFType) {
case RF_RFMD2959: case RF_RFMD2959:
MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV); MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1); MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
break; break;
case RF_AIROHA: case RF_AIROHA:
case RF_AL2230S: case RF_AL2230S:
case RF_AIROHA7230: case RF_AIROHA7230:
MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 | MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 |
SOFTPWRCTL_SWPE3)); SOFTPWRCTL_SWPE3));
break; break;
} }
pDevice->bRadioOff = false; priv->bRadioOff = false;
pr_debug("chester power on\n"); pr_debug("chester power on\n");
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); /* LED issue */ MACvRegBitsOff(priv->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); /* LED issue */
return bResult; return bResult;
} }
void void
CARDvSafeResetTx( CARDvSafeResetTx(
struct vnt_private *pDevice struct vnt_private *priv
) )
{ {
unsigned int uu; unsigned int uu;
struct vnt_tx_desc *pCurrTD; struct vnt_tx_desc *pCurrTD;
/* initialize TD index */ /* initialize TD index */
pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]); priv->apTailTD[0] = priv->apCurrTD[0] = &(priv->apTD0Rings[0]);
pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]); priv->apTailTD[1] = priv->apCurrTD[1] = &(priv->apTD1Rings[0]);
for (uu = 0; uu < TYPE_MAXTD; uu++) for (uu = 0; uu < TYPE_MAXTD; uu++)
pDevice->iTDUsed[uu] = 0; priv->iTDUsed[uu] = 0;
for (uu = 0; uu < pDevice->opts.tx_descs[0]; uu++) { for (uu = 0; uu < priv->opts.tx_descs[0]; uu++) {
pCurrTD = &(pDevice->apTD0Rings[uu]); pCurrTD = &(priv->apTD0Rings[uu]);
pCurrTD->td0.owner = OWNED_BY_HOST; pCurrTD->td0.owner = OWNED_BY_HOST;
/* init all Tx Packet pointer to NULL */ /* init all Tx Packet pointer to NULL */
} }
for (uu = 0; uu < pDevice->opts.tx_descs[1]; uu++) { for (uu = 0; uu < priv->opts.tx_descs[1]; uu++) {
pCurrTD = &(pDevice->apTD1Rings[uu]); pCurrTD = &(priv->apTD1Rings[uu]);
pCurrTD->td0.owner = OWNED_BY_HOST; pCurrTD->td0.owner = OWNED_BY_HOST;
/* init all Tx Packet pointer to NULL */ /* init all Tx Packet pointer to NULL */
} }
/* set MAC TD pointer */ /* set MAC TD pointer */
MACvSetCurrTXDescAddr(TYPE_TXDMA0, pDevice->PortOffset, MACvSetCurrTXDescAddr(TYPE_TXDMA0, priv->PortOffset,
(pDevice->td0_pool_dma)); (priv->td0_pool_dma));
MACvSetCurrTXDescAddr(TYPE_AC0DMA, pDevice->PortOffset, MACvSetCurrTXDescAddr(TYPE_AC0DMA, priv->PortOffset,
(pDevice->td1_pool_dma)); (priv->td1_pool_dma));
/* set MAC Beacon TX pointer */ /* set MAC Beacon TX pointer */
MACvSetCurrBCNTxDescAddr(pDevice->PortOffset, MACvSetCurrBCNTxDescAddr(priv->PortOffset,
(pDevice->tx_beacon_dma)); (priv->tx_beacon_dma));
} }
/* /*
...@@ -552,7 +552,7 @@ CARDvSafeResetTx( ...@@ -552,7 +552,7 @@ CARDvSafeResetTx(
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - Pointer to the adapter * priv - Pointer to the adapter
* Out: * Out:
* none * none
* *
...@@ -560,41 +560,41 @@ CARDvSafeResetTx( ...@@ -560,41 +560,41 @@ CARDvSafeResetTx(
*/ */
void void
CARDvSafeResetRx( CARDvSafeResetRx(
struct vnt_private *pDevice struct vnt_private *priv
) )
{ {
unsigned int uu; unsigned int uu;
struct vnt_rx_desc *pDesc; struct vnt_rx_desc *pDesc;
/* initialize RD index */ /* initialize RD index */
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]); priv->pCurrRD[0] = &(priv->aRD0Ring[0]);
pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]); priv->pCurrRD[1] = &(priv->aRD1Ring[0]);
/* init state, all RD is chip's */ /* init state, all RD is chip's */
for (uu = 0; uu < pDevice->opts.rx_descs0; uu++) { for (uu = 0; uu < priv->opts.rx_descs0; uu++) {
pDesc = &(pDevice->aRD0Ring[uu]); pDesc = &(priv->aRD0Ring[uu]);
pDesc->rd0.res_count = cpu_to_le16(pDevice->rx_buf_sz); pDesc->rd0.res_count = cpu_to_le16(priv->rx_buf_sz);
pDesc->rd0.owner = OWNED_BY_NIC; pDesc->rd0.owner = OWNED_BY_NIC;
pDesc->rd1.req_count = cpu_to_le16(pDevice->rx_buf_sz); pDesc->rd1.req_count = cpu_to_le16(priv->rx_buf_sz);
} }
/* init state, all RD is chip's */ /* init state, all RD is chip's */
for (uu = 0; uu < pDevice->opts.rx_descs1; uu++) { for (uu = 0; uu < priv->opts.rx_descs1; uu++) {
pDesc = &(pDevice->aRD1Ring[uu]); pDesc = &(priv->aRD1Ring[uu]);
pDesc->rd0.res_count = cpu_to_le16(pDevice->rx_buf_sz); pDesc->rd0.res_count = cpu_to_le16(priv->rx_buf_sz);
pDesc->rd0.owner = OWNED_BY_NIC; pDesc->rd0.owner = OWNED_BY_NIC;
pDesc->rd1.req_count = cpu_to_le16(pDevice->rx_buf_sz); pDesc->rd1.req_count = cpu_to_le16(priv->rx_buf_sz);
} }
/* set perPkt mode */ /* set perPkt mode */
MACvRx0PerPktMode(pDevice->PortOffset); MACvRx0PerPktMode(priv->PortOffset);
MACvRx1PerPktMode(pDevice->PortOffset); MACvRx1PerPktMode(priv->PortOffset);
/* set MAC RD pointer */ /* set MAC RD pointer */
MACvSetCurrRx0DescAddr(pDevice->PortOffset, MACvSetCurrRx0DescAddr(priv->PortOffset,
pDevice->rd0_pool_dma); priv->rd0_pool_dma);
MACvSetCurrRx1DescAddr(pDevice->PortOffset, MACvSetCurrRx1DescAddr(priv->PortOffset,
pDevice->rd1_pool_dma); priv->rd1_pool_dma);
} }
/* /*
...@@ -602,20 +602,20 @@ CARDvSafeResetRx( ...@@ -602,20 +602,20 @@ CARDvSafeResetRx(
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set * priv - The adapter to be set
* wRateIdx - Receiving data rate * wRateIdx - Receiving data rate
* Out: * Out:
* none * none
* *
* Return Value: response Control frame rate * Return Value: response Control frame rate
*/ */
static unsigned short CARDwGetCCKControlRate(struct vnt_private *pDevice, static unsigned short CARDwGetCCKControlRate(struct vnt_private *priv,
unsigned short wRateIdx) unsigned short wRateIdx)
{ {
unsigned int ui = (unsigned int) wRateIdx; unsigned int ui = (unsigned int) wRateIdx;
while (ui > RATE_1M) { while (ui > RATE_1M) {
if (pDevice->basic_rates & ((u32)0x1 << ui)) if (priv->basic_rates & ((u32)0x1 << ui))
return (unsigned short)ui; return (unsigned short)ui;
ui--; ui--;
...@@ -628,28 +628,28 @@ static unsigned short CARDwGetCCKControlRate(struct vnt_private *pDevice, ...@@ -628,28 +628,28 @@ static unsigned short CARDwGetCCKControlRate(struct vnt_private *pDevice,
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set * priv - The adapter to be set
* wRateIdx - Receiving data rate * wRateIdx - Receiving data rate
* Out: * Out:
* none * none
* *
* Return Value: response Control frame rate * Return Value: response Control frame rate
*/ */
static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice, static unsigned short CARDwGetOFDMControlRate(struct vnt_private *priv,
unsigned short wRateIdx) unsigned short wRateIdx)
{ {
unsigned int ui = (unsigned int) wRateIdx; unsigned int ui = (unsigned int) wRateIdx;
pr_debug("BASIC RATE: %X\n", pDevice->basic_rates); pr_debug("BASIC RATE: %X\n", priv->basic_rates);
if (!CARDbIsOFDMinBasicRate((void *)pDevice)) { if (!CARDbIsOFDMinBasicRate((void *)priv)) {
pr_debug("CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx); pr_debug("CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx);
if (wRateIdx > RATE_24M) if (wRateIdx > RATE_24M)
wRateIdx = RATE_24M; wRateIdx = RATE_24M;
return wRateIdx; return wRateIdx;
} }
while (ui > RATE_11M) { while (ui > RATE_11M) {
if (pDevice->basic_rates & ((u32)0x1 << ui)) { if (priv->basic_rates & ((u32)0x1 << ui)) {
pr_debug("CARDwGetOFDMControlRate : %d\n", ui); pr_debug("CARDwGetOFDMControlRate : %d\n", ui);
return (unsigned short)ui; return (unsigned short)ui;
} }
...@@ -664,162 +664,162 @@ static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice, ...@@ -664,162 +664,162 @@ static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice,
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set * priv - The adapter to be set
* Out: * Out:
* none * none
* *
* Return Value: None. * Return Value: None.
*/ */
void CARDvSetRSPINF(struct vnt_private *pDevice, u8 bb_type) void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type)
{ {
union vnt_phy_field_swap phy; union vnt_phy_field_swap phy;
unsigned char byTxRate, byRsvTime; /* For OFDM */ unsigned char byTxRate, byRsvTime; /* For OFDM */
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&pDevice->lock, flags); spin_lock_irqsave(&priv->lock, flags);
/* Set to Page1 */ /* Set to Page1 */
MACvSelectPage1(pDevice->PortOffset); MACvSelectPage1(priv->PortOffset);
/* RSPINF_b_1 */ /* RSPINF_b_1 */
vnt_get_phy_field(pDevice, 14, vnt_get_phy_field(priv, 14,
CARDwGetCCKControlRate(pDevice, RATE_1M), CARDwGetCCKControlRate(priv, RATE_1M),
PK_TYPE_11B, &phy.field_read); PK_TYPE_11B, &phy.field_read);
/* swap over to get correct write order */ /* swap over to get correct write order */
swap(phy.swap[0], phy.swap[1]); swap(phy.swap[0], phy.swap[1]);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write); VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write);
/* RSPINF_b_2 */ /* RSPINF_b_2 */
vnt_get_phy_field(pDevice, 14, vnt_get_phy_field(priv, 14,
CARDwGetCCKControlRate(pDevice, RATE_2M), CARDwGetCCKControlRate(priv, RATE_2M),
PK_TYPE_11B, &phy.field_read); PK_TYPE_11B, &phy.field_read);
swap(phy.swap[0], phy.swap[1]); swap(phy.swap[0], phy.swap[1]);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write); VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write);
/* RSPINF_b_5 */ /* RSPINF_b_5 */
vnt_get_phy_field(pDevice, 14, vnt_get_phy_field(priv, 14,
CARDwGetCCKControlRate(pDevice, RATE_5M), CARDwGetCCKControlRate(priv, RATE_5M),
PK_TYPE_11B, &phy.field_read); PK_TYPE_11B, &phy.field_read);
swap(phy.swap[0], phy.swap[1]); swap(phy.swap[0], phy.swap[1]);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write); VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write);
/* RSPINF_b_11 */ /* RSPINF_b_11 */
vnt_get_phy_field(pDevice, 14, vnt_get_phy_field(priv, 14,
CARDwGetCCKControlRate(pDevice, RATE_11M), CARDwGetCCKControlRate(priv, RATE_11M),
PK_TYPE_11B, &phy.field_read); PK_TYPE_11B, &phy.field_read);
swap(phy.swap[0], phy.swap[1]); swap(phy.swap[0], phy.swap[1]);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write); VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write);
/* RSPINF_a_6 */ /* RSPINF_a_6 */
s_vCalculateOFDMRParameter(RATE_6M, s_vCalculateOFDMRParameter(RATE_6M,
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_6, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_6, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_9 */ /* RSPINF_a_9 */
s_vCalculateOFDMRParameter(RATE_9M, s_vCalculateOFDMRParameter(RATE_9M,
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_9, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_9, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_12 */ /* RSPINF_a_12 */
s_vCalculateOFDMRParameter(RATE_12M, s_vCalculateOFDMRParameter(RATE_12M,
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_12, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_12, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_18 */ /* RSPINF_a_18 */
s_vCalculateOFDMRParameter(RATE_18M, s_vCalculateOFDMRParameter(RATE_18M,
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_18, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_18, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_24 */ /* RSPINF_a_24 */
s_vCalculateOFDMRParameter(RATE_24M, s_vCalculateOFDMRParameter(RATE_24M,
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_24, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_24, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_36 */ /* RSPINF_a_36 */
s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_36M), s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, RATE_36M),
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_36, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_36, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_48 */ /* RSPINF_a_48 */
s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_48M), s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, RATE_48M),
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_48, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_48, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_54 */ /* RSPINF_a_54 */
s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_54M), s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, RATE_54M),
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_54, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_54, MAKEWORD(byTxRate, byRsvTime));
/* RSPINF_a_72 */ /* RSPINF_a_72 */
s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_54M), s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, RATE_54M),
bb_type, bb_type,
&byTxRate, &byTxRate,
&byRsvTime); &byRsvTime);
VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate, byRsvTime)); VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate, byRsvTime));
/* Set to Page0 */ /* Set to Page0 */
MACvSelectPage0(pDevice->PortOffset); MACvSelectPage0(priv->PortOffset);
spin_unlock_irqrestore(&pDevice->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
} }
void CARDvUpdateBasicTopRate(struct vnt_private *pDevice) void CARDvUpdateBasicTopRate(struct vnt_private *priv)
{ {
unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M; unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M;
unsigned char ii; unsigned char ii;
/* Determines the highest basic rate. */ /* Determines the highest basic rate. */
for (ii = RATE_54M; ii >= RATE_6M; ii--) { for (ii = RATE_54M; ii >= RATE_6M; ii--) {
if ((pDevice->basic_rates) & ((u32)(1 << ii))) { if ((priv->basic_rates) & ((u32)(1 << ii))) {
byTopOFDM = ii; byTopOFDM = ii;
break; break;
} }
} }
pDevice->byTopOFDMBasicRate = byTopOFDM; priv->byTopOFDMBasicRate = byTopOFDM;
for (ii = RATE_11M;; ii--) { for (ii = RATE_11M;; ii--) {
if ((pDevice->basic_rates) & ((u32)(1 << ii))) { if ((priv->basic_rates) & ((u32)(1 << ii))) {
byTopCCK = ii; byTopCCK = ii;
break; break;
} }
if (ii == RATE_1M) if (ii == RATE_1M)
break; break;
} }
pDevice->byTopCCKBasicRate = byTopCCK; priv->byTopCCKBasicRate = byTopCCK;
} }
bool CARDbIsOFDMinBasicRate(struct vnt_private *pDevice) bool CARDbIsOFDMinBasicRate(struct vnt_private *priv)
{ {
int ii; int ii;
for (ii = RATE_54M; ii >= RATE_6M; ii--) { for (ii = RATE_54M; ii >= RATE_6M; ii--) {
if ((pDevice->basic_rates) & ((u32)BIT(ii))) if ((priv->basic_rates) & ((u32)BIT(ii)))
return true; return true;
} }
return false; return false;
} }
unsigned char CARDbyGetPktType(struct vnt_private *pDevice) unsigned char CARDbyGetPktType(struct vnt_private *priv)
{ {
if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) if (priv->byBBType == BB_TYPE_11A || priv->byBBType == BB_TYPE_11B)
return (unsigned char)pDevice->byBBType; return (unsigned char)priv->byBBType;
else if (CARDbIsOFDMinBasicRate((void *)pDevice)) else if (CARDbIsOFDMinBasicRate((void *)priv))
return PK_TYPE_11GA; return PK_TYPE_11GA;
else else
return PK_TYPE_11GB; return PK_TYPE_11GB;
...@@ -830,7 +830,7 @@ unsigned char CARDbyGetPktType(struct vnt_private *pDevice) ...@@ -830,7 +830,7 @@ unsigned char CARDbyGetPktType(struct vnt_private *pDevice)
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set * priv - The adapter to be set
* wLoopbackMode - Loopback mode to be set * wLoopbackMode - Loopback mode to be set
* Out: * Out:
* none * none
...@@ -859,17 +859,17 @@ void CARDvSetLoopbackMode(struct vnt_private *priv, unsigned short wLoopbackMode ...@@ -859,17 +859,17 @@ void CARDvSetLoopbackMode(struct vnt_private *priv, unsigned short wLoopbackMode
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be reset * priv - The adapter to be reset
* Out: * Out:
* none * none
* *
* Return Value: none * Return Value: none
*/ */
bool CARDbSoftwareReset(struct vnt_private *pDevice) bool CARDbSoftwareReset(struct vnt_private *priv)
{ {
/* reset MAC */ /* reset MAC */
if (!MACbSafeSoftwareReset(pDevice->PortOffset)) if (!MACbSafeSoftwareReset(priv->PortOffset))
return false; return false;
return true; return true;
...@@ -881,7 +881,7 @@ bool CARDbSoftwareReset(struct vnt_private *pDevice) ...@@ -881,7 +881,7 @@ bool CARDbSoftwareReset(struct vnt_private *pDevice)
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be sync. * priv - The adapter to be sync.
* qwTSF1 - Rx BCN's TSF * qwTSF1 - Rx BCN's TSF
* qwTSF2 - Local TSF * qwTSF2 - Local TSF
* Out: * Out:
...@@ -909,7 +909,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2) ...@@ -909,7 +909,7 @@ u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2)
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be read * priv - The adapter to be read
* Out: * Out:
* qwCurrTSF - Current TSF counter * qwCurrTSF - Current TSF counter
* *
...@@ -995,7 +995,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv, unsigned short wBeaconInter ...@@ -995,7 +995,7 @@ void CARDvSetFirstNextTBTT(struct vnt_private *priv, unsigned short wBeaconInter
* *
* Parameters: * Parameters:
* In: * In:
* pDevice - The adapter to be set * priv - The adapter to be set
* qwTSF - Current TSF counter * qwTSF - Current TSF counter
* wBeaconInterval - Beacon Interval * wBeaconInterval - Beacon Interval
* Out: * Out:
......
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