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: baseband.c
|
|
|
|
*
|
|
|
|
* Purpose: Implement functions to access baseband
|
|
|
|
*
|
|
|
|
* Author: Jerry Chen
|
|
|
|
*
|
|
|
|
* Date: Jun. 5, 2002
|
|
|
|
*
|
|
|
|
* Functions:
|
2014-07-15 21:23:25 +00:00
|
|
|
* vnt_get_frame_time - Calculate data frame transmitting time
|
|
|
|
* vnt_get_phy_field - Calculate PhyLength, PhyService and Phy
|
|
|
|
* Signal parameter for baseband Tx
|
2014-07-16 21:21:53 +00:00
|
|
|
* vnt_vt3184_init - VIA VT3184 baseband chip init code
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Revision History:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-03-20 18:13:26 +00:00
|
|
|
#include <linux/bits.h>
|
2020-04-25 13:42:56 +00:00
|
|
|
#include <linux/errno.h>
|
2020-03-26 17:59:02 +00:00
|
|
|
#include <linux/kernel.h>
|
2020-04-14 15:38:47 +00:00
|
|
|
#include "device.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
#include "mac.h"
|
|
|
|
#include "baseband.h"
|
|
|
|
#include "rf.h"
|
2014-05-26 12:59:07 +00:00
|
|
|
#include "usbpipe.h"
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2020-05-04 17:14:14 +00:00
|
|
|
static const u8 vnt_vt3184_agc[] = {
|
2014-07-12 19:12:42 +00:00
|
|
|
0x00, 0x00, 0x02, 0x02, 0x04, 0x04, 0x06, 0x06,
|
|
|
|
0x08, 0x08, 0x0a, 0x0a, 0x0c, 0x0c, 0x0e, 0x0e, /* 0x0f */
|
|
|
|
0x10, 0x10, 0x12, 0x12, 0x14, 0x14, 0x16, 0x16,
|
|
|
|
0x18, 0x18, 0x1a, 0x1a, 0x1c, 0x1c, 0x1e, 0x1e, /* 0x1f */
|
|
|
|
0x20, 0x20, 0x22, 0x22, 0x24, 0x24, 0x26, 0x26,
|
|
|
|
0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c, 0x2e, 0x2e, /* 0x2f */
|
|
|
|
0x30, 0x30, 0x32, 0x32, 0x34, 0x34, 0x36, 0x36,
|
|
|
|
0x38, 0x38, 0x3a, 0x3a, 0x3c, 0x3c, 0x3e, 0x3e /* 0x3f */
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|
|
|
|
|
2014-07-12 19:12:44 +00:00
|
|
|
static u8 vnt_vt3184_al2230[] = {
|
2014-07-12 19:12:42 +00:00
|
|
|
0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
|
|
0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x8e, 0x0a, 0x00, 0x00, 0x00, /* 0x1f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x0c, /* 0x2f */
|
|
|
|
0x26, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa,
|
|
|
|
0xff, 0xff, 0x79, 0x00, 0x00, 0x0b, 0x48, 0x04, /* 0x3f */
|
|
|
|
0x00, 0x08, 0x00, 0x08, 0x08, 0x14, 0x05, 0x09,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x09, 0x73, 0x00, 0xc5, /* 0x4f */
|
|
|
|
0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x5f */
|
|
|
|
0xe4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x98, 0x0a,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, /* 0x6f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x7f */
|
|
|
|
0x8c, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x08, 0x00, 0x1f, 0xb7, 0x88, 0x47, 0xaa, 0x00, /* 0x8f */
|
|
|
|
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 0x9f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
|
|
|
0x18, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x18, /* 0xaf */
|
|
|
|
0x38, 0x30, 0x00, 0x00, 0xff, 0x0f, 0xe4, 0xe2,
|
|
|
|
0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, /* 0xbf */
|
|
|
|
0x18, 0x20, 0x07, 0x18, 0xff, 0xff, 0x0e, 0x0a,
|
|
|
|
0x0e, 0x00, 0x82, 0xa7, 0x3c, 0x10, 0x30, 0x05, /* 0xcf */
|
|
|
|
0x40, 0x12, 0x00, 0x00, 0x10, 0x28, 0x80, 0x2a,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xdf */
|
|
|
|
0x00, 0xf3, 0x00, 0x00, 0x00, 0x10, 0x00, 0x12,
|
|
|
|
0x00, 0xf4, 0x00, 0xff, 0x79, 0x20, 0x30, 0x05, /* 0xef */
|
|
|
|
0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|
|
|
|
|
2014-07-15 21:23:25 +00:00
|
|
|
/* {{RobertYu:20060515, new BB setting for VT3226D0 */
|
2020-05-04 17:14:14 +00:00
|
|
|
static const u8 vnt_vt3184_vt3226d0[] = {
|
2014-07-12 19:12:42 +00:00
|
|
|
0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
|
|
0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x8e, 0x0a, 0x00, 0x00, 0x00, /* 0x1f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x0c, /* 0x2f */
|
|
|
|
0x26, 0x5b, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa,
|
|
|
|
0xff, 0xff, 0x79, 0x00, 0x00, 0x0b, 0x48, 0x04, /* 0x3f */
|
|
|
|
0x00, 0x08, 0x00, 0x08, 0x08, 0x14, 0x05, 0x09,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x09, 0x73, 0x00, 0xc5, /* 0x4f */
|
|
|
|
0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x5f */
|
|
|
|
0xe4, 0x80, 0x00, 0x00, 0x00, 0x00, 0x98, 0x0a,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, /* 0x6f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x7f */
|
|
|
|
0x8c, 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x08, 0x00, 0x1f, 0xb7, 0x88, 0x47, 0xaa, 0x00, /* 0x8f */
|
|
|
|
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, /* 0x9f */
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
|
|
|
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, /* 0xaf */
|
|
|
|
0x38, 0x30, 0x00, 0x00, 0xff, 0x0f, 0xe4, 0xe2,
|
|
|
|
0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, /* 0xbf */
|
|
|
|
0x18, 0x20, 0x07, 0x18, 0xff, 0xff, 0x10, 0x0a,
|
|
|
|
0x0e, 0x00, 0x84, 0xa7, 0x3c, 0x10, 0x24, 0x05, /* 0xcf */
|
|
|
|
0x40, 0x12, 0x00, 0x00, 0x10, 0x28, 0x80, 0x2a,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xdf */
|
|
|
|
0x00, 0xf3, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10,
|
|
|
|
0x00, 0xf4, 0x00, 0xff, 0x79, 0x20, 0x30, 0x08, /* 0xef */
|
|
|
|
0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */
|
2009-06-13 11:38:31 +00:00
|
|
|
};
|
|
|
|
|
2020-03-28 18:17:06 +00:00
|
|
|
struct vnt_threshold {
|
|
|
|
u8 bb_pre_ed_rssi;
|
|
|
|
u8 cr_201;
|
|
|
|
u8 cr_206;
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct vnt_threshold al2230_vnt_threshold[] = {
|
|
|
|
{0, 0x00, 0x30}, /* Max sensitivity */
|
|
|
|
{68, 0x00, 0x36},
|
|
|
|
{67, 0x00, 0x43},
|
|
|
|
{66, 0x00, 0x51},
|
|
|
|
{65, 0x00, 0x62},
|
|
|
|
{64, 0x00, 0x79},
|
|
|
|
{63, 0x00, 0x93},
|
|
|
|
{62, 0x00, 0xb9},
|
|
|
|
{61, 0x00, 0xe3},
|
|
|
|
{60, 0x01, 0x18},
|
|
|
|
{59, 0x01, 0x54},
|
|
|
|
{58, 0x01, 0xa0},
|
|
|
|
{57, 0x02, 0x20},
|
|
|
|
{56, 0x02, 0xa0},
|
|
|
|
{55, 0x03, 0x00},
|
|
|
|
{53, 0x06, 0x00},
|
|
|
|
{51, 0x09, 0x00},
|
|
|
|
{49, 0x0e, 0x00},
|
|
|
|
{47, 0x15, 0x00},
|
|
|
|
{46, 0x1a, 0x00},
|
|
|
|
{45, 0xff, 0x00}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct vnt_threshold vt3226_vnt_threshold[] = {
|
|
|
|
{0, 0x00, 0x24}, /* Max sensitivity */
|
|
|
|
{68, 0x00, 0x2d},
|
|
|
|
{67, 0x00, 0x36},
|
|
|
|
{66, 0x00, 0x43},
|
|
|
|
{65, 0x00, 0x52},
|
|
|
|
{64, 0x00, 0x68},
|
|
|
|
{63, 0x00, 0x80},
|
|
|
|
{62, 0x00, 0x9c},
|
|
|
|
{61, 0x00, 0xc0},
|
|
|
|
{60, 0x00, 0xea},
|
|
|
|
{59, 0x01, 0x30},
|
|
|
|
{58, 0x01, 0x70},
|
|
|
|
{57, 0x01, 0xb0},
|
|
|
|
{56, 0x02, 0x30},
|
|
|
|
{55, 0x02, 0xc0},
|
|
|
|
{53, 0x04, 0x00},
|
|
|
|
{51, 0x07, 0x00},
|
|
|
|
{49, 0x0a, 0x00},
|
|
|
|
{47, 0x11, 0x00},
|
|
|
|
{45, 0x18, 0x00},
|
|
|
|
{43, 0x26, 0x00},
|
|
|
|
{42, 0x36, 0x00},
|
|
|
|
{41, 0xff, 0x00}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct vnt_threshold vt3342_vnt_threshold[] = {
|
|
|
|
{0, 0x00, 0x38}, /* Max sensitivity */
|
|
|
|
{66, 0x00, 0x43},
|
|
|
|
{65, 0x00, 0x52},
|
|
|
|
{64, 0x00, 0x68},
|
|
|
|
{63, 0x00, 0x80},
|
|
|
|
{62, 0x00, 0x9c},
|
|
|
|
{61, 0x00, 0xc0},
|
|
|
|
{60, 0x00, 0xea},
|
|
|
|
{59, 0x01, 0x30},
|
|
|
|
{58, 0x01, 0x70},
|
|
|
|
{57, 0x01, 0xb0},
|
|
|
|
{56, 0x02, 0x30},
|
|
|
|
{55, 0x02, 0xc0},
|
|
|
|
{53, 0x04, 0x00},
|
|
|
|
{51, 0x07, 0x00},
|
|
|
|
{49, 0x0a, 0x00},
|
|
|
|
{47, 0x11, 0x00},
|
|
|
|
{45, 0x18, 0x00},
|
|
|
|
{43, 0x26, 0x00},
|
|
|
|
{42, 0x36, 0x00},
|
|
|
|
{41, 0xff, 0x00}
|
|
|
|
};
|
|
|
|
|
2009-06-13 11:38:31 +00:00
|
|
|
/*
|
|
|
|
* Description: Set Antenna mode
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-19 19:33:04 +00:00
|
|
|
* priv - Device Structure
|
|
|
|
* antenna_mode - Antenna Mode
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2019-05-20 16:39:02 +00:00
|
|
|
int vnt_set_antenna_mode(struct vnt_private *priv, u8 antenna_mode)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2014-05-19 19:33:04 +00:00
|
|
|
switch (antenna_mode) {
|
2014-05-19 19:33:03 +00:00
|
|
|
case ANT_TXA:
|
|
|
|
case ANT_TXB:
|
|
|
|
break;
|
|
|
|
case ANT_RXA:
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf &= 0xFC;
|
2014-05-19 19:33:03 +00:00
|
|
|
break;
|
|
|
|
case ANT_RXB:
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf &= 0xFE;
|
|
|
|
priv->bb_rx_conf |= 0x02;
|
2014-05-19 19:33:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
return vnt_control_out(priv, MESSAGE_TYPE_SET_ANTMD,
|
|
|
|
(u16)antenna_mode, 0, 0, NULL);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Set Antenna mode
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
|
|
|
* pDevice - Device Structure
|
|
|
|
* byAntennaMode - Antenna Mode
|
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2010-08-02 23:51:57 +00:00
|
|
|
|
2014-07-16 21:21:53 +00:00
|
|
|
int vnt_vt3184_init(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2020-04-11 12:51:04 +00:00
|
|
|
int ret;
|
2014-05-25 20:36:26 +00:00
|
|
|
u16 length;
|
2020-05-04 17:14:14 +00:00
|
|
|
u8 *addr = NULL;
|
|
|
|
const u8 *c_addr;
|
staging: vt6656: [BUG] Fix for TX USB resets from vendors driver.
This fixes resets on heavy TX data traffic.
Vendor driver
VT6656_Linux_src_v1.21.03_x86_11.04.zip
http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704
This is GPL-licensed code.
original code
BBbVT3184Init
...
//2007-0725, RobertChang add, Enable Squelch detect reset option(SQ_RST_Opt), USB (register4, bit1)
CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
byData = byData|2 ;
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_WRITE,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
return TRUE;//ntStatus;
....
A back port patch is needed for kernels less than 3.10.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-07 21:49:04 +00:00
|
|
|
u8 data;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_in(priv, MESSAGE_TYPE_READ, 0, MESSAGE_REQUEST_EEPROM,
|
|
|
|
EEP_MAX_CONTEXT_SIZE, priv->eeprom);
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2014-07-20 14:33:16 +00:00
|
|
|
priv->rf_type = priv->eeprom[EEP_OFS_RFTYPE];
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2014-07-19 11:30:07 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "RF Type %d\n", priv->rf_type);
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2020-04-11 12:51:03 +00:00
|
|
|
if ((priv->rf_type == RF_AL2230) ||
|
|
|
|
(priv->rf_type == RF_AL2230S) ||
|
|
|
|
(priv->rf_type == RF_AIROHA7230)) {
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf = vnt_vt3184_al2230[10];
|
2014-07-12 19:12:44 +00:00
|
|
|
length = sizeof(vnt_vt3184_al2230);
|
|
|
|
addr = vnt_vt3184_al2230;
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2020-04-11 12:51:03 +00:00
|
|
|
if (priv->rf_type == RF_AIROHA7230)
|
|
|
|
addr[0xd7] = 0x06;
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2014-07-20 14:33:25 +00:00
|
|
|
priv->bb_vga[0] = 0x1c;
|
|
|
|
priv->bb_vga[1] = 0x10;
|
|
|
|
priv->bb_vga[2] = 0x0;
|
|
|
|
priv->bb_vga[3] = 0x0;
|
2014-07-20 14:33:26 +00:00
|
|
|
|
2014-07-19 11:30:07 +00:00
|
|
|
} else if ((priv->rf_type == RF_VT3226) ||
|
2020-04-11 12:51:03 +00:00
|
|
|
(priv->rf_type == RF_VT3226D0) ||
|
|
|
|
(priv->rf_type == RF_VT3342A0)) {
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf = vnt_vt3184_vt3226d0[10];
|
2014-07-12 19:12:45 +00:00
|
|
|
length = sizeof(vnt_vt3184_vt3226d0);
|
2020-05-04 17:14:14 +00:00
|
|
|
c_addr = vnt_vt3184_vt3226d0;
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2014-07-20 14:33:25 +00:00
|
|
|
priv->bb_vga[0] = 0x20;
|
|
|
|
priv->bb_vga[1] = 0x10;
|
|
|
|
priv->bb_vga[2] = 0x0;
|
|
|
|
priv->bb_vga[3] = 0x0;
|
2014-07-20 14:33:26 +00:00
|
|
|
|
2013-12-07 11:40:28 +00:00
|
|
|
/* Fix VT3226 DFC system timing issue */
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2,
|
|
|
|
SOFTPWRCTL_RFLEOPT);
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
2013-12-07 11:40:28 +00:00
|
|
|
} else {
|
2019-05-20 16:39:02 +00:00
|
|
|
goto end;
|
2013-12-07 11:40:28 +00:00
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2020-05-04 17:14:14 +00:00
|
|
|
if (addr)
|
|
|
|
c_addr = addr;
|
|
|
|
|
2019-12-20 21:15:24 +00:00
|
|
|
ret = vnt_control_out_blocks(priv, VNT_REG_BLOCK_SIZE,
|
2020-05-04 17:14:14 +00:00
|
|
|
MESSAGE_REQUEST_BBREG, length, c_addr);
|
2019-05-20 16:39:02 +00:00
|
|
|
if (ret)
|
|
|
|
goto end;
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0,
|
2020-02-29 20:33:54 +00:00
|
|
|
MESSAGE_REQUEST_BBAGC,
|
|
|
|
sizeof(vnt_vt3184_agc), vnt_vt3184_agc);
|
2019-05-20 16:39:02 +00:00
|
|
|
if (ret)
|
|
|
|
goto end;
|
2013-12-07 11:40:28 +00:00
|
|
|
|
2020-04-11 12:51:03 +00:00
|
|
|
if ((priv->rf_type == RF_VT3226) ||
|
|
|
|
(priv->rf_type == RF_VT3342A0) ||
|
|
|
|
(priv->rf_type == RF_VT3226D0)) {
|
|
|
|
data = (priv->rf_type == RF_VT3226D0) ? 0x11 : 0x23;
|
2019-05-20 16:39:02 +00:00
|
|
|
|
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG,
|
2020-04-11 12:51:03 +00:00
|
|
|
MAC_REG_ITRTMSET, data);
|
2019-05-20 16:39:02 +00:00
|
|
|
if (ret)
|
|
|
|
goto end;
|
|
|
|
|
2020-03-20 18:13:26 +00:00
|
|
|
ret = vnt_mac_reg_bits_on(priv, MAC_REG_PAPEDELAY, BIT(0));
|
2019-05-20 16:39:02 +00:00
|
|
|
if (ret)
|
|
|
|
goto end;
|
2013-12-07 11:40:28 +00:00
|
|
|
}
|
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x04, 0x7f);
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01);
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
|
|
|
|
|
|
|
ret = vnt_rf_table_download(priv);
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
staging: vt6656: [BUG] Fix for TX USB resets from vendors driver.
This fixes resets on heavy TX data traffic.
Vendor driver
VT6656_Linux_src_v1.21.03_x86_11.04.zip
http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704
This is GPL-licensed code.
original code
BBbVT3184Init
...
//2007-0725, RobertChang add, Enable Squelch detect reset option(SQ_RST_Opt), USB (register4, bit1)
CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
byData = byData|2 ;
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_WRITE,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
return TRUE;//ntStatus;
....
A back port patch is needed for kernels less than 3.10.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-07 21:49:04 +00:00
|
|
|
|
|
|
|
/* Fix for TX USB resets from vendors driver */
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_in(priv, MESSAGE_TYPE_READ, USB_REG4,
|
|
|
|
MESSAGE_REQUEST_MEM, sizeof(data), &data);
|
|
|
|
if (ret)
|
|
|
|
goto end;
|
staging: vt6656: [BUG] Fix for TX USB resets from vendors driver.
This fixes resets on heavy TX data traffic.
Vendor driver
VT6656_Linux_src_v1.21.03_x86_11.04.zip
http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704
This is GPL-licensed code.
original code
BBbVT3184Init
...
//2007-0725, RobertChang add, Enable Squelch detect reset option(SQ_RST_Opt), USB (register4, bit1)
CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
byData = byData|2 ;
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_WRITE,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
return TRUE;//ntStatus;
....
A back port patch is needed for kernels less than 3.10.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-07 21:49:04 +00:00
|
|
|
|
|
|
|
data |= 0x2;
|
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_out(priv, MESSAGE_TYPE_WRITE, USB_REG4,
|
|
|
|
MESSAGE_REQUEST_MEM, sizeof(data), &data);
|
staging: vt6656: [BUG] Fix for TX USB resets from vendors driver.
This fixes resets on heavy TX data traffic.
Vendor driver
VT6656_Linux_src_v1.21.03_x86_11.04.zip
http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704
This is GPL-licensed code.
original code
BBbVT3184Init
...
//2007-0725, RobertChang add, Enable Squelch detect reset option(SQ_RST_Opt), USB (register4, bit1)
CONTROLnsRequestIn(pDevice,
MESSAGE_TYPE_READ,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
byData = byData|2 ;
CONTROLnsRequestOut(pDevice,
MESSAGE_TYPE_WRITE,
(WORD)0x600+4, // USB's Reg4's bit1
MESSAGE_REQUEST_MEM,
1,
(PBYTE) &byData);
return TRUE;//ntStatus;
....
A back port patch is needed for kernels less than 3.10.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org # v3.10+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-11-07 21:49:04 +00:00
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
end:
|
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Description: Set ShortSlotTime mode
|
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-19 19:33:05 +00:00
|
|
|
* priv - Device Structure
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2019-05-20 16:39:02 +00:00
|
|
|
int vnt_set_short_slot_time(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2019-05-20 16:39:02 +00:00
|
|
|
int ret = 0;
|
2014-05-19 19:33:05 +00:00
|
|
|
u8 bb_vga = 0;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-20 14:33:21 +00:00
|
|
|
if (priv->short_slot_time)
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf &= 0xdf;
|
2011-11-30 02:19:08 +00:00
|
|
|
else
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf |= 0x20;
|
2014-05-19 19:33:05 +00:00
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
ret = vnt_control_in_u8(priv, MESSAGE_REQUEST_BBREG, 0xe7, &bb_vga);
|
|
|
|
if (ret)
|
2020-04-25 13:42:56 +00:00
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-07-20 14:33:25 +00:00
|
|
|
if (bb_vga == priv->bb_vga[0])
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf |= 0x20;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2020-04-25 13:42:56 +00:00
|
|
|
return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a,
|
|
|
|
priv->bb_rx_conf);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2020-04-25 13:42:56 +00:00
|
|
|
int vnt_set_vga_gain_offset(struct vnt_private *priv, u8 data)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2020-04-25 13:42:56 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xE7, data);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-19 19:33:06 +00:00
|
|
|
/* patch for 3253B0 Baseband with Cardbus module */
|
2014-07-20 14:33:21 +00:00
|
|
|
if (priv->short_slot_time)
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf &= 0xdf; /* 1101 1111 */
|
2011-11-30 02:19:08 +00:00
|
|
|
else
|
2014-07-19 11:30:08 +00:00
|
|
|
priv->bb_rx_conf |= 0x20; /* 0010 0000 */
|
2011-11-30 02:19:08 +00:00
|
|
|
|
2020-04-25 13:42:56 +00:00
|
|
|
return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0a,
|
|
|
|
priv->bb_rx_conf);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-07-16 21:21:56 +00:00
|
|
|
* Description: vnt_set_deep_sleep
|
2009-06-13 11:38:31 +00:00
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* In:
|
2014-05-19 19:33:07 +00:00
|
|
|
* priv - Device Structure
|
2009-06-13 11:38:31 +00:00
|
|
|
* Out:
|
|
|
|
* none
|
|
|
|
*
|
|
|
|
* Return Value: none
|
|
|
|
*
|
|
|
|
*/
|
2019-05-20 16:39:02 +00:00
|
|
|
int vnt_set_deep_sleep(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2019-05-20 16:39:02 +00:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
/* CR12 */
|
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0c, 0x17);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* CR13 */
|
|
|
|
return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0xB9);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2019-05-20 16:39:02 +00:00
|
|
|
int vnt_exit_deep_sleep(struct vnt_private *priv)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2019-05-20 16:39:02 +00:00
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
/* CR12 */
|
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0c, 0x00);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* CR13 */
|
|
|
|
return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0x0d, 0x01);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|
2020-04-25 13:42:56 +00:00
|
|
|
int vnt_update_pre_ed_threshold(struct vnt_private *priv, int scanning)
|
2009-06-13 11:38:31 +00:00
|
|
|
{
|
2020-03-28 18:17:06 +00:00
|
|
|
const struct vnt_threshold *threshold = NULL;
|
|
|
|
u8 length;
|
|
|
|
u8 cr_201, cr_206;
|
2020-04-14 14:35:02 +00:00
|
|
|
u8 ed_inx;
|
2020-04-25 13:42:56 +00:00
|
|
|
int ret;
|
2014-05-19 19:33:12 +00:00
|
|
|
|
2014-07-19 11:30:07 +00:00
|
|
|
switch (priv->rf_type) {
|
2014-05-19 19:33:12 +00:00
|
|
|
case RF_AL2230:
|
|
|
|
case RF_AL2230S:
|
|
|
|
case RF_AIROHA7230:
|
2020-03-28 18:17:06 +00:00
|
|
|
threshold = al2230_vnt_threshold;
|
|
|
|
length = ARRAY_SIZE(al2230_vnt_threshold);
|
2014-05-19 19:33:12 +00:00
|
|
|
break;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-19 19:33:12 +00:00
|
|
|
case RF_VT3226:
|
|
|
|
case RF_VT3226D0:
|
2020-03-28 18:17:06 +00:00
|
|
|
threshold = vt3226_vnt_threshold;
|
|
|
|
length = ARRAY_SIZE(vt3226_vnt_threshold);
|
2014-05-19 19:33:12 +00:00
|
|
|
break;
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2014-05-19 19:33:12 +00:00
|
|
|
case RF_VT3342A0:
|
2020-03-28 18:17:06 +00:00
|
|
|
threshold = vt3342_vnt_threshold;
|
|
|
|
length = ARRAY_SIZE(vt3342_vnt_threshold);
|
2014-05-19 19:33:12 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-13 11:38:31 +00:00
|
|
|
|
2020-03-28 18:17:06 +00:00
|
|
|
if (!threshold)
|
2020-04-25 13:42:56 +00:00
|
|
|
return -EINVAL;
|
2020-03-28 18:17:06 +00:00
|
|
|
|
|
|
|
for (ed_inx = scanning ? 0 : length - 1; ed_inx > 0; ed_inx--) {
|
|
|
|
if (priv->bb_pre_ed_rssi <= threshold[ed_inx].bb_pre_ed_rssi)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cr_201 = threshold[ed_inx].cr_201;
|
|
|
|
cr_206 = threshold[ed_inx].cr_206;
|
|
|
|
|
2014-07-20 14:33:28 +00:00
|
|
|
if (ed_inx == priv->bb_pre_ed_index && !scanning)
|
2020-04-25 13:42:56 +00:00
|
|
|
return 0;
|
2014-05-19 19:33:11 +00:00
|
|
|
|
2014-07-20 14:33:28 +00:00
|
|
|
priv->bb_pre_ed_index = ed_inx;
|
2014-05-19 19:33:11 +00:00
|
|
|
|
2014-07-20 14:33:27 +00:00
|
|
|
dev_dbg(&priv->usb->dev, "%s bb_pre_ed_rssi %d\n",
|
2016-04-20 07:23:03 +00:00
|
|
|
__func__, priv->bb_pre_ed_rssi);
|
2014-05-19 19:33:09 +00:00
|
|
|
|
2020-04-25 13:42:56 +00:00
|
|
|
ret = vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xc9, cr_201);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
return vnt_control_out_u8(priv, MESSAGE_REQUEST_BBREG, 0xce, cr_206);
|
2009-06-13 11:38:31 +00:00
|
|
|
}
|
|
|
|
|