mirror of
https://github.com/torvalds/linux.git
synced 2024-12-09 04:31:39 +00:00
wifi: rtl8xxxu: Support new chip RTL8188EU
This chip is found in cheap USB devices from TP-Link, D-Link, etc. Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps. Chip versions older than "I cut" need software rate control. That will be in the next commit. Until then MCS7 is used for all data frames. The "I cut" chips are not supported. They require different firmware and initialisation tables. Support can be added if someone has the hardware to test it. Co-developed-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Co-developed-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Taehee Yoo <ap420073@gmail.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com> Co-developed-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/3aad60f6-23f9-81e8-c741-4bd51e99f423@gmail.com
This commit is contained in:
parent
b75289e894
commit
3dfb8e844f
@ -10,7 +10,7 @@ config RTL8XXXU
|
||||
parts written to utilize the Linux mac80211 stack.
|
||||
The driver is known to work with a number of RTL8723AU,
|
||||
RL8188CU, RTL8188RU, RTL8191CU, RTL8192CU, RTL8723BU, RTL8192EU,
|
||||
and RTL8188FU devices.
|
||||
RTL8188FU, and RTL8188EU devices.
|
||||
|
||||
This driver is under development and has a limited feature
|
||||
set. In particular it does not yet support 40MHz channels
|
||||
|
@ -2,4 +2,5 @@
|
||||
obj-$(CONFIG_RTL8XXXU) += rtl8xxxu.o
|
||||
|
||||
rtl8xxxu-y := rtl8xxxu_core.o rtl8xxxu_8192e.o rtl8xxxu_8723b.o \
|
||||
rtl8xxxu_8723a.o rtl8xxxu_8192c.o rtl8xxxu_8188f.o
|
||||
rtl8xxxu_8723a.o rtl8xxxu_8192c.o rtl8xxxu_8188f.o \
|
||||
rtl8xxxu_8188e.o
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#define TX_TOTAL_PAGE_NUM 0xf8
|
||||
#define TX_TOTAL_PAGE_NUM_8188F 0xf7
|
||||
#define TX_TOTAL_PAGE_NUM_8188E 0xa9
|
||||
#define TX_TOTAL_PAGE_NUM_8192E 0xf3
|
||||
#define TX_TOTAL_PAGE_NUM_8723B 0xf7
|
||||
/* (HPQ + LPQ + NPQ + PUBQ) = TX_TOTAL_PAGE_NUM */
|
||||
@ -49,6 +50,11 @@
|
||||
#define TX_PAGE_NUM_LO_PQ_8188F 0x02
|
||||
#define TX_PAGE_NUM_NORM_PQ_8188F 0x02
|
||||
|
||||
#define TX_PAGE_NUM_PUBQ_8188E 0x47
|
||||
#define TX_PAGE_NUM_HI_PQ_8188E 0x29
|
||||
#define TX_PAGE_NUM_LO_PQ_8188E 0x1c
|
||||
#define TX_PAGE_NUM_NORM_PQ_8188E 0x1c
|
||||
|
||||
#define TX_PAGE_NUM_PUBQ_8192E 0xe7
|
||||
#define TX_PAGE_NUM_HI_PQ_8192E 0x08
|
||||
#define TX_PAGE_NUM_LO_PQ_8192E 0x0c
|
||||
@ -153,7 +159,8 @@ struct rtl8xxxu_rxdesc16 {
|
||||
u32 htc:1;
|
||||
u32 eosp:1;
|
||||
u32 bssidfit:2;
|
||||
u32 reserved1:16;
|
||||
u32 rpt_sel:2; /* 8188e */
|
||||
u32 reserved1:14;
|
||||
u32 unicastwake:1;
|
||||
u32 magicwake:1;
|
||||
|
||||
@ -211,7 +218,8 @@ struct rtl8xxxu_rxdesc16 {
|
||||
|
||||
u32 magicwake:1;
|
||||
u32 unicastwake:1;
|
||||
u32 reserved1:16;
|
||||
u32 reserved1:14;
|
||||
u32 rpt_sel:2; /* 8188e */
|
||||
u32 bssidfit:2;
|
||||
u32 eosp:1;
|
||||
u32 htc:1;
|
||||
@ -502,6 +510,8 @@ struct rtl8xxxu_txdesc40 {
|
||||
#define TXDESC_AMPDU_DENSITY_SHIFT 20
|
||||
#define TXDESC40_BT_INT BIT(23)
|
||||
#define TXDESC40_GID_SHIFT 24
|
||||
#define TXDESC_ANTENNA_SELECT_A BIT(24)
|
||||
#define TXDESC_ANTENNA_SELECT_B BIT(25)
|
||||
|
||||
/* Word 3 */
|
||||
#define TXDESC40_USE_DRIVER_RATE BIT(8)
|
||||
@ -546,6 +556,10 @@ struct rtl8xxxu_txdesc40 {
|
||||
|
||||
/* Word 6 */
|
||||
#define TXDESC_MAX_AGG_SHIFT 11
|
||||
#define TXDESC_USB_TX_AGG_SHIT 24
|
||||
|
||||
/* Word 7 */
|
||||
#define TXDESC_ANTENNA_SELECT_C BIT(29)
|
||||
|
||||
/* Word 8 */
|
||||
#define TXDESC40_HW_SEQ_ENABLE BIT(15)
|
||||
@ -912,6 +926,42 @@ struct rtl8188fu_efuse {
|
||||
u8 res11[0xc3];
|
||||
};
|
||||
|
||||
struct rtl8188eu_efuse {
|
||||
__le16 rtl_id;
|
||||
u8 res0[0x0e];
|
||||
struct rtl8192eu_efuse_tx_power tx_power_index_A; /* 0x10 */
|
||||
u8 res1[0x7e]; /* 0x3a */
|
||||
u8 channel_plan; /* 0xb8 */
|
||||
u8 xtal_k;
|
||||
u8 thermal_meter;
|
||||
u8 iqk_lck;
|
||||
u8 res2[5];
|
||||
u8 rf_board_option;
|
||||
u8 rf_feature_option;
|
||||
u8 rf_bt_setting;
|
||||
u8 eeprom_version;
|
||||
u8 eeprom_customer_id;
|
||||
u8 res3[3];
|
||||
u8 rf_antenna_option; /* 0xc9 */
|
||||
u8 res4[6];
|
||||
u8 vid; /* 0xd0 */
|
||||
u8 res5[1];
|
||||
u8 pid; /* 0xd2 */
|
||||
u8 res6[1];
|
||||
u8 usb_optional_function;
|
||||
u8 res7[2];
|
||||
u8 mac_addr[ETH_ALEN]; /* 0xd7 */
|
||||
u8 res8[2];
|
||||
u8 vendor_name[7];
|
||||
u8 res9[2];
|
||||
u8 device_name[0x0b]; /* 0xe8 */
|
||||
u8 res10[2];
|
||||
u8 serial[0x0b]; /* 0xf5 */
|
||||
u8 res11[0x30];
|
||||
u8 unknown[0x0d]; /* 0x130 */
|
||||
u8 res12[0xc3];
|
||||
} __packed;
|
||||
|
||||
struct rtl8xxxu_reg8val {
|
||||
u16 reg;
|
||||
u8 val;
|
||||
@ -1435,6 +1485,7 @@ struct rtl8xxxu_priv {
|
||||
struct rtl8192cu_efuse efuse8192;
|
||||
struct rtl8192eu_efuse efuse8192eu;
|
||||
struct rtl8188fu_efuse efuse8188fu;
|
||||
struct rtl8188eu_efuse efuse8188eu;
|
||||
} efuse_wifi;
|
||||
u32 adda_backup[RTL8XXXU_ADDA_REGS];
|
||||
u32 mac_backup[RTL8XXXU_MAC_REGS];
|
||||
@ -1526,6 +1577,7 @@ struct rtl8xxxu_fileops {
|
||||
u8 page_num_hi;
|
||||
u8 page_num_lo;
|
||||
u8 page_num_norm;
|
||||
u8 last_llt_entry;
|
||||
};
|
||||
|
||||
extern int rtl8xxxu_debug;
|
||||
@ -1585,6 +1637,8 @@ void rtl8xxxu_gen1_phy_iq_calibrate(struct rtl8xxxu_priv *priv);
|
||||
void rtl8xxxu_gen1_init_phy_bb(struct rtl8xxxu_priv *priv);
|
||||
void rtl8xxxu_gen1_set_tx_power(struct rtl8xxxu_priv *priv,
|
||||
int channel, bool ht40);
|
||||
void rtl8188f_set_tx_power(struct rtl8xxxu_priv *priv,
|
||||
int channel, bool ht40);
|
||||
void rtl8xxxu_gen1_config_channel(struct ieee80211_hw *hw);
|
||||
void rtl8xxxu_gen2_config_channel(struct ieee80211_hw *hw);
|
||||
void rtl8xxxu_gen1_usb_quirks(struct rtl8xxxu_priv *priv);
|
||||
@ -1605,6 +1659,8 @@ void rtl8xxxu_init_burst(struct rtl8xxxu_priv *priv);
|
||||
int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
|
||||
int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
|
||||
int rtl8xxxu_gen2_channel_to_group(int channel);
|
||||
bool rtl8xxxu_simularity_compare(struct rtl8xxxu_priv *priv,
|
||||
int result[][8], int c1, int c2);
|
||||
bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv,
|
||||
int result[][8], int c1, int c2);
|
||||
void rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
@ -1617,13 +1673,20 @@ void rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
|
||||
bool short_preamble, bool ampdu_enable,
|
||||
u32 rts_rate);
|
||||
void rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
struct ieee80211_tx_info *tx_info,
|
||||
struct rtl8xxxu_txdesc32 *tx_desc32, bool sgi,
|
||||
bool short_preamble, bool ampdu_enable,
|
||||
u32 rts_rate);
|
||||
void rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
|
||||
u8 arg1, u8 arg2, u8 arg3, u8 arg4, u8 arg5);
|
||||
void rtl8723bu_phy_init_antenna_selection(struct rtl8xxxu_priv *priv);
|
||||
void rtl8723a_set_crystal_cap(struct rtl8xxxu_priv *priv, u8 crystal_cap);
|
||||
void rtl8188f_set_crystal_cap(struct rtl8xxxu_priv *priv, u8 crystal_cap);
|
||||
s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt);
|
||||
|
||||
extern struct rtl8xxxu_fileops rtl8188fu_fops;
|
||||
extern struct rtl8xxxu_fileops rtl8188eu_fops;
|
||||
extern struct rtl8xxxu_fileops rtl8192cu_fops;
|
||||
extern struct rtl8xxxu_fileops rtl8192eu_fops;
|
||||
extern struct rtl8xxxu_fileops rtl8723au_fops;
|
||||
|
1280
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
Normal file
1280
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -370,7 +370,7 @@ static void rtl8188f_channel_to_group(int channel, int *group, int *cck_group)
|
||||
*cck_group = *group;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
rtl8188f_set_tx_power(struct rtl8xxxu_priv *priv, int channel, bool ht40)
|
||||
{
|
||||
u32 val32, ofdm, mcs;
|
||||
@ -1651,7 +1651,7 @@ static void rtl8188f_usb_quirks(struct rtl8xxxu_priv *priv)
|
||||
#define XTAL1 GENMASK(22, 17)
|
||||
#define XTAL0 GENMASK(16, 11)
|
||||
|
||||
static void rtl8188f_set_crystal_cap(struct rtl8xxxu_priv *priv, u8 crystal_cap)
|
||||
void rtl8188f_set_crystal_cap(struct rtl8xxxu_priv *priv, u8 crystal_cap)
|
||||
{
|
||||
struct rtl8xxxu_cfo_tracking *cfo = &priv->cfo_tracking;
|
||||
u32 val32;
|
||||
|
@ -46,6 +46,7 @@ MODULE_LICENSE("GPL");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8723aufw_A.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8723aufw_B_NoBT.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8192cufw_A.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8192cufw_B.bin");
|
||||
MODULE_FIRMWARE("rtlwifi/rtl8192cufw_TMSC.bin");
|
||||
@ -2010,6 +2011,7 @@ int rtl8xxxu_load_firmware(struct rtl8xxxu_priv *priv, const char *fw_name)
|
||||
switch (signature & 0xfff0) {
|
||||
case 0x92e0:
|
||||
case 0x92c0:
|
||||
case 0x88e0:
|
||||
case 0x88c0:
|
||||
case 0x5300:
|
||||
case 0x2300:
|
||||
@ -2081,10 +2083,20 @@ rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->rtl_chip != RTL8723B &&
|
||||
priv->rtl_chip != RTL8192E &&
|
||||
priv->rtl_chip != RTL8188F)
|
||||
switch (priv->rtl_chip) {
|
||||
case RTL8188C:
|
||||
case RTL8188R:
|
||||
case RTL8191C:
|
||||
case RTL8192C:
|
||||
case RTL8723A:
|
||||
rtl8xxxu_write8(priv, REG_MAX_AGGR_NUM, 0x0a);
|
||||
break;
|
||||
case RTL8188E:
|
||||
rtl8xxxu_write16(priv, REG_MAX_AGGR_NUM, 0x0707);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2383,11 +2395,16 @@ static int rtl8xxxu_llt_write(struct rtl8xxxu_priv *priv, u8 address, u8 data)
|
||||
int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
int i, last_entry;
|
||||
u8 last_tx_page;
|
||||
|
||||
last_tx_page = priv->fops->total_page_num;
|
||||
|
||||
if (priv->fops->last_llt_entry)
|
||||
last_entry = priv->fops->last_llt_entry;
|
||||
else
|
||||
last_entry = 255;
|
||||
|
||||
for (i = 0; i < last_tx_page; i++) {
|
||||
ret = rtl8xxxu_llt_write(priv, i, i + 1);
|
||||
if (ret)
|
||||
@ -2399,14 +2416,14 @@ int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv)
|
||||
goto exit;
|
||||
|
||||
/* Mark remaining pages as a ring buffer */
|
||||
for (i = last_tx_page + 1; i < 0xff; i++) {
|
||||
for (i = last_tx_page + 1; i < last_entry; i++) {
|
||||
ret = rtl8xxxu_llt_write(priv, i, (i + 1));
|
||||
if (ret)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Let last entry point to the start entry of ring buffer */
|
||||
ret = rtl8xxxu_llt_write(priv, 0xff, last_tx_page + 1);
|
||||
ret = rtl8xxxu_llt_write(priv, last_entry, last_tx_page + 1);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
@ -2714,8 +2731,8 @@ void rtl8xxxu_fill_iqk_matrix_b(struct rtl8xxxu_priv *priv, bool iqk_ok,
|
||||
|
||||
#define MAX_TOLERANCE 5
|
||||
|
||||
static bool rtl8xxxu_simularity_compare(struct rtl8xxxu_priv *priv,
|
||||
int result[][8], int c1, int c2)
|
||||
bool rtl8xxxu_simularity_compare(struct rtl8xxxu_priv *priv,
|
||||
int result[][8], int c1, int c2)
|
||||
{
|
||||
u32 i, j, diff, simubitmap, bound = 0;
|
||||
int candidate[2] = {-1, -1}; /* for path A and path B */
|
||||
@ -3908,7 +3925,8 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
goto exit;
|
||||
|
||||
/* RFSW Control - clear bit 14 ?? */
|
||||
if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E)
|
||||
if (priv->rtl_chip != RTL8723B && priv->rtl_chip != RTL8192E &&
|
||||
priv->rtl_chip != RTL8188E)
|
||||
rtl8xxxu_write32(priv, REG_FPGA0_TX_INFO, 0x00000003);
|
||||
|
||||
val32 = FPGA0_RF_TRSW | FPGA0_RF_TRSWB | FPGA0_RF_ANTSW |
|
||||
@ -3921,7 +3939,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
rtl8xxxu_write32(priv, REG_FPGA0_XAB_RF_SW_CTRL, val32);
|
||||
|
||||
/* 0x860[6:5]= 00 - why? - this sets antenna B */
|
||||
if (priv->rtl_chip != RTL8192E)
|
||||
if (priv->rtl_chip != RTL8192E && priv->rtl_chip != RTL8188E)
|
||||
rtl8xxxu_write32(priv, REG_FPGA0_XA_RF_INT_OE, 0x66f60210);
|
||||
|
||||
if (!macpower) {
|
||||
@ -3989,6 +4007,15 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
} else if (priv->rtl_chip == RTL8188F) {
|
||||
rtl8xxxu_write32(priv, REG_HISR0, 0xffffffff);
|
||||
rtl8xxxu_write32(priv, REG_HISR1, 0xffffffff);
|
||||
} else if (priv->rtl_chip == RTL8188E) {
|
||||
rtl8xxxu_write32(priv, REG_HISR0, 0xffffffff);
|
||||
val32 = IMR0_PSTIMEOUT | IMR0_TBDER | IMR0_CPWM | IMR0_CPWM2;
|
||||
rtl8xxxu_write32(priv, REG_HIMR0, val32);
|
||||
val32 = IMR1_TXERR | IMR1_RXERR | IMR1_TXFOVW | IMR1_RXFOVW;
|
||||
rtl8xxxu_write32(priv, REG_HIMR1, val32);
|
||||
val8 = rtl8xxxu_read8(priv, REG_USB_SPECIAL_OPTION);
|
||||
val8 |= USB_SPEC_INT_BULK_SELECT;
|
||||
rtl8xxxu_write8(priv, REG_USB_SPECIAL_OPTION, val8);
|
||||
} else {
|
||||
/*
|
||||
* Enable all interrupts - not obvious USB needs to do this
|
||||
@ -4094,7 +4121,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
if (fops->init_aggregation)
|
||||
fops->init_aggregation(priv);
|
||||
|
||||
if (priv->rtl_chip == RTL8188F) {
|
||||
if (priv->rtl_chip == RTL8188F || priv->rtl_chip == RTL8188E) {
|
||||
rtl8xxxu_write16(priv, REG_PKT_VO_VI_LIFE_TIME, 0x0400); /* unit: 256us. 256ms */
|
||||
rtl8xxxu_write16(priv, REG_PKT_BE_BK_LIFE_TIME, 0x0400); /* unit: 256us. 256ms */
|
||||
}
|
||||
@ -4128,7 +4155,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
/* Disable BAR - not sure if this has any effect on USB */
|
||||
rtl8xxxu_write32(priv, REG_BAR_MODE_CTRL, 0x0201ffff);
|
||||
|
||||
if (priv->rtl_chip != RTL8188F)
|
||||
if (priv->rtl_chip != RTL8188F && priv->rtl_chip != RTL8188E)
|
||||
rtl8xxxu_write16(priv, REG_FAST_EDCA_CTRL, 0);
|
||||
|
||||
if (fops->init_statistics)
|
||||
@ -4146,9 +4173,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
* Reset USB mode switch setting
|
||||
*/
|
||||
rtl8xxxu_write8(priv, REG_ACLK_MON, 0x00);
|
||||
} else if (priv->rtl_chip == RTL8188F) {
|
||||
} else if (priv->rtl_chip == RTL8188F || priv->rtl_chip == RTL8188E) {
|
||||
/*
|
||||
* Init GPIO settings for 8188f
|
||||
* Init GPIO settings for 8188f, 8188e
|
||||
*/
|
||||
val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG);
|
||||
val8 &= ~GPIO_MUXCFG_IO_SEL_ENBT;
|
||||
@ -4194,7 +4221,7 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
|
||||
val32 |= FPGA_RF_MODE_CCK;
|
||||
rtl8xxxu_write32(priv, REG_FPGA0_RF_MODE, val32);
|
||||
}
|
||||
} else if (priv->rtl_chip == RTL8192E) {
|
||||
} else if (priv->rtl_chip == RTL8192E || priv->rtl_chip == RTL8188E) {
|
||||
rtl8xxxu_write8(priv, REG_USB_HRPWM, 0x00);
|
||||
}
|
||||
|
||||
@ -5081,6 +5108,96 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in v3 (gen1) specific TX descriptor bits.
|
||||
* This format is a hybrid between the v1 and v2 formats, only seen
|
||||
* on 8188eu devices so far.
|
||||
*/
|
||||
void
|
||||
rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
|
||||
struct ieee80211_tx_info *tx_info,
|
||||
struct rtl8xxxu_txdesc32 *tx_desc, bool sgi,
|
||||
bool short_preamble, bool ampdu_enable, u32 rts_rate)
|
||||
{
|
||||
struct ieee80211_rate *tx_rate = ieee80211_get_tx_rate(hw, tx_info);
|
||||
struct rtl8xxxu_priv *priv = hw->priv;
|
||||
struct device *dev = &priv->udev->dev;
|
||||
u8 *qc = ieee80211_get_qos_ctl(hdr);
|
||||
u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
|
||||
u32 rate;
|
||||
u16 rate_flags = tx_info->control.rates[0].flags;
|
||||
u16 seq_number;
|
||||
|
||||
if (rate_flags & IEEE80211_TX_RC_MCS &&
|
||||
!ieee80211_is_mgmt(hdr->frame_control))
|
||||
rate = tx_info->control.rates[0].idx + DESC_RATE_MCS0;
|
||||
else
|
||||
rate = tx_rate->hw_value;
|
||||
|
||||
seq_number = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl));
|
||||
|
||||
if (ieee80211_is_data(hdr->frame_control)) {
|
||||
rate = DESC_RATE_MCS7; /* TODO: software rate control */
|
||||
tx_desc->txdw5 = cpu_to_le32(rate);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE);
|
||||
/* Data/RTS rate FB limit */
|
||||
tx_desc->txdw5 |= cpu_to_le32(0x0001ff00);
|
||||
}
|
||||
|
||||
if (rtl8xxxu_debug & RTL8XXXU_DEBUG_TX)
|
||||
dev_info(dev, "%s: TX rate: %d, pkt size %d\n",
|
||||
__func__, rate, le16_to_cpu(tx_desc->pkt_size));
|
||||
|
||||
tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT);
|
||||
|
||||
if (ampdu_enable && test_bit(tid, priv->tid_tx_operational))
|
||||
tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE);
|
||||
else
|
||||
tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK);
|
||||
|
||||
if (ieee80211_is_mgmt(hdr->frame_control)) {
|
||||
tx_desc->txdw5 = cpu_to_le32(rate);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_USE_DRIVER_RATE);
|
||||
tx_desc->txdw5 |= cpu_to_le32(6 << TXDESC32_RETRY_LIMIT_SHIFT);
|
||||
tx_desc->txdw5 |= cpu_to_le32(TXDESC32_RETRY_LIMIT_ENABLE);
|
||||
}
|
||||
|
||||
if (ieee80211_is_data_qos(hdr->frame_control)) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_QOS);
|
||||
|
||||
if (conf_is_ht40(&hw->conf)) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC_DATA_BW);
|
||||
|
||||
if (conf_is_ht40_minus(&hw->conf))
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC_PRIME_CH_OFF_UPPER);
|
||||
else
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC_PRIME_CH_OFF_LOWER);
|
||||
}
|
||||
}
|
||||
|
||||
if (short_preamble)
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_SHORT_PREAMBLE);
|
||||
|
||||
if (sgi)
|
||||
tx_desc->txdw5 |= cpu_to_le32(TXDESC32_SHORT_GI);
|
||||
|
||||
/*
|
||||
* rts_rate is zero if RTS/CTS or CTS to SELF are not enabled
|
||||
*/
|
||||
tx_desc->txdw4 |= cpu_to_le32(rts_rate << TXDESC32_RTS_RATE_SHIFT);
|
||||
if (ampdu_enable || (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS)) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_RTS_CTS_ENABLE);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
|
||||
} else if (rate_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_CTS_SELF_ENABLE);
|
||||
tx_desc->txdw4 |= cpu_to_le32(TXDESC32_HW_RTS_ENABLE);
|
||||
}
|
||||
|
||||
tx_desc->txdw2 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_A |
|
||||
TXDESC_ANTENNA_SELECT_B);
|
||||
tx_desc->txdw7 |= cpu_to_le32(TXDESC_ANTENNA_SELECT_C);
|
||||
}
|
||||
|
||||
static void rtl8xxxu_tx(struct ieee80211_hw *hw,
|
||||
struct ieee80211_tx_control *control,
|
||||
struct sk_buff *skb)
|
||||
@ -6599,7 +6716,10 @@ exit:
|
||||
rtl8xxxu_write16(priv, REG_RXFLTMAP2, 0xffff);
|
||||
rtl8xxxu_write16(priv, REG_RXFLTMAP0, 0xffff);
|
||||
|
||||
rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e);
|
||||
if (priv->rtl_chip == RTL8188E)
|
||||
rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6955341e);
|
||||
else
|
||||
rtl8xxxu_write32(priv, REG_OFDM0_XA_AGC_CORE1, 0x6954341e);
|
||||
|
||||
return ret;
|
||||
|
||||
@ -6766,6 +6886,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
|
||||
case 0x817f:
|
||||
case 0x818b:
|
||||
case 0xf179:
|
||||
case 0x8179:
|
||||
untested = 0;
|
||||
break;
|
||||
}
|
||||
@ -6902,8 +7023,10 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
|
||||
|
||||
hw->extra_tx_headroom = priv->fops->tx_desc_size;
|
||||
ieee80211_hw_set(hw, SIGNAL_DBM);
|
||||
|
||||
/*
|
||||
* The firmware handles rate control
|
||||
* The firmware handles rate control, except for RTL8188EU,
|
||||
* where we handle the rate control in the driver.
|
||||
*/
|
||||
ieee80211_hw_set(hw, HAS_RATE_CONTROL);
|
||||
ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
|
||||
@ -6988,6 +7111,50 @@ static const struct usb_device_id dev_table[] = {
|
||||
/* RTL8188FU */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xf179, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188fu_fops},
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8179, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* Tested by Hans de Goede - rtl8188etv */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x0179, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* Sitecom rtl8188eus */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x0df6, 0x0076, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* D-Link USB-GO-N150 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3311, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* D-Link DWA-125 REV D1 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x330f, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* D-Link DWA-123 REV D1 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x3310, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* D-Link DWA-121 rev B1 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x331b, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* Abocom - Abocom */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x07b8, 0x8179, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* Elecom WDC-150SU2M */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x056e, 0x4008, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* TP-Link TL-WN722N v2 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x010c, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* TP-Link TL-WN727N v5.21 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0111, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* MERCUSYS MW150US v2 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x2c4e, 0x0102, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* ASUS USB-N10 Nano B1 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x0b05, 0x18f0, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* Edimax EW-7811Un V2 */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(0x7392, 0xb811, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
/* Rosewill USB-N150 Nano */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0xffef, 0xff, 0xff, 0xff),
|
||||
.driver_info = (unsigned long)&rtl8188eu_fops},
|
||||
#ifdef CONFIG_RTL8XXXU_UNTESTED
|
||||
/* Still supported by rtlwifi */
|
||||
{USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff),
|
||||
|
@ -371,6 +371,11 @@
|
||||
#define PBP_PAGE_SIZE_512 0x3
|
||||
#define PBP_PAGE_SIZE_1024 0x4
|
||||
|
||||
/* 8188eu IOL magic */
|
||||
#define REG_PKT_BUF_ACCESS_CTRL 0x0106
|
||||
#define PKT_BUF_ACCESS_CTRL_TX 0x69
|
||||
#define PKT_BUF_ACCESS_CTRL_RX 0xa5
|
||||
|
||||
#define REG_TRXDMA_CTRL 0x010c
|
||||
#define TRXDMA_CTRL_RXDMA_AGG_EN BIT(2)
|
||||
#define TRXDMA_CTRL_VOQ_SHIFT 4
|
||||
@ -407,6 +412,8 @@
|
||||
#define REG_MBIST_START 0x0174
|
||||
#define REG_MBIST_DONE 0x0178
|
||||
#define REG_MBIST_FAIL 0x017c
|
||||
/* 8188EU */
|
||||
#define REG_32K_CTRL 0x0194
|
||||
#define REG_C2HEVT_MSG_NORMAL 0x01a0
|
||||
/* 8192EU/8723BU/8812 */
|
||||
#define REG_C2HEVT_CMD_ID_8723B 0x01ae
|
||||
@ -942,6 +949,16 @@
|
||||
#define REG_FPGA1_RF_MODE 0x0900
|
||||
|
||||
#define REG_FPGA1_TX_INFO 0x090c
|
||||
#define FPGA1_TX_ANT_MASK 0x0000000f
|
||||
#define FPGA1_TX_ANT_L_MASK 0x000000f0
|
||||
#define FPGA1_TX_ANT_NON_HT_MASK 0x00000f00
|
||||
#define FPGA1_TX_ANT_HT1_MASK 0x0000f000
|
||||
#define FPGA1_TX_ANT_HT2_MASK 0x000f0000
|
||||
#define FPGA1_TX_ANT_HT_S1_MASK 0x00f00000
|
||||
#define FPGA1_TX_ANT_NON_HT_S1_MASK 0x0f000000
|
||||
#define FPGA1_TX_OFDM_TXSC_MASK 0x30000000
|
||||
|
||||
#define REG_ANT_MAPPING1 0x0914
|
||||
#define REG_DPDT_CTRL 0x092c /* 8723BU */
|
||||
#define REG_RFE_CTRL_ANTA_SRC 0x0930 /* 8723BU */
|
||||
#define REG_RFE_PATH_SELECT 0x0940 /* 8723BU */
|
||||
@ -954,9 +971,25 @@
|
||||
|
||||
#define REG_CCK0_AFE_SETTING 0x0a04
|
||||
#define CCK0_AFE_RX_MASK 0x0f000000
|
||||
#define CCK0_AFE_RX_ANT_AB BIT(24)
|
||||
#define CCK0_AFE_TX_MASK 0xf0000000
|
||||
#define CCK0_AFE_RX_ANT_A 0
|
||||
#define CCK0_AFE_RX_ANT_B (BIT(24) | BIT(26))
|
||||
#define CCK0_AFE_RX_ANT_B BIT(26)
|
||||
#define CCK0_AFE_RX_ANT_C BIT(27)
|
||||
#define CCK0_AFE_RX_ANT_D (BIT(26) | BIT(27))
|
||||
#define CCK0_AFE_RX_ANT_OPTION_A 0
|
||||
#define CCK0_AFE_RX_ANT_OPTION_B BIT(24)
|
||||
#define CCK0_AFE_RX_ANT_OPTION_C BIT(25)
|
||||
#define CCK0_AFE_RX_ANT_OPTION_D (BIT(24) | BIT(25))
|
||||
#define CCK0_AFE_TX_ANT_A BIT(31)
|
||||
#define CCK0_AFE_TX_ANT_B BIT(30)
|
||||
|
||||
#define REG_CCK_ANTDIV_PARA2 0x0a04
|
||||
#define REG_BB_POWER_SAVE4 0x0a74
|
||||
|
||||
/* 8188eu */
|
||||
#define REG_LNA_SWITCH 0x0b2c
|
||||
#define LNA_SWITCH_DISABLE_CSCG BIT(22)
|
||||
#define LNA_SWITCH_OUTPUT_CG BIT(31)
|
||||
|
||||
#define REG_CCK_PD_THRESH 0x0a0a
|
||||
#define CCK_PD_TYPE1_LV0_TH 0x40
|
||||
@ -1020,6 +1053,9 @@
|
||||
|
||||
#define REG_OFDM0_RX_IQ_EXT_ANTA 0x0ca0
|
||||
|
||||
/* 8188eu */
|
||||
#define REG_ANTDIV_PARA1 0x0ca4
|
||||
|
||||
/* 8723bu */
|
||||
#define REG_OFDM0_TX_PSDO_NOISE_WEIGHT 0x0ce4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user