提交 70664495 编写于 作者: B Bitterblue Smith 提交者: Kalle Valo

wifi: rtl8xxxu: Support new chip RTL8710BU aka RTL8188GU

This chip is found in cheap "free driver" USB adapters from Aliexpress.
Initially they pretend to be a CD-ROM containing the driver for Windows.
"Ejecting" switches the device to wifi mode.

Features: 2.4 GHz, b/g/n mode, 1T1R, 150 Mbps.

This chip is more unique than other Realtek chips:

* The registers at addresses 0x0-0xff, which all the other chips use,
  can't be used here. New registers at 0x8000-0x80ff must be used
  instead. And it's not a simple matter of adding 0x8000: 0x2
  (REG_SYS_FUNC) became 0x8004, 0x80 (REG_MCU_FW_DL) became 0x8090,
  etc.

* Also there are a few new registers which must be accessed indirectly
  because their addresses don't fit in 16 bits. No other chips seem to
  have these.

* The vendor driver compiles to 8188gu.ko, but the code calls the chip
  RTL8710B(U) pretty much everywhere, including messages visible to the
  user.

Another difference compared to the other chips supported by rtl8xxxu is
that it has a new PHY status struct, or three of them actually, from
which we extract the RSSI, among other things. This is not unique,
though, just new. The chips supported by rtw88 also use it.
Signed-off-by: NBitterblue Smith <rtl8821cerfe2@gmail.com>
Reviewed-by: NPing-Ke Shih <pkshih@realtek.com>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: NKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/4edbe29f-00b9-8eef-9789-20bed0b141e2@gmail.com
上级 d46e04cc
......@@ -11,7 +11,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,
RTL8188FU, and RTL8188EU devices.
RTL8188FU, RTL8188EU, and RTL8710BU (aka RTL8188GU) devices.
This driver is under development and has a limited feature
set. In particular it does not yet support 40MHz channels
......
......@@ -3,4 +3,4 @@ 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_8188e.o
rtl8xxxu_8188e.o rtl8xxxu_8710b.o
......@@ -103,7 +103,8 @@ enum rtl8xxxu_rtl_chip {
RTL8822B = 0x8822b,
RTL8703B = 0x8703b,
RTL8195A = 0x8195a,
RTL8188F = 0x8188f
RTL8188F = 0x8188f,
RTL8710B = 0x8710b,
};
enum rtl8xxxu_rx_type {
......@@ -618,6 +619,265 @@ struct rtl8723au_phy_stats {
#endif
};
struct jaguar2_phy_stats_type0 {
/* DW0 */
u8 page_num;
u8 pwdb;
#ifdef __LITTLE_ENDIAN
u8 gain: 6;
u8 rsvd_0: 1;
u8 trsw: 1;
#else
u8 trsw: 1;
u8 rsvd_0: 1;
u8 gain: 6;
#endif
u8 rsvd_1;
/* DW1 */
u8 rsvd_2;
#ifdef __LITTLE_ENDIAN
u8 rxsc: 4;
u8 agc_table: 4;
#else
u8 agc_table: 4;
u8 rxsc: 4;
#endif
u8 channel;
u8 band;
/* DW2 */
u16 length;
#ifdef __LITTLE_ENDIAN
u8 antidx_a: 3;
u8 antidx_b: 3;
u8 rsvd_3: 2;
u8 antidx_c: 3;
u8 antidx_d: 3;
u8 rsvd_4:2;
#else
u8 rsvd_3: 2;
u8 antidx_b: 3;
u8 antidx_a: 3;
u8 rsvd_4:2;
u8 antidx_d: 3;
u8 antidx_c: 3;
#endif
/* DW3 */
u8 signal_quality;
#ifdef __LITTLE_ENDIAN
u8 vga:5;
u8 lna_l:3;
u8 bb_power:6;
u8 rsvd_9:1;
u8 lna_h:1;
#else
u8 lna_l:3;
u8 vga:5;
u8 lna_h:1;
u8 rsvd_9:1;
u8 bb_power:6;
#endif
u8 rsvd_5;
/* DW4 */
u32 rsvd_6;
/* DW5 */
u32 rsvd_7;
/* DW6 */
u32 rsvd_8;
} __packed;
struct jaguar2_phy_stats_type1 {
/* DW0 and DW1 */
u8 page_num;
u8 pwdb[4];
#ifdef __LITTLE_ENDIAN
u8 l_rxsc: 4;
u8 ht_rxsc: 4;
#else
u8 ht_rxsc: 4;
u8 l_rxsc: 4;
#endif
u8 channel;
#ifdef __LITTLE_ENDIAN
u8 band: 2;
u8 rsvd_0: 1;
u8 hw_antsw_occu: 1;
u8 gnt_bt: 1;
u8 ldpc: 1;
u8 stbc: 1;
u8 beamformed: 1;
#else
u8 beamformed: 1;
u8 stbc: 1;
u8 ldpc: 1;
u8 gnt_bt: 1;
u8 hw_antsw_occu: 1;
u8 rsvd_0: 1;
u8 band: 2;
#endif
/* DW2 */
u16 lsig_length;
#ifdef __LITTLE_ENDIAN
u8 antidx_a: 3;
u8 antidx_b: 3;
u8 rsvd_1: 2;
u8 antidx_c: 3;
u8 antidx_d: 3;
u8 rsvd_2: 2;
#else
u8 rsvd_1: 2;
u8 antidx_b: 3;
u8 antidx_a: 3;
u8 rsvd_2: 2;
u8 antidx_d: 3;
u8 antidx_c: 3;
#endif
/* DW3 */
u8 paid;
#ifdef __LITTLE_ENDIAN
u8 paid_msb: 1;
u8 gid: 6;
u8 rsvd_3: 1;
#else
u8 rsvd_3: 1;
u8 gid: 6;
u8 paid_msb: 1;
#endif
u8 intf_pos;
#ifdef __LITTLE_ENDIAN
u8 intf_pos_msb: 1;
u8 rsvd_4: 2;
u8 nb_intf_flag: 1;
u8 rf_mode: 2;
u8 rsvd_5: 2;
#else
u8 rsvd_5: 2;
u8 rf_mode: 2;
u8 nb_intf_flag: 1;
u8 rsvd_4: 2;
u8 intf_pos_msb: 1;
#endif
/* DW4 */
s8 rxevm[4]; /* s(8,1) */
/* DW5 */
s8 cfo_tail[4]; /* s(8,7) */
/* DW6 */
s8 rxsnr[4]; /* s(8,1) */
} __packed;
struct jaguar2_phy_stats_type2 {
/* DW0 ane DW1 */
u8 page_num;
u8 pwdb[4];
#ifdef __LITTLE_ENDIAN
u8 l_rxsc: 4;
u8 ht_rxsc: 4;
#else
u8 ht_rxsc: 4;
u8 l_rxsc: 4;
#endif
u8 channel;
#ifdef __LITTLE_ENDIAN
u8 band: 2;
u8 rsvd_0: 1;
u8 hw_antsw_occu: 1;
u8 gnt_bt: 1;
u8 ldpc: 1;
u8 stbc: 1;
u8 beamformed: 1;
#else
u8 beamformed: 1;
u8 stbc: 1;
u8 ldpc: 1;
u8 gnt_bt: 1;
u8 hw_antsw_occu: 1;
u8 rsvd_0: 1;
u8 band: 2;
#endif
/* DW2 */
#ifdef __LITTLE_ENDIAN
u8 shift_l_map: 6;
u8 rsvd_1: 2;
#else
u8 rsvd_1: 2;
u8 shift_l_map: 6;
#endif
u8 cnt_pw2cca;
#ifdef __LITTLE_ENDIAN
u8 agc_table_a: 4;
u8 agc_table_b: 4;
u8 agc_table_c: 4;
u8 agc_table_d: 4;
#else
u8 agc_table_b: 4;
u8 agc_table_a: 4;
u8 agc_table_d: 4;
u8 agc_table_c: 4;
#endif
/* DW3 ~ DW6*/
u8 cnt_cca2agc_rdy;
#ifdef __LITTLE_ENDIAN
u8 gain_a: 6;
u8 rsvd_2: 1;
u8 trsw_a: 1;
u8 gain_b: 6;
u8 rsvd_3: 1;
u8 trsw_b: 1;
u8 gain_c: 6;
u8 rsvd_4: 1;
u8 trsw_c: 1;
u8 gain_d: 6;
u8 rsvd_5: 1;
u8 trsw_d: 1;
u8 aagc_step_a: 2;
u8 aagc_step_b: 2;
u8 aagc_step_c: 2;
u8 aagc_step_d: 2;
#else
u8 trsw_a: 1;
u8 rsvd_2: 1;
u8 gain_a: 6;
u8 trsw_b: 1;
u8 rsvd_3: 1;
u8 gain_b: 6;
u8 trsw_c: 1;
u8 rsvd_4: 1;
u8 gain_c: 6;
u8 trsw_d: 1;
u8 rsvd_5: 1;
u8 gain_d: 6;
u8 aagc_step_d: 2;
u8 aagc_step_c: 2;
u8 aagc_step_b: 2;
u8 aagc_step_a: 2;
#endif
u8 ht_aagc_gain[4];
u8 dagc_gain[4];
#ifdef __LITTLE_ENDIAN
u8 counter: 6;
u8 rsvd_6: 2;
u8 syn_count: 5;
u8 rsvd_7:3;
#else
u8 rsvd_6: 2;
u8 counter: 6;
u8 rsvd_7:3;
u8 syn_count: 5;
#endif
} __packed;
/*
* Regs to backup
*/
......@@ -963,6 +1223,29 @@ struct rtl8188eu_efuse {
u8 res12[0xc3];
} __packed;
struct rtl8710bu_efuse {
__le16 rtl_id;
u8 res0[0x1e];
struct rtl8188fu_efuse_tx_power tx_power_index_A; /* 0x20 */
u8 res1[0x9c]; /* 0x2c */
u8 channel_plan; /* 0xc8 */
u8 xtal_k; /* 0xc9 */
u8 thermal_meter; /* 0xca */
u8 res2[0x4f];
u8 mac_addr[ETH_ALEN]; /* 0x11a */
u8 res3[0x11];
u8 rf_board_option; /* 0x131 */
u8 res4[2];
u8 eeprom_version; /* 0x134 */
u8 eeprom_customer_id; /* 0x135 */
u8 res5[5];
u8 country_code; /* 0x13b */
u8 res6[0x84];
u8 vid[2]; /* 0x1c0 */
u8 pid[2]; /* 0x1c2 */
u8 res7[0x3c];
} __packed;
struct rtl8xxxu_reg8val {
u16 reg;
u8 val;
......@@ -1486,6 +1769,7 @@ struct rtl8xxxu_priv {
struct rtl8723au_idx ht20_tx_power_diff[RTL8723B_TX_COUNT];
struct rtl8723au_idx ht40_tx_power_diff[RTL8723B_TX_COUNT];
struct rtl8xxxu_power_base *power_base;
u8 package_type;
u32 chip_cut:4;
u32 rom_rev:4;
u32 is_multi_func:1;
......@@ -1505,6 +1789,7 @@ struct rtl8xxxu_priv {
u32 ep_tx_low_queue:1;
u32 rx_buf_aggregation:1;
u32 cck_agc_report_type:1;
u32 cck_new_agc:1;
u8 default_crystal_cap;
unsigned int pipe_interrupt;
unsigned int pipe_in;
......@@ -1522,6 +1807,8 @@ struct rtl8xxxu_priv {
int nr_out_eps;
struct mutex h2c_mutex;
/* Protect the indirect register accesses of RTL8710BU. */
struct mutex syson_indirect_access_mutex;
struct usb_anchor rx_anchor;
struct usb_anchor tx_anchor;
......@@ -1542,6 +1829,7 @@ struct rtl8xxxu_priv {
struct rtl8192eu_efuse efuse8192eu;
struct rtl8188fu_efuse efuse8188fu;
struct rtl8188eu_efuse efuse8188eu;
struct rtl8710bu_efuse efuse8710bu;
} efuse_wifi;
u32 adda_backup[RTL8XXXU_ADDA_REGS];
u32 mac_backup[RTL8XXXU_MAC_REGS];
......@@ -1586,6 +1874,7 @@ struct rtl8xxxu_tx_urb {
struct rtl8xxxu_fileops {
int (*identify_chip) (struct rtl8xxxu_priv *priv);
int (*read_efuse) (struct rtl8xxxu_priv *priv);
int (*parse_efuse) (struct rtl8xxxu_priv *priv);
int (*load_firmware) (struct rtl8xxxu_priv *priv);
int (*power_on) (struct rtl8xxxu_priv *priv);
......@@ -1599,6 +1888,11 @@ struct rtl8xxxu_fileops {
void (*phy_iq_calibrate) (struct rtl8xxxu_priv *priv);
void (*config_channel) (struct ieee80211_hw *hw);
int (*parse_rx_desc) (struct rtl8xxxu_priv *priv, struct sk_buff *skb);
void (*parse_phystats) (struct rtl8xxxu_priv *priv,
struct ieee80211_rx_status *rx_status,
struct rtl8723au_phy_stats *phy_stats,
u32 rxmcs, struct ieee80211_hdr *hdr,
bool crc_icv_err);
void (*init_aggregation) (struct rtl8xxxu_priv *priv);
void (*init_statistics) (struct rtl8xxxu_priv *priv);
void (*init_burst) (struct rtl8xxxu_priv *priv);
......@@ -1618,7 +1912,7 @@ struct rtl8xxxu_fileops {
bool short_preamble, bool ampdu_enable,
u32 rts_rate);
void (*set_crystal_cap) (struct rtl8xxxu_priv *priv, u8 crystal_cap);
s8 (*cck_rssi) (struct rtl8xxxu_priv *priv, u8 cck_agc_rpt);
s8 (*cck_rssi) (struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats);
int (*led_classdev_brightness_set) (struct led_classdev *led_cdev,
enum led_brightness brightness);
int writeN_block_size;
......@@ -1687,10 +1981,12 @@ void rtl8xxxu_identify_vendor_2bits(struct rtl8xxxu_priv *priv, u32 vendor);
void rtl8xxxu_config_endpoints_sie(struct rtl8xxxu_priv *priv);
int rtl8xxxu_config_endpoints_no_sie(struct rtl8xxxu_priv *priv);
int rtl8xxxu_read_efuse8(struct rtl8xxxu_priv *priv, u16 offset, u8 *data);
int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv);
void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv);
int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv);
void rtl8xxxu_gen2_prepare_calibrate(struct rtl8xxxu_priv *priv, u8 start);
void rtl8723a_phy_lc_calibrate(struct rtl8xxxu_priv *priv);
void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv);
int rtl8xxxu_flush_fifo(struct rtl8xxxu_priv *priv);
int rtl8xxxu_gen2_h2c_cmd(struct rtl8xxxu_priv *priv,
struct h2c_cmd *h2c, int len);
......@@ -1724,6 +2020,16 @@ void rtl8xxxu_gen2_disable_rf(struct rtl8xxxu_priv *priv);
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);
void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv,
struct ieee80211_rx_status *rx_status,
struct rtl8723au_phy_stats *phy_stats,
u32 rxmcs, struct ieee80211_hdr *hdr,
bool crc_icv_err);
void jaguar2_rx_parse_phystats(struct rtl8xxxu_priv *priv,
struct ieee80211_rx_status *rx_status,
struct rtl8723au_phy_stats *phy_stats,
u32 rxmcs, struct ieee80211_hdr *hdr,
bool crc_icv_err);
int rtl8xxxu_gen2_channel_to_group(int channel);
bool rtl8xxxu_simularity_compare(struct rtl8xxxu_priv *priv,
int result[][8], int c1, int c2);
......@@ -1749,12 +2055,13 @@ void rtl8723bu_set_ps_tdma(struct rtl8xxxu_priv *priv,
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);
s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats);
void rtl8xxxu_update_ra_report(struct rtl8xxxu_ra_report *rarpt,
u8 rate, u8 sgi, u8 bw);
void rtl8188e_ra_info_init_all(struct rtl8xxxu_ra_info *ra);
void rtl8188e_handle_ra_tx_report2(struct rtl8xxxu_priv *priv, struct sk_buff *skb);
extern struct rtl8xxxu_fileops rtl8710bu_fops;
extern struct rtl8xxxu_fileops rtl8188fu_fops;
extern struct rtl8xxxu_fileops rtl8188eu_fops;
extern struct rtl8xxxu_fileops rtl8192cu_fops;
......
......@@ -1326,13 +1326,14 @@ static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv)
rtl8xxxu_write8(priv, REG_EARLY_MODE_CONTROL_8188E + 3, 0x01);
}
static s8 rtl8188e_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
static s8 rtl8188e_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats)
{
/* only use lna 0/1/2/3/7 */
static const s8 lna_gain_table_0[8] = {17, -1, -13, -29, -32, -35, -38, -41};
/* only use lna 3/7 */
static const s8 lna_gain_table_1[8] = {29, 20, 12, 3, -6, -15, -24, -33};
u8 cck_agc_rpt = phy_stats->cck_agc_rpt_ofdm_cfosho_a;
s8 rx_pwr_all = 0x00;
u8 vga_idx, lna_idx;
s8 lna_gain = 0;
......@@ -1856,6 +1857,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = {
.load_firmware = rtl8188eu_load_firmware,
.power_on = rtl8188eu_power_on,
.power_off = rtl8188eu_power_off,
.read_efuse = rtl8xxxu_read_efuse,
.reset_8051 = rtl8188eu_reset_8051,
.llt_init = rtl8xxxu_init_llt_table,
.init_phy_bb = rtl8188eu_init_phy_bb,
......@@ -1864,6 +1866,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = {
.phy_iq_calibrate = rtl8188eu_phy_iq_calibrate,
.config_channel = rtl8188eu_config_channel,
.parse_rx_desc = rtl8xxxu_parse_rxdesc16,
.parse_phystats = rtl8723au_rx_parse_phystats,
.init_aggregation = rtl8188eu_init_aggregation,
.enable_rf = rtl8188e_enable_rf,
.disable_rf = rtl8188e_disable_rf,
......
......@@ -791,7 +791,7 @@ static int rtl8188fu_init_phy_rf(struct rtl8xxxu_priv *priv)
return ret;
}
static void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
{
u32 val32;
u32 rf_amode, lstf;
......@@ -1677,8 +1677,9 @@ void rtl8188f_set_crystal_cap(struct rtl8xxxu_priv *priv, u8 crystal_cap)
cfo->crystal_cap = crystal_cap;
}
static s8 rtl8188f_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
static s8 rtl8188f_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats)
{
u8 cck_agc_rpt = phy_stats->cck_agc_rpt_ofdm_cfosho_a;
s8 rx_pwr_all = 0x00;
u8 vga_idx, lna_idx;
......@@ -1714,6 +1715,7 @@ struct rtl8xxxu_fileops rtl8188fu_fops = {
.load_firmware = rtl8188fu_load_firmware,
.power_on = rtl8188fu_power_on,
.power_off = rtl8188fu_power_off,
.read_efuse = rtl8xxxu_read_efuse,
.reset_8051 = rtl8xxxu_reset_8051,
.llt_init = rtl8xxxu_auto_llt_table,
.init_phy_bb = rtl8188fu_init_phy_bb,
......@@ -1723,6 +1725,7 @@ struct rtl8xxxu_fileops rtl8188fu_fops = {
.phy_iq_calibrate = rtl8188fu_phy_iq_calibrate,
.config_channel = rtl8188fu_config_channel,
.parse_rx_desc = rtl8xxxu_parse_rxdesc24,
.parse_phystats = rtl8723au_rx_parse_phystats,
.init_aggregation = rtl8188fu_init_aggregation,
.init_statistics = rtl8188fu_init_statistics,
.init_burst = rtl8xxxu_init_burst,
......
......@@ -594,6 +594,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = {
.load_firmware = rtl8192cu_load_firmware,
.power_on = rtl8192cu_power_on,
.power_off = rtl8xxxu_power_off,
.read_efuse = rtl8xxxu_read_efuse,
.reset_8051 = rtl8xxxu_reset_8051,
.llt_init = rtl8xxxu_init_llt_table,
.init_phy_bb = rtl8xxxu_gen1_init_phy_bb,
......@@ -602,6 +603,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = {
.phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate,
.config_channel = rtl8xxxu_gen1_config_channel,
.parse_rx_desc = rtl8xxxu_parse_rxdesc16,
.parse_phystats = rtl8723au_rx_parse_phystats,
.init_aggregation = rtl8xxxu_gen1_init_aggregation,
.enable_rf = rtl8xxxu_gen1_enable_rf,
.disable_rf = rtl8xxxu_gen1_disable_rf,
......
......@@ -1742,11 +1742,12 @@ static void rtl8192e_enable_rf(struct rtl8xxxu_priv *priv)
rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00);
}
static s8 rtl8192e_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
static s8 rtl8192e_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats)
{
static const s8 lna_gain_table_0[8] = {15, 9, -10, -21, -23, -27, -43, -44};
static const s8 lna_gain_table_1[8] = {24, 18, 13, -4, -11, -18, -31, -36};
u8 cck_agc_rpt = phy_stats->cck_agc_rpt_ofdm_cfosho_a;
s8 rx_pwr_all = 0x00;
u8 vga_idx, lna_idx;
s8 lna_gain = 0;
......@@ -1793,6 +1794,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = {
.load_firmware = rtl8192eu_load_firmware,
.power_on = rtl8192eu_power_on,
.power_off = rtl8192eu_power_off,
.read_efuse = rtl8xxxu_read_efuse,
.reset_8051 = rtl8xxxu_reset_8051,
.llt_init = rtl8xxxu_auto_llt_table,
.init_phy_bb = rtl8192eu_init_phy_bb,
......@@ -1801,6 +1803,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = {
.phy_iq_calibrate = rtl8192eu_phy_iq_calibrate,
.config_channel = rtl8xxxu_gen2_config_channel,
.parse_rx_desc = rtl8xxxu_parse_rxdesc24,
.parse_phystats = rtl8723au_rx_parse_phystats,
.enable_rf = rtl8192e_enable_rf,
.disable_rf = rtl8xxxu_gen2_disable_rf,
.usb_quirks = rtl8xxxu_gen2_usb_quirks,
......
此差异已折叠。
......@@ -435,8 +435,9 @@ void rtl8723a_set_crystal_cap(struct rtl8xxxu_priv *priv, u8 crystal_cap)
cfo->crystal_cap = crystal_cap;
}
s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
s8 rtl8723a_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats)
{
u8 cck_agc_rpt = phy_stats->cck_agc_rpt_ofdm_cfosho_a;
s8 rx_pwr_all = 0x00;
switch (cck_agc_rpt & 0xc0) {
......@@ -487,6 +488,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = {
.load_firmware = rtl8723au_load_firmware,
.power_on = rtl8723au_power_on,
.power_off = rtl8xxxu_power_off,
.read_efuse = rtl8xxxu_read_efuse,
.reset_8051 = rtl8xxxu_reset_8051,
.llt_init = rtl8xxxu_init_llt_table,
.init_phy_bb = rtl8xxxu_gen1_init_phy_bb,
......@@ -495,6 +497,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = {
.phy_iq_calibrate = rtl8xxxu_gen1_phy_iq_calibrate,
.config_channel = rtl8xxxu_gen1_config_channel,
.parse_rx_desc = rtl8xxxu_parse_rxdesc16,
.parse_phystats = rtl8723au_rx_parse_phystats,
.init_aggregation = rtl8xxxu_gen1_init_aggregation,
.enable_rf = rtl8xxxu_gen1_enable_rf,
.disable_rf = rtl8xxxu_gen1_disable_rf,
......
......@@ -1675,8 +1675,9 @@ static void rtl8723bu_init_statistics(struct rtl8xxxu_priv *priv)
rtl8xxxu_write32(priv, REG_OFDM0_FA_RSTC, val32);
}
static s8 rtl8723b_cck_rssi(struct rtl8xxxu_priv *priv, u8 cck_agc_rpt)
static s8 rtl8723b_cck_rssi(struct rtl8xxxu_priv *priv, struct rtl8723au_phy_stats *phy_stats)
{
u8 cck_agc_rpt = phy_stats->cck_agc_rpt_ofdm_cfosho_a;
s8 rx_pwr_all = 0x00;
u8 vga_idx, lna_idx;
......@@ -1709,6 +1710,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = {
.load_firmware = rtl8723bu_load_firmware,
.power_on = rtl8723bu_power_on,
.power_off = rtl8723bu_power_off,
.read_efuse = rtl8xxxu_read_efuse,
.reset_8051 = rtl8723bu_reset_8051,
.llt_init = rtl8xxxu_auto_llt_table,
.init_phy_bb = rtl8723bu_init_phy_bb,
......@@ -1718,6 +1720,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = {
.phy_iq_calibrate = rtl8723bu_phy_iq_calibrate,
.config_channel = rtl8xxxu_gen2_config_channel,
.parse_rx_desc = rtl8xxxu_parse_rxdesc24,
.parse_phystats = rtl8723au_rx_parse_phystats,
.init_aggregation = rtl8723bu_init_aggregation,
.init_statistics = rtl8723bu_init_statistics,
.init_burst = rtl8xxxu_init_burst,
......
......@@ -490,6 +490,8 @@
#define RXDMA_PRO_DMA_BURST_CNT GENMASK(3, 2) /* Set to 0x3. */
#define RXDMA_PRO_DMA_BURST_SIZE GENMASK(5, 4) /* Set to 0x1. */
#define REG_EARLY_MODE_CONTROL_8710B 0x02bc
#define REG_RF_BB_CMD_ADDR 0x02c0
#define REG_RF_BB_CMD_DATA 0x02c4
......@@ -845,6 +847,7 @@
#define REG_BT_CONTROL_8723BU 0x0764
#define BT_CONTROL_BT_GRANT BIT(12)
#define REG_PORT_CONTROL_8710B 0x076d
#define REG_WLAN_ACT_CONTROL_8723B 0x076e
#define REG_FPGA0_RF_MODE 0x0800
......@@ -1004,8 +1007,12 @@
#define CCK_PD_TYPE1_LV3_TH 0xdd
#define CCK_PD_TYPE1_LV4_TH 0xed
#define REG_CCK0_TX_FILTER1 0x0a20
#define REG_CCK0_TX_FILTER2 0x0a24
#define REG_CCK0_DEBUG_PORT 0x0a28 /* debug port and Tx filter3 */
#define REG_AGC_RPT 0xa80
#define AGC_RPT_CCK BIT(7)
#define REG_CCK0_TX_FILTER3 0x0aac
#define REG_CONFIG_ANT_A 0x0b68
#define REG_CONFIG_ANT_B 0x0b6c
......@@ -1179,6 +1186,8 @@
Unavailable */
#define USB_HIMR_ROK BIT(0) /* Receive DMA OK Interrupt */
#define REG_USB_ACCESS_TIMEOUT 0xfe4c
#define REG_USB_SPECIAL_OPTION 0xfe55
#define USB_SPEC_USB_AGG_ENABLE BIT(3) /* Enable USB aggregation */
#define USB_SPEC_INT_BULK_SELECT BIT(4) /* Use interrupt endpoint to
......@@ -1204,6 +1213,41 @@
#define REG_NORMAL_SIE_MAC_ADDR 0xfe70 /* 0xfe70 - 0xfe75 */
#define REG_NORMAL_SIE_STRING 0xfe80 /* 0xfe80 - 0xfedf */
/*
* 8710B register addresses between 0x00 and 0xff must have 0x8000
* added to them. We take care of that in the rtl8xxxu_read{8,16,32}
* and rtl8xxxu_write{8,16,32} functions.
*/
#define REG_SYS_FUNC_8710B 0x0004
#define REG_AFE_CTRL_8710B 0x0050
#define REG_WL_RF_PSS_8710B 0x005c
#define REG_EFUSE_INDIRECT_CTRL_8710B 0x006c
#define NORMAL_REG_READ_OFFSET 0x83000000
#define NORMAL_REG_WRITE_OFFSET 0x84000000
#define EFUSE_READ_OFFSET 0x85000000
#define EFUSE_WRITE_OFFSET 0x86000000
#define REG_HIMR0_8710B 0x0080
#define REG_HISR0_8710B 0x0084
/*
* 8710B uses this instead of REG_MCU_FW_DL, but at least bits
* 0-7 have the same meaning.
*/
#define REG_8051FW_CTRL_V1_8710B 0x0090
#define REG_USB_HOST_INDIRECT_DATA_8710B 0x009c
#define REG_WL_STATUS_8710B 0x00f0
#define REG_USB_HOST_INDIRECT_ADDR_8710B 0x00f8
/*
* 8710B registers which must be accessed through rtl8710b_read_syson_reg
* and rtl8710b_write_syson_reg.
*/
#define SYSON_REG_BASE_ADDR_8710B 0x40000000
#define REG_SYS_XTAL_CTRL0_8710B 0x060
#define REG_SYS_EEPROM_CTRL0_8710B 0x0e0
#define REG_SYS_SYSTEM_CFG0_8710B 0x1f0
#define REG_SYS_SYSTEM_CFG1_8710B 0x1f4
#define REG_SYS_SYSTEM_CFG2_8710B 0x1f8
/* RF6052 registers */
#define RF6052_REG_AC 0x00
#define RF6052_REG_IQADJ_G1 0x01
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册