2017-11-07 20:07:52 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2009-06-13 11:38:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* File: card.c
|
|
|
|
* Purpose: Provide functions to setup NIC operation mode
|
|
|
|
* Functions:
|
2014-05-30 15:27:46 +00:00
|
|
|
* vnt_set_rspinf - Set RSPINF
|
2014-05-30 15:27:44 +00:00
|
|
|
* vnt_update_ifs - Update slotTime,SIFS,DIFS, and EIFS
|
2014-05-30 15:27:45 +00:00
|
|
|
* vnt_update_top_rates - Update BasicTopRate
|
2014-05-30 15:27:47 +00:00
|
|
|
* vnt_add_basic_rate - Add to BasicRateSet
|
2014-05-30 15:27:48 +00:00
|
|
|
* vnt_ofdm_min_rate - Check if any OFDM rate is in BasicRateSet
|
2014-05-30 15:27:50 +00:00
|
|
|
* vnt_get_tsf_offset - Calculate TSFOffset
|
2014-05-30 22:22:47 +00:00
|
|
|
* vnt_get_current_tsf - Read Current NIC TSF counter
|
2014-05-30 22:22:49 +00:00
|
|
|
* vnt_get_next_tbtt - Calculate Next Beacon TSF counter
|
2014-05-30 22:22:50 +00:00
|
|
|
* vnt_reset_next_tbtt - Set NIC Beacon time
|
2014-05-30 22:22:51 +00:00
|
|
|
* vnt_update_next_tbtt - Sync. NIC Beacon time
|
2014-05-30 22:22:52 +00:00
|
|
|
* vnt_radio_power_off - Turn Off NIC Radio Power
|
2014-05-30 22:22:53 +00:00
|
|
|
* vnt_radio_power_on - Turn On NIC Radio Power
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Revision History:
|
|
|
|
* 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec.
|
2012-08-26 15:16:43 +00:00
|
|
|
* 08-26-2003 Kyle Hsu: Modify the definition type of dwIoBase.
|
2014-05-30 15:27:44 +00:00
|
|
|
* 09-01-2003 Bryan YC Fan: Add vnt_update_ifs().
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-12-10 21:59:10 +00:00
|
|
|
#include "device.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
#include "card.h"
|
|
|
|
#include "baseband.h"
|
|
|
|
#include "mac.h"
|
|
|
|
#include "desc.h"
|
|
|
|
#include "rf.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "key.h"
|
2014-05-26 12:59:07 +00:00
|
|
|
#include "usbpipe.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2016-06-17 03:56:47 +00:00
|
|
|
/* const u16 cw_rxbcntsf_off[MAX_RATE] =
|
2016-06-11 20:08:58 +00:00
|
|
|
* {17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3};
|
|
|
|
*/
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2016-06-17 03:56:47 +00:00
|
|
|
static const u16 cw_rxbcntsf_off[MAX_RATE] = {
|
2014-07-15 21:23:26 +00:00
|
|
|
192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3
|
|
|
|
};
|
2009-06-13 11:38:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Set NIC media channel
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
|
|
|
* pDevice - The adapter to be set
|
2013-12-12 23:33:08 +00:00
|
|
|
* connection_channel - Channel to be set
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*/
|
2014-05-30 15:27:40 +00:00
|
|
|
void vnt_set_channel(struct vnt_private *priv, u32 connection_channel)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-07-05 18:24:25 +00:00
|
|
|
if (connection_channel > CB_MAX_CHANNEL || !connection_channel)
|
|
|
|
return;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-12-12 23:33:08 +00:00
|
|
|
/* clear NAV */
|
2014-05-31 10:50:42 +00:00
|
|
|
vnt_mac_reg_bits_on(priv, MAC_REG_MACCR, MACCR_CLRNAV);
|
2013-12-12 23:33:08 +00:00
|
|
|
|
|
|
|
/* Set Channel[7] = 0 to tell H/W channel is changing now. */
|
2014-05-31 10:50:41 +00:00
|
|
|
vnt_mac_reg_bits_off(priv, MAC_REG_CHANNEL, 0xb0);
|
2013-12-12 23:33:08 +00:00
|
|
|
|
2015-01-11 22:35:54 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_SELECT_CHANNEL,
|
2016-06-17 04:27:31 +00:00
|
|
|
connection_channel, 0, 0, NULL);
|
2013-12-12 23:33:08 +00:00
|
|
|
|
2014-05-26 12:59:03 +00:00
|
|
|
vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, MAC_REG_CHANNEL,
|
2016-06-17 04:27:31 +00:00
|
|
|
(u8)(connection_channel | 0x80));
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Get CCK mode basic rate
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-25 20:36:23 +00:00
|
|
|
* priv - The adapter to be set
|
|
|
|
* rate_idx - Receiving data rate
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: response Control frame rate
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 15:27:41 +00:00
|
|
|
static u16 vnt_get_cck_rate(struct vnt_private *priv, u16 rate_idx)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-25 20:36:23 +00:00
|
|
|
u16 ui = rate_idx;
|
2012-12-10 21:59:10 +00:00
|
|
|
|
|
|
|
while (ui > RATE_1M) {
|
2014-07-20 14:33:13 +00:00
|
|
|
if (priv->basic_rates & (1 << ui))
|
2012-12-10 21:59:10 +00:00
|
|
|
return ui;
|
|
|
|
ui--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return RATE_1M;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Get OFDM mode basic rate
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-25 20:36:22 +00:00
|
|
|
* priv - The adapter to be set
|
|
|
|
* rate_idx - Receiving data rate
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: response Control frame rate
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 15:27:42 +00:00
|
|
|
static u16 vnt_get_ofdm_rate(struct vnt_private *priv, u16 rate_idx)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-25 20:36:22 +00:00
|
|
|
u16 ui = rate_idx;
|
2012-12-10 21:59:10 +00:00
|
|
|
|
2014-05-25 20:36:24 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "%s basic rate: %d\n",
|
2016-06-17 04:27:31 +00:00
|
|
|
__func__, priv->basic_rates);
|
2012-12-10 21:59:10 +00:00
|
|
|
|
2014-05-30 15:27:48 +00:00
|
|
|
if (!vnt_ofdm_min_rate(priv)) {
|
2014-05-25 20:36:24 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "%s (NO OFDM) %d\n",
|
2016-06-17 04:27:31 +00:00
|
|
|
__func__, rate_idx);
|
2014-05-25 20:36:22 +00:00
|
|
|
if (rate_idx > RATE_24M)
|
|
|
|
rate_idx = RATE_24M;
|
|
|
|
return rate_idx;
|
2012-12-10 21:59:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while (ui > RATE_11M) {
|
2014-07-20 14:33:13 +00:00
|
|
|
if (priv->basic_rates & (1 << ui)) {
|
2014-05-25 20:36:24 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "%s rate: %d\n",
|
2016-06-17 04:27:31 +00:00
|
|
|
__func__, ui);
|
2012-12-10 21:59:10 +00:00
|
|
|
return ui;
|
|
|
|
}
|
|
|
|
ui--;
|
|
|
|
}
|
|
|
|
|
2014-05-25 20:36:24 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "%s basic rate: 24M\n", __func__);
|
2012-12-10 21:59:10 +00:00
|
|
|
|
|
|
|
return RATE_24M;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-08-26 15:16:43 +00:00
|
|
|
* Description: Calculate TxRate and RsvTime fields for RSPINF in OFDM mode.
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Parameters:
|
2014-05-23 17:00:15 +00:00
|
|
|
* In:
|
|
|
|
* rate - Tx Rate
|
|
|
|
* bb_type - Tx Packet type
|
|
|
|
* Out:
|
|
|
|
* tx_rate - pointer to RSPINF TxRate field
|
|
|
|
* rsv_time- pointer to RSPINF RsvTime field
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 15:27:43 +00:00
|
|
|
static void vnt_calculate_ofdm_rate(u16 rate, u8 bb_type,
|
2016-06-17 04:27:31 +00:00
|
|
|
u8 *tx_rate, u8 *rsv_time)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-23 17:00:15 +00:00
|
|
|
switch (rate) {
|
|
|
|
case RATE_6M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x9b;
|
|
|
|
*rsv_time = 24;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x8b;
|
|
|
|
*rsv_time = 30;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_9M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x9f;
|
|
|
|
*rsv_time = 16;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x8f;
|
|
|
|
*rsv_time = 22;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_12M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x9a;
|
|
|
|
*rsv_time = 12;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x8a;
|
|
|
|
*rsv_time = 18;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_18M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x9e;
|
|
|
|
*rsv_time = 8;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x8e;
|
|
|
|
*rsv_time = 14;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_36M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x9d;
|
|
|
|
*rsv_time = 4;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x8d;
|
|
|
|
*rsv_time = 10;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_48M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x98;
|
|
|
|
*rsv_time = 4;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x88;
|
2014-05-24 13:37:10 +00:00
|
|
|
*rsv_time = 10;
|
2014-05-23 17:00:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_54M:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x9c;
|
|
|
|
*rsv_time = 4;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x8c;
|
|
|
|
*rsv_time = 10;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RATE_24M:
|
|
|
|
default:
|
|
|
|
if (bb_type == BB_TYPE_11A) {
|
|
|
|
*tx_rate = 0x99;
|
|
|
|
*rsv_time = 8;
|
|
|
|
} else {
|
|
|
|
*tx_rate = 0x89;
|
|
|
|
*rsv_time = 14;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Set RSPINF
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
|
|
|
* pDevice - The adapter to be set
|
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: None.
|
|
|
|
*
|
|
|
|
*/
|
2014-05-23 17:00:16 +00:00
|
|
|
|
2014-05-30 15:27:46 +00:00
|
|
|
void vnt_set_rspinf(struct vnt_private *priv, u8 bb_type)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2013-08-20 21:52:30 +00:00
|
|
|
struct vnt_phy_field phy[4];
|
2014-05-23 17:00:16 +00:00
|
|
|
u8 tx_rate[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; /* For OFDM */
|
|
|
|
u8 rsv_time[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
|
|
u8 data[34];
|
2012-12-10 21:59:10 +00:00
|
|
|
int i;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-23 17:00:16 +00:00
|
|
|
/*RSPINF_b_1*/
|
2016-06-17 04:27:31 +00:00
|
|
|
vnt_get_phy_field(priv, 14, vnt_get_cck_rate(priv, RATE_1M),
|
|
|
|
PK_TYPE_11B, &phy[0]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_b_2*/
|
2016-06-17 04:27:31 +00:00
|
|
|
vnt_get_phy_field(priv, 14, vnt_get_cck_rate(priv, RATE_2M),
|
|
|
|
PK_TYPE_11B, &phy[1]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_b_5*/
|
2016-06-17 04:27:31 +00:00
|
|
|
vnt_get_phy_field(priv, 14, vnt_get_cck_rate(priv, RATE_5M),
|
|
|
|
PK_TYPE_11B, &phy[2]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_b_11*/
|
2016-06-17 04:27:31 +00:00
|
|
|
vnt_get_phy_field(priv, 14, vnt_get_cck_rate(priv, RATE_11M),
|
|
|
|
PK_TYPE_11B, &phy[3]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_6*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(RATE_6M, bb_type, &tx_rate[0], &rsv_time[0]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_9*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(RATE_9M, bb_type, &tx_rate[1], &rsv_time[1]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_12*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(RATE_12M, bb_type, &tx_rate[2], &rsv_time[2]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_18*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(RATE_18M, bb_type, &tx_rate[3], &rsv_time[3]);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-23 17:00:16 +00:00
|
|
|
/*RSPINF_a_24*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(RATE_24M, bb_type, &tx_rate[4], &rsv_time[4]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_36*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_36M),
|
2016-06-17 04:27:31 +00:00
|
|
|
bb_type, &tx_rate[5], &rsv_time[5]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_48*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_48M),
|
2016-06-17 04:27:31 +00:00
|
|
|
bb_type, &tx_rate[6], &rsv_time[6]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_54*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_54M),
|
2016-06-17 04:27:31 +00:00
|
|
|
bb_type, &tx_rate[7], &rsv_time[7]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
/*RSPINF_a_72*/
|
2014-05-30 15:27:43 +00:00
|
|
|
vnt_calculate_ofdm_rate(vnt_get_ofdm_rate(priv, RATE_54M),
|
2016-06-17 04:27:31 +00:00
|
|
|
bb_type, &tx_rate[8], &rsv_time[8]);
|
2014-05-23 17:00:16 +00:00
|
|
|
|
|
|
|
put_unaligned(phy[0].len, (u16 *)&data[0]);
|
|
|
|
data[2] = phy[0].signal;
|
|
|
|
data[3] = phy[0].service;
|
|
|
|
|
|
|
|
put_unaligned(phy[1].len, (u16 *)&data[4]);
|
|
|
|
data[6] = phy[1].signal;
|
|
|
|
data[7] = phy[1].service;
|
|
|
|
|
|
|
|
put_unaligned(phy[2].len, (u16 *)&data[8]);
|
|
|
|
data[10] = phy[2].signal;
|
|
|
|
data[11] = phy[2].service;
|
|
|
|
|
|
|
|
put_unaligned(phy[3].len, (u16 *)&data[12]);
|
|
|
|
data[14] = phy[3].signal;
|
|
|
|
data[15] = phy[3].service;
|
|
|
|
|
|
|
|
for (i = 0; i < 9; i++) {
|
|
|
|
data[16 + i * 2] = tx_rate[i];
|
|
|
|
data[16 + i * 2 + 1] = rsv_time[i];
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2016-06-17 04:27:31 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_RSPINF_B_1,
|
|
|
|
MESSAGE_REQUEST_MACREG, 34, &data[0]);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Update IFS
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-23 17:00:17 +00:00
|
|
|
* priv - The adapter to be set
|
|
|
|
* Out:
|
|
|
|
* none
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value: None.
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 15:27:44 +00:00
|
|
|
void vnt_update_ifs(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-23 17:00:17 +00:00
|
|
|
u8 max_min = 0;
|
|
|
|
u8 data[4];
|
|
|
|
|
2014-07-20 14:33:12 +00:00
|
|
|
if (priv->packet_type == PK_TYPE_11A) {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->slot = C_SLOT_SHORT;
|
|
|
|
priv->sifs = C_SIFS_A;
|
|
|
|
priv->difs = C_SIFS_A + 2 * C_SLOT_SHORT;
|
2014-05-23 17:00:17 +00:00
|
|
|
max_min = 4;
|
2017-04-29 12:03:42 +00:00
|
|
|
} else {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->sifs = C_SIFS_BG;
|
2014-05-23 17:00:17 +00:00
|
|
|
|
2017-04-29 12:03:42 +00:00
|
|
|
if (priv->short_slot_time) {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->slot = C_SLOT_SHORT;
|
2017-04-29 12:03:42 +00:00
|
|
|
max_min = 4;
|
|
|
|
} else {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->slot = C_SLOT_LONG;
|
2017-04-29 12:03:42 +00:00
|
|
|
max_min = 5;
|
2014-05-23 17:00:17 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 12:03:42 +00:00
|
|
|
priv->difs = C_SIFS_BG + 2 * priv->slot;
|
2014-05-23 17:00:17 +00:00
|
|
|
}
|
|
|
|
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->eifs = C_EIFS;
|
2014-05-23 17:00:17 +00:00
|
|
|
|
2014-07-19 11:30:07 +00:00
|
|
|
switch (priv->rf_type) {
|
2014-07-06 22:19:48 +00:00
|
|
|
case RF_VT3226D0:
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->bb_type != BB_TYPE_11B) {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->sifs -= 1;
|
|
|
|
priv->difs -= 1;
|
2014-07-06 22:19:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-10-12 16:16:52 +00:00
|
|
|
/* fall through */
|
2014-07-06 22:19:48 +00:00
|
|
|
case RF_AIROHA7230:
|
|
|
|
case RF_AL2230:
|
|
|
|
case RF_AL2230S:
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->bb_type != BB_TYPE_11B)
|
2014-07-06 22:19:48 +00:00
|
|
|
break;
|
2017-10-12 16:16:52 +00:00
|
|
|
/* fall through */
|
2014-07-06 22:19:48 +00:00
|
|
|
case RF_RFMD2959:
|
|
|
|
case RF_VT3226:
|
|
|
|
case RF_VT3342A0:
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->sifs -= 3;
|
|
|
|
priv->difs -= 3;
|
2014-07-06 22:19:48 +00:00
|
|
|
break;
|
|
|
|
case RF_MAXIM2829:
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->bb_type == BB_TYPE_11A) {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->sifs -= 5;
|
|
|
|
priv->difs -= 5;
|
2014-07-06 22:19:48 +00:00
|
|
|
} else {
|
2014-07-19 11:30:18 +00:00
|
|
|
priv->sifs -= 2;
|
|
|
|
priv->difs -= 2;
|
2014-07-06 22:19:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-19 11:30:18 +00:00
|
|
|
data[0] = (u8)priv->sifs;
|
|
|
|
data[1] = (u8)priv->difs;
|
|
|
|
data[2] = (u8)priv->eifs;
|
|
|
|
data[3] = (u8)priv->slot;
|
2014-05-23 17:00:17 +00:00
|
|
|
|
2014-05-26 12:59:01 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_SIFS,
|
2016-06-17 04:27:31 +00:00
|
|
|
MESSAGE_REQUEST_MACREG, 4, &data[0]);
|
2014-05-23 17:00:17 +00:00
|
|
|
|
|
|
|
max_min |= 0xa0;
|
|
|
|
|
2014-05-26 12:59:01 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_WRITE, MAC_REG_CWMAXMIN0,
|
2016-06-17 04:27:31 +00:00
|
|
|
MESSAGE_REQUEST_MACREG, 1, &max_min);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 15:27:45 +00:00
|
|
|
void vnt_update_top_rates(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-23 17:00:18 +00:00
|
|
|
u8 top_ofdm = RATE_24M, top_cck = RATE_1M;
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
/*Determines the highest basic rate.*/
|
|
|
|
for (i = RATE_54M; i >= RATE_6M; i--) {
|
2014-07-20 14:33:13 +00:00
|
|
|
if (priv->basic_rates & (u16)(1 << i)) {
|
2014-05-23 17:00:18 +00:00
|
|
|
top_ofdm = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-20 14:33:14 +00:00
|
|
|
priv->top_ofdm_basic_rate = top_ofdm;
|
2014-05-23 17:00:18 +00:00
|
|
|
|
|
|
|
for (i = RATE_11M;; i--) {
|
2014-07-20 14:33:13 +00:00
|
|
|
if (priv->basic_rates & (u16)(1 << i)) {
|
2014-05-23 17:00:18 +00:00
|
|
|
top_cck = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (i == RATE_1M)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-20 14:33:15 +00:00
|
|
|
priv->top_cck_basic_rate = top_cck;
|
2014-07-15 21:23:26 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-30 15:27:48 +00:00
|
|
|
int vnt_ofdm_min_rate(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2012-12-10 21:59:10 +00:00
|
|
|
int ii;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-24 13:36:58 +00:00
|
|
|
for (ii = RATE_54M; ii >= RATE_6M; ii--) {
|
2015-10-16 16:42:35 +00:00
|
|
|
if ((priv->basic_rates) & ((u16)BIT(ii)))
|
2014-05-24 13:36:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 15:27:49 +00:00
|
|
|
u8 vnt_get_pkt_type(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->bb_type == BB_TYPE_11A || priv->bb_type == BB_TYPE_11B)
|
|
|
|
return (u8)priv->bb_type;
|
2014-05-30 15:27:48 +00:00
|
|
|
else if (vnt_ofdm_min_rate(priv))
|
2014-05-24 13:36:59 +00:00
|
|
|
return PK_TYPE_11GA;
|
2014-09-22 11:32:20 +00:00
|
|
|
return PK_TYPE_11GB;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-08-26 15:16:43 +00:00
|
|
|
* Description: Calculate TSF offset of two TSF input
|
2009-06-13 11:38:31 +00:00
|
|
|
* Get TSF Offset from RxBCN's TSF and local TSF
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:00 +00:00
|
|
|
* rx_rate - rx rate.
|
|
|
|
* tsf1 - Rx BCN's TSF
|
|
|
|
* tsf2 - Local TSF
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: TSF Offset value
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 15:27:50 +00:00
|
|
|
u64 vnt_get_tsf_offset(u8 rx_rate, u64 tsf1, u64 tsf2)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2016-10-17 02:18:58 +00:00
|
|
|
return tsf1 - tsf2 - (u64)cw_rxbcntsf_off[rx_rate % MAX_RATE];
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Sync. TSF counter to BSS
|
|
|
|
* Get TSF offset and write to HW
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:01 +00:00
|
|
|
* priv - The adapter to be sync.
|
|
|
|
* time_stamp - Rx BCN's TSF
|
|
|
|
* local_tsf - Local TSF
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 15:27:51 +00:00
|
|
|
void vnt_adjust_tsf(struct vnt_private *priv, u8 rx_rate,
|
2016-06-17 04:27:31 +00:00
|
|
|
u64 time_stamp, u64 local_tsf)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-24 13:37:01 +00:00
|
|
|
u64 tsf_offset = 0;
|
|
|
|
u8 data[8];
|
|
|
|
|
2014-05-30 15:27:50 +00:00
|
|
|
tsf_offset = vnt_get_tsf_offset(rx_rate, time_stamp, local_tsf);
|
2014-05-24 13:37:01 +00:00
|
|
|
|
|
|
|
data[0] = (u8)tsf_offset;
|
|
|
|
data[1] = (u8)(tsf_offset >> 8);
|
|
|
|
data[2] = (u8)(tsf_offset >> 16);
|
|
|
|
data[3] = (u8)(tsf_offset >> 24);
|
|
|
|
data[4] = (u8)(tsf_offset >> 32);
|
|
|
|
data[5] = (u8)(tsf_offset >> 40);
|
|
|
|
data[6] = (u8)(tsf_offset >> 48);
|
|
|
|
data[7] = (u8)(tsf_offset >> 56);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-26 12:59:01 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT,
|
2016-06-17 04:27:31 +00:00
|
|
|
MESSAGE_REQUEST_TSF, 0, 8, data);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
2016-06-17 03:53:42 +00:00
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
/*
|
|
|
|
* Description: Read NIC TSF counter
|
|
|
|
* Get local TSF counter
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:02 +00:00
|
|
|
* priv - The adapter to be read
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
2014-05-24 13:37:02 +00:00
|
|
|
* current_tsf - Current TSF counter
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
2013-02-13 01:36:30 +00:00
|
|
|
* Return Value: true if success; otherwise false
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:47 +00:00
|
|
|
bool vnt_get_current_tsf(struct vnt_private *priv, u64 *current_tsf)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-07-19 11:30:13 +00:00
|
|
|
*current_tsf = priv->current_tsf;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-02-13 01:36:30 +00:00
|
|
|
return true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Clear NIC TSF counter
|
|
|
|
* Clear local TSF counter
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:03 +00:00
|
|
|
* priv - The adapter to be read
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
2013-02-13 01:36:30 +00:00
|
|
|
* Return Value: true if success; otherwise false
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:48 +00:00
|
|
|
bool vnt_clear_current_tsf(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-31 10:50:42 +00:00
|
|
|
vnt_mac_reg_bits_on(priv, MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-19 11:30:13 +00:00
|
|
|
priv->current_tsf = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2013-02-13 01:36:30 +00:00
|
|
|
return true;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Read NIC TSF counter
|
|
|
|
* Get NEXTTBTT from adjusted TSF and Beacon Interval
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:04 +00:00
|
|
|
* tsf - Current TSF counter
|
|
|
|
* beacon_interval - Beacon Interval
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
2014-05-24 13:37:04 +00:00
|
|
|
* tsf - Current TSF counter
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Return Value: TSF value of next Beacon
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:49 +00:00
|
|
|
u64 vnt_get_next_tbtt(u64 tsf, u16 beacon_interval)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-24 13:37:04 +00:00
|
|
|
u32 beacon_int;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-24 13:37:04 +00:00
|
|
|
beacon_int = beacon_interval * 1024;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-01-01 19:20:40 +00:00
|
|
|
/* Next TBTT =
|
2016-10-12 14:57:49 +00:00
|
|
|
* ((local_current_TSF / beacon_interval) + 1) * beacon_interval
|
|
|
|
*/
|
2014-05-24 13:37:04 +00:00
|
|
|
if (beacon_int) {
|
|
|
|
do_div(tsf, beacon_int);
|
|
|
|
tsf += 1;
|
|
|
|
tsf *= beacon_int;
|
2014-01-01 19:20:40 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-24 13:37:04 +00:00
|
|
|
return tsf;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Set NIC TSF counter for first Beacon time
|
|
|
|
* Get NEXTTBTT from adjusted TSF and Beacon Interval
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
|
|
|
* dwIoBase - IO Base
|
2014-05-24 13:37:05 +00:00
|
|
|
* beacon_interval - Beacon Interval
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:50 +00:00
|
|
|
void vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-24 13:37:05 +00:00
|
|
|
u64 next_tbtt = 0;
|
|
|
|
u8 data[8];
|
|
|
|
|
2014-05-30 22:22:48 +00:00
|
|
|
vnt_clear_current_tsf(priv);
|
2014-05-24 13:37:05 +00:00
|
|
|
|
2014-05-30 22:22:49 +00:00
|
|
|
next_tbtt = vnt_get_next_tbtt(next_tbtt, beacon_interval);
|
2014-05-24 13:37:05 +00:00
|
|
|
|
|
|
|
data[0] = (u8)next_tbtt;
|
|
|
|
data[1] = (u8)(next_tbtt >> 8);
|
|
|
|
data[2] = (u8)(next_tbtt >> 16);
|
|
|
|
data[3] = (u8)(next_tbtt >> 24);
|
|
|
|
data[4] = (u8)(next_tbtt >> 32);
|
|
|
|
data[5] = (u8)(next_tbtt >> 40);
|
|
|
|
data[6] = (u8)(next_tbtt >> 48);
|
|
|
|
data[7] = (u8)(next_tbtt >> 56);
|
|
|
|
|
2014-05-26 12:59:01 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT,
|
2016-06-17 04:27:31 +00:00
|
|
|
MESSAGE_REQUEST_TBTT, 0, 8, data);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Sync NIC TSF counter for Beacon time
|
|
|
|
* Get NEXTTBTT and write to HW
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:06 +00:00
|
|
|
* priv - The adapter to be set
|
|
|
|
* tsf - Current TSF counter
|
|
|
|
* beacon_interval - Beacon Interval
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:51 +00:00
|
|
|
void vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf,
|
2016-06-17 04:27:31 +00:00
|
|
|
u16 beacon_interval)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-24 13:37:06 +00:00
|
|
|
u8 data[8];
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-30 22:22:49 +00:00
|
|
|
tsf = vnt_get_next_tbtt(tsf, beacon_interval);
|
2012-11-28 21:11:02 +00:00
|
|
|
|
2014-05-24 13:37:06 +00:00
|
|
|
data[0] = (u8)tsf;
|
|
|
|
data[1] = (u8)(tsf >> 8);
|
|
|
|
data[2] = (u8)(tsf >> 16);
|
|
|
|
data[3] = (u8)(tsf >> 24);
|
|
|
|
data[4] = (u8)(tsf >> 32);
|
|
|
|
data[5] = (u8)(tsf >> 40);
|
|
|
|
data[6] = (u8)(tsf >> 48);
|
|
|
|
data[7] = (u8)(tsf >> 56);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-26 12:59:01 +00:00
|
|
|
vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT,
|
2014-07-15 21:23:26 +00:00
|
|
|
MESSAGE_REQUEST_TBTT, 0, 8, data);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-25 20:36:24 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "%s TBTT: %8llx\n", __func__, tsf);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Turn off Radio power
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:07 +00:00
|
|
|
* priv - The adapter to be turned off
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
2013-02-13 01:36:30 +00:00
|
|
|
* Return Value: true if success; otherwise false
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:52 +00:00
|
|
|
int vnt_radio_power_off(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-24 13:37:07 +00:00
|
|
|
int ret = true;
|
|
|
|
|
2014-07-19 11:30:07 +00:00
|
|
|
switch (priv->rf_type) {
|
2014-05-24 13:37:07 +00:00
|
|
|
case RF_AL2230:
|
|
|
|
case RF_AL2230S:
|
|
|
|
case RF_AIROHA7230:
|
|
|
|
case RF_VT3226:
|
|
|
|
case RF_VT3226D0:
|
|
|
|
case RF_VT3342A0:
|
2014-05-31 10:50:41 +00:00
|
|
|
vnt_mac_reg_bits_off(priv, MAC_REG_SOFTPWRCTL,
|
2016-06-17 04:27:31 +00:00
|
|
|
(SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
|
2014-05-24 13:37:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-31 10:50:41 +00:00
|
|
|
vnt_mac_reg_bits_off(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-16 21:21:56 +00:00
|
|
|
vnt_set_deep_sleep(priv);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-18 22:00:54 +00:00
|
|
|
vnt_mac_reg_bits_on(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
|
|
|
|
|
2014-05-24 13:37:07 +00:00
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Turn on Radio power
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-24 13:37:08 +00:00
|
|
|
* priv - The adapter to be turned on
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
2013-02-13 01:36:30 +00:00
|
|
|
* Return Value: true if success; otherwise false
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
*/
|
2014-05-30 22:22:53 +00:00
|
|
|
int vnt_radio_power_on(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-24 13:37:08 +00:00
|
|
|
int ret = true;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-16 21:21:57 +00:00
|
|
|
vnt_exit_deep_sleep(priv);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-31 10:50:42 +00:00
|
|
|
vnt_mac_reg_bits_on(priv, MAC_REG_HOSTCR, HOSTCR_RXON);
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-19 11:30:07 +00:00
|
|
|
switch (priv->rf_type) {
|
2014-05-24 13:37:08 +00:00
|
|
|
case RF_AL2230:
|
|
|
|
case RF_AL2230S:
|
|
|
|
case RF_AIROHA7230:
|
|
|
|
case RF_VT3226:
|
|
|
|
case RF_VT3226D0:
|
|
|
|
case RF_VT3342A0:
|
2014-05-31 10:50:42 +00:00
|
|
|
vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL,
|
2016-06-17 04:27:31 +00:00
|
|
|
(SOFTPWRCTL_SWPE2 | SOFTPWRCTL_SWPE3));
|
2014-05-24 13:37:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-18 22:00:54 +00:00
|
|
|
vnt_mac_reg_bits_off(priv, MAC_REG_GPIOCTL1, GPIO3_INTMD);
|
|
|
|
|
2014-05-24 13:37:08 +00:00
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 22:22:54 +00:00
|
|
|
void vnt_set_bss_mode(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->rf_type == RF_AIROHA7230 && priv->bb_type == BB_TYPE_11A)
|
2014-05-31 10:50:38 +00:00
|
|
|
vnt_mac_set_bb_type(priv, BB_TYPE_11G);
|
2014-05-24 13:37:09 +00:00
|
|
|
else
|
2014-07-20 14:33:11 +00:00
|
|
|
vnt_mac_set_bb_type(priv, priv->bb_type);
|
2014-05-24 13:37:09 +00:00
|
|
|
|
2014-07-20 14:33:12 +00:00
|
|
|
priv->packet_type = vnt_get_pkt_type(priv);
|
2014-05-24 13:37:09 +00:00
|
|
|
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->bb_type == BB_TYPE_11A)
|
2014-05-26 12:59:03 +00:00
|
|
|
vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x88, 0x03);
|
2014-07-20 14:33:11 +00:00
|
|
|
else if (priv->bb_type == BB_TYPE_11B)
|
2014-05-26 12:59:03 +00:00
|
|
|
vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x88, 0x02);
|
2014-07-20 14:33:11 +00:00
|
|
|
else if (priv->bb_type == BB_TYPE_11G)
|
2014-05-26 12:59:03 +00:00
|
|
|
vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x88, 0x08);
|
2014-05-24 13:37:09 +00:00
|
|
|
|
2014-05-30 15:27:44 +00:00
|
|
|
vnt_update_ifs(priv);
|
2014-07-20 14:33:11 +00:00
|
|
|
vnt_set_rspinf(priv, (u8)priv->bb_type);
|
2014-05-24 13:37:09 +00:00
|
|
|
|
2014-07-20 14:33:11 +00:00
|
|
|
if (priv->bb_type == BB_TYPE_11A) {
|
2014-07-19 11:30:07 +00:00
|
|
|
if (priv->rf_type == RF_AIROHA7230) {
|
2014-07-20 14:33:25 +00:00
|
|
|
priv->bb_vga[0] = 0x20;
|
2014-05-24 13:37:09 +00:00
|
|
|
|
2014-05-26 12:59:03 +00:00
|
|
|
vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG,
|
2016-06-17 04:27:31 +00:00
|
|
|
0xe7, priv->bb_vga[0]);
|
2014-05-24 13:37:09 +00:00
|
|
|
}
|
|
|
|
|
2014-07-20 14:33:25 +00:00
|
|
|
priv->bb_vga[2] = 0x10;
|
|
|
|
priv->bb_vga[3] = 0x10;
|
2014-05-24 13:37:09 +00:00
|
|
|
} else {
|
2014-07-19 11:30:07 +00:00
|
|
|
if (priv->rf_type == RF_AIROHA7230) {
|
2014-07-20 14:33:25 +00:00
|
|
|
priv->bb_vga[0] = 0x1c;
|
2014-05-24 13:37:09 +00:00
|
|
|
|
2014-05-26 12:59:03 +00:00
|
|
|
vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG,
|
2016-06-17 04:27:31 +00:00
|
|
|
0xe7, priv->bb_vga[0]);
|
2014-05-24 13:37:09 +00:00
|
|
|
}
|
|
|
|
|
2014-07-20 14:33:25 +00:00
|
|
|
priv->bb_vga[2] = 0x0;
|
|
|
|
priv->bb_vga[3] = 0x0;
|
2014-05-24 13:37:09 +00:00
|
|
|
}
|
2014-06-28 22:55:45 +00:00
|
|
|
|
2014-07-20 14:33:25 +00:00
|
|
|
vnt_set_vga_gain_offset(priv, priv->bb_vga[0]);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|