diff options
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r-- | drivers/staging/vt6656/mac.c | 51 | ||||
-rw-r--r-- | drivers/staging/vt6656/rf.c | 657 | ||||
-rw-r--r-- | drivers/staging/vt6656/tether.h | 10 | ||||
-rw-r--r-- | drivers/staging/vt6656/tmacro.h | 6 |
4 files changed, 336 insertions, 388 deletions
diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index 343db19..54414ed27 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -101,7 +101,7 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType) MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -122,18 +122,10 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType) */ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) { - u16 wOffset; u8 byData; byData = (u8) uEntryIdx; - wOffset = MISCFIFO_KEYETRY0; - wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE); - - //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); - //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0); - //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - //issue write misc fifo command to device CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CLRKEYENTRY, @@ -182,12 +174,6 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\ " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); - //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); - //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); - //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - - //wOffset++; - dwData2 = 0; dwData2 |= *(pbyAddr+3); dwData2 <<= 8; @@ -200,21 +186,6 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n", wOffset, dwData2); - //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); - //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); - //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - - //wOffset++; - - //wOffset += (uKeyIdx * 4); -/* for (ii=0;ii<4;ii++) { - // alway push 128 bits - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey); - VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii); - VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++); - VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE); - } -*/ pbyKey = (u8 *)pdwKey; pbyData[0] = (u8)dwData1; @@ -232,7 +203,7 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, MESSAGE_TYPE_SETKEY, wOffset, (u16)uKeyIdx, - 24, + ARRAY_SIZE(pbyData), pbyData ); @@ -249,7 +220,7 @@ void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) MESSAGE_TYPE_WRITE_MASK, byRegOfs, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -265,7 +236,7 @@ void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) MESSAGE_TYPE_WRITE_MASK, byRegOfs, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -281,7 +252,7 @@ void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) MESSAGE_TYPE_WRITE, byRegOfs, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); @@ -302,7 +273,7 @@ void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) MESSAGE_TYPE_WRITE, MAC_REG_BSSID0, MESSAGE_REQUEST_MACREG, - 6, + ARRAY_SIZE(pbyData), pbyData ); } @@ -318,7 +289,7 @@ void MACvEnableProtectMD(struct vnt_private *pDevice) MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -334,7 +305,7 @@ void MACvDisableProtectMD(struct vnt_private *pDevice) MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG0, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -350,7 +321,7 @@ void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -366,7 +337,7 @@ void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) MESSAGE_TYPE_WRITE_MASK, MAC_REG_ENCFG2, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } @@ -382,7 +353,7 @@ void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) MESSAGE_TYPE_WRITE, MAC_REG_BI, MESSAGE_REQUEST_MACREG, - 2, + ARRAY_SIZE(pbyData), pbyData ); } diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 44cfe0b..d27fa43 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -29,6 +29,9 @@ * IFRFbWriteEmbedded - Embedded write RF register via MAC * * Revision History: + * RF_VT3226: RobertYu:20051111, VT3226C0 and before + * RF_VT3226D0: RobertYu:20051228 + * RF_VT3342A0: RobertYu:20060609 * */ @@ -61,7 +64,7 @@ static int msglevel =MSG_LEVEL_INFO; #define VT3342_PWR_IDX_LEN 64 //}} -u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { +static u8 al2230_init_table[CB_AL2230_INIT_SEQ][3] = { {0x03, 0xF7, 0x90}, {0x03, 0x33, 0x31}, {0x01, 0xB8, 0x02}, @@ -79,7 +82,7 @@ u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x00, 0x58, 0x0F} }; -u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { +static u8 al2230_channel_table0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0xF7, 0x90}, // channel = 1, Tf = 2412MHz {0x03, 0xF7, 0x90}, // channel = 2, Tf = 2417MHz {0x03, 0xE7, 0x90}, // channel = 3, Tf = 2422MHz @@ -96,7 +99,7 @@ u8 abyAL2230ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0xE7, 0xC0} // channel = 14, Tf = 2412M }; -u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { +static u8 al2230_channel_table1[CB_MAX_CHANNEL_24G][3] = { {0x03, 0x33, 0x31}, // channel = 1, Tf = 2412MHz {0x0B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz @@ -115,7 +118,7 @@ u8 abyAL2230ChannelTable1[CB_MAX_CHANNEL_24G][3] = { // 40MHz reference frequency // Need to Pull PLLON(PE3) low when writing channel registers through 3-wire. -u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { +static u8 al7230_init_table[CB_AL7230_INIT_SEQ][3] = { {0x20, 0x37, 0x90}, // Channel1 // Need modify for 11a {0x13, 0x33, 0x31}, // Channel1 // Need modify for 11a {0x84, 0x1F, 0xF2}, // Need modify for 11a: 451FE2 @@ -138,7 +141,7 @@ u8 abyAL7230InitTable[CB_AL7230_INIT_SEQ][3] = { {0x1A, 0xBA, 0x8F} // Need modify for 11a: 12BACF }; -u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { +static u8 al7230_init_table_amode[CB_AL7230_INIT_SEQ][3] = { {0x2F, 0xF5, 0x20}, // Channel184 // Need modify for 11b/g {0x00, 0x00, 0x01}, // Channel184 // Need modify for 11b/g {0x45, 0x1F, 0xE2}, // Need modify for 11b/g @@ -157,7 +160,7 @@ u8 abyAL7230InitTableAMode[CB_AL7230_INIT_SEQ][3] = { {0x12, 0xBA, 0xCF} // Need modify for 11b/g }; -u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { +static u8 al7230_channel_table0[CB_MAX_CHANNEL][3] = { {0x20, 0x37, 0x90}, // channel = 1, Tf = 2412MHz {0x20, 0x37, 0x90}, // channel = 2, Tf = 2417MHz {0x20, 0x37, 0x90}, // channel = 3, Tf = 2422MHz @@ -223,7 +226,7 @@ u8 abyAL7230ChannelTable0[CB_MAX_CHANNEL][3] = { {0x2F, 0xF6, 0x10} // channel = 165, Tf = 5825MHz (56) }; -u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { +static u8 al7230_channel_table1[CB_MAX_CHANNEL][3] = { {0x13, 0x33, 0x31}, // channel = 1, Tf = 2412MHz {0x1B, 0x33, 0x31}, // channel = 2, Tf = 2417MHz {0x03, 0x33, 0x31}, // channel = 3, Tf = 2422MHz @@ -287,7 +290,7 @@ u8 abyAL7230ChannelTable1[CB_MAX_CHANNEL][3] = { {0x02, 0xAA, 0xB1} // channel = 165, Tf = 5825MHz (56) }; -u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { +static u8 al7230_channel_table2[CB_MAX_CHANNEL][3] = { {0x7F, 0xD7, 0x84}, // channel = 1, Tf = 2412MHz {0x7F, 0xD7, 0x84}, // channel = 2, Tf = 2417MHz {0x7F, 0xD7, 0x84}, // channel = 3, Tf = 2422MHz @@ -352,7 +355,7 @@ u8 abyAL7230ChannelTable2[CB_MAX_CHANNEL][3] = { }; ///{{RobertYu:20051111 -u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { +static u8 at3226_init_table[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xFF, 0x80}, {0x02, 0x82, 0xA1}, {0x03, 0xC6, 0xA2}, @@ -366,7 +369,7 @@ u8 abyVT3226_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x02, 0x00, 0x2A} }; -u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { +static u8 at3226d0_init_table[CB_VT3226_INIT_SEQ][3] = { {0x03, 0xFF, 0x80}, {0x03, 0x02, 0x21}, //RobertYu:20060327 {0x03, 0xC6, 0xA2}, @@ -380,7 +383,7 @@ u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x02, 0x01, 0xAA} //RobertYu:20060523 }; -u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { +static u8 vt3226_channel_table0[CB_MAX_CHANNEL_24G][3] = { {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz {0x01, 0x97, 0x93}, // channel = 3, Tf = 2422MHz @@ -397,7 +400,7 @@ u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x03, 0x37, 0xC3} // channel = 14, Tf = 2484MHz }; -u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { +static u8 vt3226_channel_table1[CB_MAX_CHANNEL_24G][3] = { {0x02, 0x66, 0x64}, // channel = 1, Tf = 2412MHz {0x03, 0x66, 0x64}, // channel = 2, Tf = 2417MHz {0x00, 0x66, 0x64}, // channel = 3, Tf = 2422MHz @@ -416,7 +419,7 @@ u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { ///}}RobertYu //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode -u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { +const u32 vt3226d0_lo_current_table[CB_MAX_CHANNEL_24G] = { 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz 0x0235C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz @@ -435,7 +438,7 @@ u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { //}} //{{RobertYu:20060609 -u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ +static u8 vt3342a0_init_table[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ {0x03, 0xFF, 0x80}, //update for mode// {0x02, 0x08, 0x81}, {0x00, 0xC6, 0x02}, @@ -458,7 +461,7 @@ u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ // channel56, 5280MHz 0x00C402 for disable Frac // other channels 0x00C602 -u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { +static u8 vt3342_channel_table0[CB_MAX_CHANNEL][3] = { {0x02, 0x05, 0x03}, // channel = 1, Tf = 2412MHz {0x01, 0x15, 0x03}, // channel = 2, Tf = 2417MHz {0x03, 0xC5, 0x03}, // channel = 3, Tf = 2422MHz @@ -524,7 +527,7 @@ u8 abyVT3342_ChannelTable0[CB_MAX_CHANNEL][3] = { {0x00, 0x06, 0x03} // channel = 165, Tf = 5825MHz (56), TBD }; -u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { +static u8 vt3342_channel_table1[CB_MAX_CHANNEL][3] = { {0x01, 0x99, 0x94}, // channel = 1, Tf = 2412MHz {0x02, 0x44, 0x44}, // channel = 2, Tf = 2417MHz {0x02, 0xEE, 0xE4}, // channel = 3, Tf = 2422MHz @@ -594,7 +597,7 @@ u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { * -*/ -const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { +const u32 al2230_power_table[AL2230_PWR_IDX_LEN] = { 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, @@ -732,42 +735,41 @@ int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData) * Return Value: true if succeeded; false if failed. * */ -int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH) +int RFbSetPower(struct vnt_private *priv, u32 rate, u32 channel) { - int bResult = true; - u8 byPwr = pDevice->byCCKPwr; + int ret = true; + u8 power = priv->byCCKPwr; - if (pDevice->dwDiagRefCount) + if (priv->dwDiagRefCount) return true; - if (uCH == 0) + if (channel == 0) return -EINVAL; - switch (uRATE) { - case RATE_1M: - case RATE_2M: - case RATE_5M: - case RATE_11M: - byPwr = pDevice->abyCCKPwrTbl[uCH-1]; - break; - case RATE_6M: - case RATE_9M: - case RATE_18M: - case RATE_24M: - case RATE_36M: - case RATE_48M: - case RATE_54M: - if (uCH > CB_MAX_CHANNEL_24G) { - byPwr = pDevice->abyOFDMAPwrTbl[uCH-15]; - } else { - byPwr = pDevice->abyOFDMPwrTbl[uCH-1]; - } - break; - } - - bResult = RFbRawSetPower(pDevice, byPwr, uRATE); - - return bResult; + switch (rate) { + case RATE_1M: + case RATE_2M: + case RATE_5M: + case RATE_11M: + power = priv->abyCCKPwrTbl[channel-1]; + break; + case RATE_6M: + case RATE_9M: + case RATE_18M: + case RATE_24M: + case RATE_36M: + case RATE_48M: + case RATE_54M: + if (channel > CB_MAX_CHANNEL_24G) + power = priv->abyOFDMAPwrTbl[channel-15]; + else + power = priv->abyOFDMPwrTbl[channel-1]; + break; + } + + ret = RFbRawSetPower(priv, power, rate); + + return ret; } /* @@ -784,136 +786,146 @@ int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH) * */ -int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) +int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate) { - int bResult = true; - - if (pDevice->byCurPwr == byPwr) - return true; - - pDevice->byCurPwr = byPwr; - - switch (pDevice->byRFType) { - - case RF_AL2230 : - if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN) - return false; - bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]); - if (uRATE <= RATE_11M) - bResult &= IFRFbWriteEmbedded(pDevice, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); - else - bResult &= IFRFbWriteEmbedded(pDevice, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); - break; - - case RF_AL2230S : - if (pDevice->byCurPwr >= AL2230_PWR_IDX_LEN) - return false; - bResult &= IFRFbWriteEmbedded(pDevice, dwAL2230PowerTable[pDevice->byCurPwr]); - if (uRATE <= RATE_11M) { - bResult &= IFRFbWriteEmbedded(pDevice, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); - bResult &= IFRFbWriteEmbedded(pDevice, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); - }else { - bResult &= IFRFbWriteEmbedded(pDevice, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); - bResult &= IFRFbWriteEmbedded(pDevice, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW); - } - break; - - case RF_AIROHA7230: - { - u32 dwMax7230Pwr; - - if (uRATE <= RATE_11M) { //RobertYu:20060426, for better 11b mask - bResult &= IFRFbWriteEmbedded(pDevice, 0x111BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW); - } - else { - bResult &= IFRFbWriteEmbedded(pDevice, 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW); - } - - if (pDevice->byCurPwr > AL7230_PWR_IDX_LEN) return false; - - // 0x080F1B00 for 3 wire control TxGain(D10) and 0x31 as TX Gain value - dwMax7230Pwr = 0x080C0B00 | ( (pDevice->byCurPwr) << 12 ) | - (BY_AL7230_REG_LEN << 3 ) | IFREGCTL_REGW; - - bResult &= IFRFbWriteEmbedded(pDevice, dwMax7230Pwr); - break; - } - break; - - case RF_VT3226: //RobertYu:20051111, VT3226C0 and before - { - u32 dwVT3226Pwr; - - if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN) - return false; - dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x17 << 8 ) /* Reg7 */ | - (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW; - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr); - break; - } - - case RF_VT3226D0: //RobertYu:20051228 - { - u32 dwVT3226Pwr; - - if (pDevice->byCurPwr >= VT3226_PWR_IDX_LEN) - return false; - - if (uRATE <= RATE_11M) { - - dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0xE07 << 8 ) /* Reg7 */ | //RobertYu:20060420, TWIF 1.10 - (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW; - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr); - - bResult &= IFRFbWriteEmbedded(pDevice, 0x03C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); - if (pDevice->vnt_mgmt.eScanState != WMAC_NO_SCANNING) { - /* scanning, channel number is pDevice->uScanChannel */ - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + u32 power_setting = 0; + int ret = true; + + if (priv->byCurPwr == power) + return true; + + priv->byCurPwr = power; + + switch (priv->byRFType) { + case RF_AL2230: + if (priv->byCurPwr >= AL2230_PWR_IDX_LEN) + return false; + + ret &= IFRFbWriteEmbedded(priv, + al2230_power_table[priv->byCurPwr]); + + if (rate <= RATE_11M) + ret &= IFRFbWriteEmbedded(priv, 0x0001b400 + + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + else + ret &= IFRFbWriteEmbedded(priv, 0x0005a400 + + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + break; + case RF_AL2230S: + if (priv->byCurPwr >= AL2230_PWR_IDX_LEN) + return false; + + ret &= IFRFbWriteEmbedded(priv, + al2230_power_table[priv->byCurPwr]); + + if (rate <= RATE_11M) { + ret &= IFRFbWriteEmbedded(priv, 0x040c1400 + + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + ret &= IFRFbWriteEmbedded(priv, 0x00299b00 + + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + } else { + ret &= IFRFbWriteEmbedded(priv, 0x0005a400 + + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + ret &= IFRFbWriteEmbedded(priv, 0x00099b00 + + (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); + } + break; + + case RF_AIROHA7230: + if (rate <= RATE_11M) + ret &= IFRFbWriteEmbedded(priv, 0x111bb900 + + (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); + else + ret &= IFRFbWriteEmbedded(priv, 0x221bb900 + + (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); + + if (priv->byCurPwr > AL7230_PWR_IDX_LEN) + return false; + + /* + * 0x080F1B00 for 3 wire control TxGain(D10) + * and 0x31 as TX Gain value + */ + power_setting = 0x080c0b00 | ((priv->byCurPwr) << 12) | + (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW; + + ret &= IFRFbWriteEmbedded(priv, power_setting); + + break; + + case RF_VT3226: + if (priv->byCurPwr >= VT3226_PWR_IDX_LEN) + return false; + power_setting = ((0x3f - priv->byCurPwr) << 20) | (0x17 << 8) | + (BY_VT3226_REG_LEN << 3) | IFREGCTL_REGW; + + ret &= IFRFbWriteEmbedded(priv, power_setting); + + break; + case RF_VT3226D0: + if (priv->byCurPwr >= VT3226_PWR_IDX_LEN) + return false; + + if (rate <= RATE_11M) { + power_setting = ((0x3f-priv->byCurPwr) << 20) | + (0xe07 << 8) | (BY_VT3226_REG_LEN << 3) | + IFREGCTL_REGW; + + ret &= IFRFbWriteEmbedded(priv, power_setting); + ret &= IFRFbWriteEmbedded(priv, 0x03c6a200 + + (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); + + if (priv->vnt_mgmt.eScanState != WMAC_NO_SCANNING) { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO + "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", + priv->vnt_mgmt.uScanChannel); + ret &= IFRFbWriteEmbedded(priv, + vt3226d0_lo_current_table[priv-> + vnt_mgmt.uScanChannel - 1]); + } else { + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", - pDevice->vnt_mgmt.uScanChannel); - bResult &= IFRFbWriteEmbedded(pDevice, - dwVT3226D0LoCurrentTable[pDevice-> - vnt_mgmt.uScanChannel - 1]); + priv->vnt_mgmt.uCurrChannel); + ret &= IFRFbWriteEmbedded(priv, + vt3226d0_lo_current_table[priv-> + vnt_mgmt.uCurrChannel - 1]); + } + + ret &= IFRFbWriteEmbedded(priv, 0x015C0800 + + (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); } else { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO - "RFbRawSetPower> 11B mode uCurrChannel[%d]\n", - pDevice->vnt_mgmt.uCurrChannel); - bResult &= IFRFbWriteEmbedded(pDevice, - dwVT3226D0LoCurrentTable[pDevice-> - vnt_mgmt.uCurrChannel - 1]); + "@@@@ RFbRawSetPower> 11G mode\n"); + + power_setting = ((0x3f-priv->byCurPwr) << 20) | + (0x7 << 8) | (BY_VT3226_REG_LEN << 3) | + IFREGCTL_REGW; + + ret &= IFRFbWriteEmbedded(priv, power_setting); + ret &= IFRFbWriteEmbedded(priv, 0x00C6A200 + + (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); + ret &= IFRFbWriteEmbedded(priv, 0x016BC600 + + (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); + ret &= IFRFbWriteEmbedded(priv, 0x00900800 + + (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); } + break; + + case RF_VT3342A0: + if (priv->byCurPwr >= VT3342_PWR_IDX_LEN) + return false; + + power_setting = ((0x3F-priv->byCurPwr) << 20) | + (0x27 << 8) | (BY_VT3342_REG_LEN << 3) | + IFREGCTL_REGW; - bResult &= IFRFbWriteEmbedded(pDevice, 0x015C0800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060420, ok now, new switching power (mini-pci can have bigger power consumption) - } else { - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"@@@@ RFbRawSetPower> 11G mode\n"); - dwVT3226Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x7 << 8 ) /* Reg7 */ | //RobertYu:20060420, TWIF 1.10 - (BY_VT3226_REG_LEN << 3 ) | IFREGCTL_REGW; - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3226Pwr); - bResult &= IFRFbWriteEmbedded(pDevice, 0x00C6A200+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060327 - bResult &= IFRFbWriteEmbedded(pDevice, 0x016BC600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060111 - bResult &= IFRFbWriteEmbedded(pDevice, 0x00900800+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW); //RobertYu:20060111 - } - break; - } - - //{{RobertYu:20060609 - case RF_VT3342A0: - { - u32 dwVT3342Pwr; - - if (pDevice->byCurPwr >= VT3342_PWR_IDX_LEN) - return false; - - dwVT3342Pwr = ((0x3F-pDevice->byCurPwr) << 20 ) | ( 0x27 << 8 ) /* Reg7 */ | - (BY_VT3342_REG_LEN << 3 ) | IFREGCTL_REGW; - bResult &= IFRFbWriteEmbedded(pDevice, dwVT3342Pwr); - break; - } - - default : - break; - } - return bResult; + ret &= IFRFbWriteEmbedded(priv, power_setting); + + break; + default: + break; + } + return ret; } /*+ @@ -931,169 +943,150 @@ int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) * Return Value: none * -*/ -void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm) +void RFvRSSITodBm(struct vnt_private *priv, u8 rssi, long *dbm) { - u8 byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03); - signed long b = (byCurrRSSI & 0x3F); - signed long a = 0; - u8 abyAIROHARF[4] = {0, 18, 0, 40}; - - switch (pDevice->byRFType) { - case RF_AL2230: - case RF_AL2230S: - case RF_AIROHA7230: - case RF_VT3226: //RobertYu:20051111 - case RF_VT3226D0: - case RF_VT3342A0: //RobertYu:20060609 - a = abyAIROHARF[byIdx]; - break; - default: - break; - } - - *pldBm = -1 * (a + b * 2); + u8 idx = (((rssi & 0xc0) >> 6) & 0x03); + long b = (rssi & 0x3f); + long a = 0; + u8 airoharf[4] = {0, 18, 0, 40}; + + switch (priv->byRFType) { + case RF_AL2230: + case RF_AL2230S: + case RF_AIROHA7230: + case RF_VT3226: + case RF_VT3226D0: + case RF_VT3342A0: + a = airoharf[idx]; + break; + default: + break; + } + + *dbm = -1 * (a + b * 2); } -void RFbRFTableDownload(struct vnt_private *pDevice) +void RFbRFTableDownload(struct vnt_private *priv) { - u16 wLength1 = 0, wLength2 = 0, wLength3 = 0; - u8 *pbyAddr1 = NULL, *pbyAddr2 = NULL, *pbyAddr3 = NULL; - u16 wLength, wValue; - u8 abyArray[256]; - - switch ( pDevice->byRFType ) { - case RF_AL2230: - case RF_AL2230S: - wLength1 = CB_AL2230_INIT_SEQ * 3; - wLength2 = CB_MAX_CHANNEL_24G * 3; - wLength3 = CB_MAX_CHANNEL_24G * 3; - pbyAddr1 = &(abyAL2230InitTable[0][0]); - pbyAddr2 = &(abyAL2230ChannelTable0[0][0]); - pbyAddr3 = &(abyAL2230ChannelTable1[0][0]); - break; - case RF_AIROHA7230: - wLength1 = CB_AL7230_INIT_SEQ * 3; - wLength2 = CB_MAX_CHANNEL * 3; - wLength3 = CB_MAX_CHANNEL * 3; - pbyAddr1 = &(abyAL7230InitTable[0][0]); - pbyAddr2 = &(abyAL7230ChannelTable0[0][0]); - pbyAddr3 = &(abyAL7230ChannelTable1[0][0]); - break; - case RF_VT3226: //RobertYu:20051111 - wLength1 = CB_VT3226_INIT_SEQ * 3; - wLength2 = CB_MAX_CHANNEL_24G * 3; - wLength3 = CB_MAX_CHANNEL_24G * 3; - pbyAddr1 = &(abyVT3226_InitTable[0][0]); - pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]); - pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]); - break; - case RF_VT3226D0: //RobertYu:20051114 - wLength1 = CB_VT3226_INIT_SEQ * 3; - wLength2 = CB_MAX_CHANNEL_24G * 3; - wLength3 = CB_MAX_CHANNEL_24G * 3; - pbyAddr1 = &(abyVT3226D0_InitTable[0][0]); - pbyAddr2 = &(abyVT3226_ChannelTable0[0][0]); - pbyAddr3 = &(abyVT3226_ChannelTable1[0][0]); - break; - case RF_VT3342A0: //RobertYu:20060609 - wLength1 = CB_VT3342_INIT_SEQ * 3; - wLength2 = CB_MAX_CHANNEL * 3; - wLength3 = CB_MAX_CHANNEL * 3; - pbyAddr1 = &(abyVT3342A0_InitTable[0][0]); - pbyAddr2 = &(abyVT3342_ChannelTable0[0][0]); - pbyAddr3 = &(abyVT3342_ChannelTable1[0][0]); - break; - - } - //Init Table - - memcpy(abyArray, pbyAddr1, wLength1); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - 0, - MESSAGE_REQUEST_RF_INIT, - wLength1, - abyArray - ); - //Channel Table 0 - wValue = 0; - while ( wLength2 > 0 ) { - - if ( wLength2 >= 64 ) { - wLength = 64; - } else { - wLength = wLength2; - } - memcpy(abyArray, pbyAddr2, wLength); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - wValue, - MESSAGE_REQUEST_RF_CH0, - wLength, - abyArray); - - wLength2 -= wLength; - wValue += wLength; - pbyAddr2 += wLength; - } - //Channel table 1 - wValue = 0; - while ( wLength3 > 0 ) { - - if ( wLength3 >= 64 ) { - wLength = 64; - } else { - wLength = wLength3; - } - memcpy(abyArray, pbyAddr3, wLength); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - wValue, - MESSAGE_REQUEST_RF_CH1, - wLength, - abyArray); - - wLength3 -= wLength; - wValue += wLength; - pbyAddr3 += wLength; - } - - //7230 needs 2 InitTable and 3 Channel Table - if ( pDevice->byRFType == RF_AIROHA7230 ) { - wLength1 = CB_AL7230_INIT_SEQ * 3; - wLength2 = CB_MAX_CHANNEL * 3; - pbyAddr1 = &(abyAL7230InitTableAMode[0][0]); - pbyAddr2 = &(abyAL7230ChannelTable2[0][0]); - memcpy(abyArray, pbyAddr1, wLength1); - //Init Table 2 - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - 0, - MESSAGE_REQUEST_RF_INIT2, - wLength1, - abyArray); - - //Channel Table 0 - wValue = 0; - while ( wLength2 > 0 ) { - - if ( wLength2 >= 64 ) { - wLength = 64; - } else { - wLength = wLength2; - } - memcpy(abyArray, pbyAddr2, wLength); - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE, - wValue, - MESSAGE_REQUEST_RF_CH2, - wLength, - abyArray); - - wLength2 -= wLength; - wValue += wLength; - pbyAddr2 += wLength; - } - } - + u16 length1 = 0, length2 = 0, length3 = 0; + u8 *addr1 = NULL, *addr2 = NULL, *addr3 = NULL; + u16 length, value; + u8 array[256]; + + switch (priv->byRFType) { + case RF_AL2230: + case RF_AL2230S: + length1 = CB_AL2230_INIT_SEQ * 3; + length2 = CB_MAX_CHANNEL_24G * 3; + length3 = CB_MAX_CHANNEL_24G * 3; + addr1 = &al2230_init_table[0][0]; + addr2 = &al2230_channel_table0[0][0]; + addr3 = &al2230_channel_table1[0][0]; + break; + case RF_AIROHA7230: + length1 = CB_AL7230_INIT_SEQ * 3; + length2 = CB_MAX_CHANNEL * 3; + length3 = CB_MAX_CHANNEL * 3; + addr1 = &al7230_init_table[0][0]; + addr2 = &al7230_channel_table0[0][0]; + addr3 = &al7230_channel_table1[0][0]; + break; + case RF_VT3226: + length1 = CB_VT3226_INIT_SEQ * 3; + length2 = CB_MAX_CHANNEL_24G * 3; + length3 = CB_MAX_CHANNEL_24G * 3; + addr1 = &at3226_init_table[0][0]; + addr2 = &vt3226_channel_table0[0][0]; + addr3 = &vt3226_channel_table1[0][0]; + break; + case RF_VT3226D0: + length1 = CB_VT3226_INIT_SEQ * 3; + length2 = CB_MAX_CHANNEL_24G * 3; + length3 = CB_MAX_CHANNEL_24G * 3; + addr1 = &at3226d0_init_table[0][0]; + addr2 = &vt3226_channel_table0[0][0]; + addr3 = &vt3226_channel_table1[0][0]; + break; + case RF_VT3342A0: + length1 = CB_VT3342_INIT_SEQ * 3; + length2 = CB_MAX_CHANNEL * 3; + length3 = CB_MAX_CHANNEL * 3; + addr1 = &vt3342a0_init_table[0][0]; + addr2 = &vt3342_channel_table0[0][0]; + addr3 = &vt3342_channel_table1[0][0]; + break; + } + + /* Init Table */ + memcpy(array, addr1, length1); + + CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, 0, + MESSAGE_REQUEST_RF_INIT, length1, array); + + /* Channel Table 0 */ + value = 0; + while (length2 > 0) { + if (length2 >= 64) + length = 64; + else + length = length2; + + memcpy(array, addr2, length); + + CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, + value, MESSAGE_REQUEST_RF_CH0, length, array); + + length2 -= length; + value += length; + addr2 += length; + } + + /* Channel table 1 */ + value = 0; + while (length3 > 0) { + if (length3 >= 64) + length = 64; + else + length = length3; + + memcpy(array, addr3, length); + + CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, + value, MESSAGE_REQUEST_RF_CH1, length, array); + + length3 -= length; + value += length; + addr3 += length; + } + + if (priv->byRFType == RF_AIROHA7230) { + length1 = CB_AL7230_INIT_SEQ * 3; + length2 = CB_MAX_CHANNEL * 3; + addr1 = &(al7230_init_table_amode[0][0]); + addr2 = &(al7230_channel_table2[0][0]); + + memcpy(array, addr1, length1); + + /* Init Table 2 */ + CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, + 0, MESSAGE_REQUEST_RF_INIT2, length1, array); + + /* Channel Table 0 */ + value = 0; + while (length2 > 0) { + if (length2 >= 64) + length = 64; + else + length = length2; + + memcpy(array, addr2, length); + + CONTROLnsRequestOut(priv, MESSAGE_TYPE_WRITE, + value, MESSAGE_REQUEST_RF_CH2, length, array); + + length2 -= length; + value += length; + addr2 += length; + } + } } diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 24465cf..aec6b56 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -99,16 +99,6 @@ #define WEP_IV_MASK 0x00FFFFFF -// -// 802_3 packet -// -typedef struct tagS802_3Header { - u8 abyDstAddr[ETH_ALEN]; - u8 abySrcAddr[ETH_ALEN]; - u16 wLen; -} __attribute__ ((__packed__)) -S802_3Header, *PS802_3Header; - //u8 ETHbyGetHashIndexByCrc(u8 * pbyMultiAddr); bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength); diff --git a/drivers/staging/vt6656/tmacro.h b/drivers/staging/vt6656/tmacro.h index 15cd5ab..15e724e 100644 --- a/drivers/staging/vt6656/tmacro.h +++ b/drivers/staging/vt6656/tmacro.h @@ -45,14 +45,8 @@ #define HIWORD(d) ((u16)((((u32)(d)) >> 16) & 0xFFFF)) #endif -#define LODWORD(q) ((q).u.dwLowDword) -#define HIDWORD(q) ((q).u.dwHighDword) - #if !defined(MAKEWORD) #define MAKEWORD(lb, hb) ((u16)(((u8)(lb)) | (((u16)((u8)(hb))) << 8))) #endif -#if !defined(MAKEDWORD) -#define MAKEDWORD(lw, hw) ((u32)(((u16)(lw)) | (((u32)((u16)(hw))) << 16))) -#endif #endif /* __TMACRO_H__ */ |