2019-12-20 09:22:58

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 00/11] rtw88: some driver fixes

From: Yan-Hsuan Chuang <[email protected]>

This set includes some driver fixes

Chien-Hsun Liao (1):
rtw88: 8822c: modify rf protection setting

Chin-Yen Lee (1):
rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()

Ping-Ke Shih (3):
rtw88: fix rate mask for 1SS chip
rtw88: fix TX secondary channel offset of 40M if current bw is 20M or
40M
rtw88: Use secondary channel offset enumeration

Tzu-En Huang (2):
rtw88: 8822c: update power sequence to v15
rtw88: remove unused spinlock

Yan-Hsuan Chuang (3):
rtw88: remove unused variable 'in_lps'
rtw88: remove unused vif pointer in struct rtw_vif
rtw88: assign NULL to skb after being kfree()'ed

Zong-Zhe Yang (1):
rtw88: change max_num_of_tx_queue() definition to inline in pci.h

drivers/net/wireless/realtek/rtw88/fw.c | 5 +++-
drivers/net/wireless/realtek/rtw88/mac.c | 10 ++++---
drivers/net/wireless/realtek/rtw88/mac80211.c | 2 --
drivers/net/wireless/realtek/rtw88/main.c | 29 +++++++++----------
drivers/net/wireless/realtek/rtw88/main.h | 15 ++++++----
drivers/net/wireless/realtek/rtw88/pci.h | 2 +-
drivers/net/wireless/realtek/rtw88/phy.c | 10 -------
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 23 ++++++++++++---
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 5 ++++
10 files changed, 59 insertions(+), 44 deletions(-)

--
2.17.1


2019-12-20 09:22:58

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 01/11] rtw88: fix rate mask for 1SS chip

From: Ping-Ke Shih <[email protected]>

The rate mask is used to tell firmware the supported rate depends on
negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
only keep the part according to chip's NSS.

This commit fixes the logic error of '&' operations for VHT/HT rate, and
we should run this logic before adding legacy rate.

To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
NL80211_BAND_xxx is incorrect, so fix it as well.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/main.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index ae61415e1665..f369ddca953a 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -706,8 +706,8 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
is_support_sgi = true;
} else if (sta->ht_cap.ht_supported) {
- ra_mask |= (sta->ht_cap.mcs.rx_mask[NL80211_BAND_5GHZ] << 20) |
- (sta->ht_cap.mcs.rx_mask[NL80211_BAND_2GHZ] << 12);
+ ra_mask |= (sta->ht_cap.mcs.rx_mask[1] << 20) |
+ (sta->ht_cap.mcs.rx_mask[0] << 12);
if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
stbc_en = HT_STBC_EN;
if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)
@@ -717,6 +717,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
is_support_sgi = true;
}

+ if (efuse->hw_cap.nss == 1)
+ ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
+
if (hal->current_band_type == RTW_BAND_5G) {
ra_mask |= (u64)sta->supp_rates[NL80211_BAND_5GHZ] << 4;
if (sta->vht_cap.vht_supported) {
@@ -750,11 +753,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
wireless_set = 0;
}

- if (efuse->hw_cap.nss == 1) {
- ra_mask &= RA_MASK_VHT_RATES_1SS;
- ra_mask &= RA_MASK_HT_RATES_1SS;
- }
-
switch (sta->bandwidth) {
case IEEE80211_STA_RX_BW_80:
bw_mode = RTW_CHANNEL_WIDTH_80;
--
2.17.1

2019-12-20 09:22:58

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 03/11] rtw88: Use secondary channel offset enumeration

From: Ping-Ke Shih <[email protected]>

The hardware value of secondary channel offset isn't very intuitive. This
commit adds enumeration, so we can easier to check the logic with the
suffix of enumeration name, likes _UPPER or _LOWER.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/mac.c | 6 +++---
drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++-------
drivers/net/wireless/realtek/rtw88/main.h | 10 ++++++++++
drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index ed9bb427ba60..94d1b179e2e1 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -17,10 +17,10 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,

txsc20 = primary_ch_idx;
if (bw == RTW_CHANNEL_WIDTH_80) {
- if (txsc20 == 1 || txsc20 == 3)
- txsc40 = 9;
+ if (txsc20 == RTW_SC_20_UPPER || txsc20 == RTW_SC_20_UPPERST)
+ txsc40 = RTW_SC_40_UPPER;
else
- txsc40 = 10;
+ txsc40 = RTW_SC_40_LOWER;
}
rtw_write8(rtwdev, REG_DATA_SC,
BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index f369ddca953a..cc61c390226c 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -317,15 +317,15 @@ void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
case NL80211_CHAN_WIDTH_20_NOHT:
case NL80211_CHAN_WIDTH_20:
bandwidth = RTW_CHANNEL_WIDTH_20;
- primary_chan_idx = 0;
+ primary_chan_idx = RTW_SC_DONT_CARE;
break;
case NL80211_CHAN_WIDTH_40:
bandwidth = RTW_CHANNEL_WIDTH_40;
if (primary_freq > center_freq) {
- primary_chan_idx = 1;
+ primary_chan_idx = RTW_SC_20_UPPER;
center_chan -= 2;
} else {
- primary_chan_idx = 2;
+ primary_chan_idx = RTW_SC_20_LOWER;
center_chan += 2;
}
break;
@@ -333,10 +333,10 @@ void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
bandwidth = RTW_CHANNEL_WIDTH_80;
if (primary_freq > center_freq) {
if (primary_freq - center_freq == 10) {
- primary_chan_idx = 1;
+ primary_chan_idx = RTW_SC_20_UPPER;
center_chan -= 2;
} else {
- primary_chan_idx = 3;
+ primary_chan_idx = RTW_SC_20_UPPERST;
center_chan -= 6;
}
/* assign the center channel used
@@ -345,10 +345,10 @@ void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_chan + 4;
} else {
if (center_freq - primary_freq == 10) {
- primary_chan_idx = 2;
+ primary_chan_idx = RTW_SC_20_LOWER;
center_chan += 2;
} else {
- primary_chan_idx = 4;
+ primary_chan_idx = RTW_SC_20_LOWEST;
center_chan += 6;
}
/* assign the center channel used
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index d012eefcd0da..144fbab38fd5 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -95,6 +95,16 @@ enum rtw_bandwidth {
RTW_CHANNEL_WIDTH_10 = 6,
};

+enum rtw_sc_offset {
+ RTW_SC_DONT_CARE = 0,
+ RTW_SC_20_UPPER = 1,
+ RTW_SC_20_LOWER = 2,
+ RTW_SC_20_UPPERST = 3,
+ RTW_SC_20_LOWEST = 4,
+ RTW_SC_40_UPPER = 9,
+ RTW_SC_40_LOWER = 10,
+};
+
enum rtw_net_type {
RTW_NET_NO_LINK = 0,
RTW_NET_AD_HOC = 1,
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822b.c b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
index 4bc14b1a6340..2eed777ee692 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
@@ -645,7 +645,7 @@ static void rtw8822b_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,
rtw_write32_mask(rtwdev, REG_ADC160, BIT(30), 0x1);
break;
case RTW_CHANNEL_WIDTH_40:
- if (primary_ch_idx == 1)
+ if (primary_ch_idx == RTW_SC_20_UPPER)
rtw_write32_set(rtwdev, REG_RXSB, BIT(4));
else
rtw_write32_clr(rtwdev, REG_RXSB, BIT(4));
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 174029836833..57faef21ea52 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -1482,7 +1482,7 @@ static void rtw8822c_set_channel_bb(struct rtw_dev *rtwdev, u8 channel, u8 bw,
break;
case RTW_CHANNEL_WIDTH_40:
rtw_write32_mask(rtwdev, REG_CCKSB, BIT(4),
- (primary_ch_idx == 1 ? 1 : 0));
+ (primary_ch_idx == RTW_SC_20_UPPER ? 1 : 0));
rtw_write32_mask(rtwdev, REG_TXBWCTL, 0xf, 0x5);
rtw_write32_mask(rtwdev, REG_TXBWCTL, 0xc0, 0x0);
rtw_write32_mask(rtwdev, REG_TXBWCTL, 0xff00,
--
2.17.1

2019-12-20 09:23:14

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 06/11] rtw88: remove unused spinlock

From: Tzu-En Huang <[email protected]>

dm_lock is never used. Thus, remove this redundant spinlock.

Signed-off-by: Tzu-En Huang <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/main.c | 1 -
drivers/net/wireless/realtek/rtw88/main.h | 3 ---
2 files changed, 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index cc61c390226c..d6c9cc1806f7 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -1339,7 +1339,6 @@ int rtw_core_init(struct rtw_dev *rtwdev)
skb_queue_head_init(&rtwdev->coex.queue);
skb_queue_head_init(&rtwdev->tx_report.queue);

- spin_lock_init(&rtwdev->dm_lock);
spin_lock_init(&rtwdev->rf_lock);
spin_lock_init(&rtwdev->h2c.lock);
spin_lock_init(&rtwdev->txq_lock);
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 144fbab38fd5..b2cc7479d49b 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -1544,9 +1544,6 @@ struct rtw_dev {
/* ensures exclusive access from mac80211 callbacks */
struct mutex mutex;

- /* lock for dm to use */
- spinlock_t dm_lock;
-
/* read/write rf register */
spinlock_t rf_lock;

--
2.17.1

2019-12-20 09:23:18

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 02/11] rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M

From: Ping-Ke Shih <[email protected]>

TX secondary channel offset is valid only if current bandwidth is 80M,
otherwise leave this value as zero. The wrong value of txsc40 causes
MAC unpredictable behavior.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/mac.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index 507970387b2a..ed9bb427ba60 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -16,10 +16,12 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
u8 value8;

txsc20 = primary_ch_idx;
- if (txsc20 == 1 || txsc20 == 3)
- txsc40 = 9;
- else
- txsc40 = 10;
+ if (bw == RTW_CHANNEL_WIDTH_80) {
+ if (txsc20 == 1 || txsc20 == 3)
+ txsc40 = 9;
+ else
+ txsc40 = 10;
+ }
rtw_write8(rtwdev, REG_DATA_SC,
BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));

--
2.17.1

2019-12-20 09:23:30

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 10/11] rtw88: assign NULL to skb after being kfree()'ed

From: Yan-Hsuan Chuang <[email protected]>

Should assign NULL to skb after kfree(), in case of driver
trying to free the same skb again.

This could happen if driver failed to allocate an skb when
building reserved page.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/fw.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c
index b8c581161f61..92cefb79e09b 100644
--- a/drivers/net/wireless/realtek/rtw88/fw.c
+++ b/drivers/net/wireless/realtek/rtw88/fw.c
@@ -857,13 +857,16 @@ static u8 *rtw_build_rsvd_page(struct rtw_dev *rtwdev,
page += rtw_len_to_page(rsvd_pkt->skb->len, page_size);

kfree_skb(rsvd_pkt->skb);
+ rsvd_pkt->skb = NULL;
}

return buf;

release_skb:
- list_for_each_entry(rsvd_pkt, &rtwdev->rsvd_page_list, list)
+ list_for_each_entry(rsvd_pkt, &rtwdev->rsvd_page_list, list) {
kfree_skb(rsvd_pkt->skb);
+ rsvd_pkt->skb = NULL;
+ }

return NULL;
}
--
2.17.1

2019-12-20 09:23:35

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 09/11] rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()

From: Chin-Yen Lee <[email protected]>

Fix typo, should use rtw_hci_stop()

Signed-off-by: Chin-Yen Lee <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index d6c9cc1806f7..bbdd6aaaf89e 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -879,7 +879,7 @@ int rtw_core_start(struct rtw_dev *rtwdev)

static void rtw_power_off(struct rtw_dev *rtwdev)
{
- rtwdev->hci.ops->stop(rtwdev);
+ rtw_hci_stop(rtwdev);
rtw_mac_power_off(rtwdev);
}

--
2.17.1

2019-12-20 09:23:55

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 05/11] rtw88: 8822c: modify rf protection setting

From: Chien-Hsun Liao <[email protected]>

According to some experiments, the original rf protection
setting can not perfectly make sure that there is no hardware
pi write during the direct write. So, modify the setting so
that the hardware block of pi would be turned off during the
direct write.

Signed-off-by: Chien-Hsun Liao <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/phy.c | 10 ----------
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 15 +++++++++++++++
drivers/net/wireless/realtek/rtw88/rtw8822c.h | 5 +++++
3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index a3e1e9578b65..4b2f11be60cf 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -749,20 +749,10 @@ bool rtw_phy_write_rf_reg(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
direct_addr = base_addr[rf_path] + (addr << 2);
mask &= RFREG_MASK;

- if (addr == RF_CFGCH) {
- rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, DISABLE_PI);
- rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, DISABLE_PI);
- }
-
rtw_write32_mask(rtwdev, direct_addr, mask, data);

udelay(1);

- if (addr == RF_CFGCH) {
- rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, ENABLE_PI);
- rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, ENABLE_PI);
- }
-
return true;
}

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 7c8db951a5bc..4231f94d515e 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -1289,6 +1289,17 @@ static int rtw8822c_mac_init(struct rtw_dev *rtwdev)
return 0;
}

+static void rtw8822c_rstb_3wire(struct rtw_dev *rtwdev, bool enable)
+{
+ if (enable) {
+ rtw_write32_mask(rtwdev, REG_RSTB, BIT_RSTB_3WIRE, 0x1);
+ rtw_write32_mask(rtwdev, REG_ANAPAR_A, BIT_ANAPAR_UPDATE, 0x1);
+ rtw_write32_mask(rtwdev, REG_ANAPAR_B, BIT_ANAPAR_UPDATE, 0x1);
+ } else {
+ rtw_write32_mask(rtwdev, REG_RSTB, BIT_RSTB_3WIRE, 0x0);
+ }
+}
+
static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
{
#define RF18_BAND_MASK (BIT(16) | BIT(9) | BIT(8))
@@ -1337,6 +1348,8 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
break;
}

+ rtw8822c_rstb_3wire(rtwdev, false);
+
rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE2, 0x04, 0x01);
rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWA, 0x1f, 0x12);
rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWD0, 0xfffff, rf_rxbb);
@@ -1349,6 +1362,8 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)

rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, rf_reg18);
rtw_write_rf(rtwdev, RF_PATH_B, RF_CFGCH, RFREG_MASK, rf_reg18);
+
+ rtw8822c_rstb_3wire(rtwdev, true);
}

static void rtw8822c_toggle_igi(struct rtw_dev *rtwdev)
diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
index abd9f300bedd..dfd8662a0c0e 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h
@@ -190,6 +190,8 @@ const struct rtw_table name ## _tbl = { \
#define BIT_3WIRE_TX_EN BIT(0)
#define BIT_3WIRE_RX_EN BIT(1)
#define BIT_3WIRE_PI_ON BIT(28)
+#define REG_ANAPAR_A 0x1830
+#define BIT_ANAPAR_UPDATE BIT(29)
#define REG_RXAGCCTL0 0x18ac
#define BITS_RXAGC_CCK GENMASK(15, 12)
#define BITS_RXAGC_OFDM GENMASK(8, 4)
@@ -223,6 +225,8 @@ const struct rtw_table name ## _tbl = { \
#define BIT_CCK_BLK_EN BIT(1)
#define BIT_CCK_OFDM_BLK_EN (BIT(0) | BIT(1))
#define REG_CCAMSK 0x1c80
+#define REG_RSTB 0x1c90
+#define BIT_RSTB_3WIRE BIT(8)
#define REG_RX_BREAK 0x1d2c
#define BIT_COM_RX_GCK_EN BIT(31)
#define REG_RXFNCTL 0x1d30
@@ -243,6 +247,7 @@ const struct rtw_table name ## _tbl = { \
#define REG_OFDM_TXCNT 0x2de0
#define REG_ORITXCODE2 0x4100
#define REG_3WIRE2 0x410c
+#define REG_ANAPAR_B 0x4130
#define REG_RXAGCCTL 0x41ac
#define REG_DCKB_I_0 0x41bc
#define REG_DCKB_I_1 0x41c0
--
2.17.1

2019-12-20 09:24:33

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 11/11] rtw88: change max_num_of_tx_queue() definition to inline in pci.h

From: Zong-Zhe Yang <[email protected]>

It's more reasonable to define max_num_of_tx_queue() as an inline function.

Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/pci.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.h b/drivers/net/wireless/realtek/rtw88/pci.h
index 49bf29a92152..1580cfc57361 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.h
+++ b/drivers/net/wireless/realtek/rtw88/pci.h
@@ -210,7 +210,7 @@ struct rtw_pci {
void __iomem *mmap;
};

-static u32 max_num_of_tx_queue(u8 queue)
+static inline u32 max_num_of_tx_queue(u8 queue)
{
u32 max_num;

--
2.17.1

2019-12-20 09:24:33

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 07/11] rtw88: remove unused variable 'in_lps'

From: Yan-Hsuan Chuang <[email protected]>

Unused, will not be used neither, because the hardware/firmware
can only support one vif for LPS currnetly. If there's more than
one vif, than driver will never enter LPS. So remove it.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/mac80211.c | 1 -
drivers/net/wireless/realtek/rtw88/main.h | 1 -
2 files changed, 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index 34a1c3b53cd4..ddde3b855893 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -157,7 +157,6 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
rtwvif->stats.rx_unicast = 0;
rtwvif->stats.tx_cnt = 0;
rtwvif->stats.rx_cnt = 0;
- rtwvif->in_lps = false;
memset(&rtwvif->bfee, 0, sizeof(struct rtw_bfee));
rtwvif->conf = &rtw_vif_port[port];
rtw_txq_init(rtwdev, vif->txq);
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index b2cc7479d49b..a80fa38fb404 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -737,7 +737,6 @@ struct rtw_vif {
const struct rtw_vif_port *conf;

struct rtw_traffic_stats stats;
- bool in_lps;

struct rtw_bfee bfee;
};
--
2.17.1

2019-12-20 09:24:34

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 08/11] rtw88: remove unused vif pointer in struct rtw_vif

From: Yan-Hsuan Chuang <[email protected]>

As driver can easily get vif with container_of(), we can
just remove it.

Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/mac80211.c | 1 -
drivers/net/wireless/realtek/rtw88/main.h | 1 -
2 files changed, 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index ddde3b855893..76f85640ff0d 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -152,7 +152,6 @@ static int rtw_ops_add_interface(struct ieee80211_hw *hw,
u8 bcn_ctrl = 0;

rtwvif->port = port;
- rtwvif->vif = vif;
rtwvif->stats.tx_unicast = 0;
rtwvif->stats.rx_unicast = 0;
rtwvif->stats.tx_cnt = 0;
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index a80fa38fb404..760192442198 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -726,7 +726,6 @@ struct rtw_bf_info {
};

struct rtw_vif {
- struct ieee80211_vif *vif;
enum rtw_net_type net_type;
u16 aid;
u8 mac_addr[ETH_ALEN];
--
2.17.1

2019-12-20 09:24:34

by Tony Chuang

[permalink] [raw]
Subject: [PATCH 04/11] rtw88: 8822c: update power sequence to v15

From: Tzu-En Huang <[email protected]>

Update card enable power sequence flow, to fix CMD11 fail after
reboot and wrong PLL clock.

Signed-off-by: Tzu-En Huang <[email protected]>
Signed-off-by: Yan-Hsuan Chuang <[email protected]>
---
drivers/net/wireless/realtek/rtw88/rtw8822c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 57faef21ea52..7c8db951a5bc 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -3487,12 +3487,12 @@ static struct rtw_pwr_seq_cmd trans_cardemu_to_act_8822c[] = {
RTW_PWR_CUT_ALL_MSK,
RTW_PWR_INTF_ALL_MSK,
RTW_PWR_ADDR_MAC,
- RTW_PWR_CMD_WRITE, BIT(7), 0},
- {0x0005,
+ RTW_PWR_CMD_WRITE, (BIT(4) | BIT(3)), 0},
+ {0x1018,
RTW_PWR_CUT_ALL_MSK,
RTW_PWR_INTF_ALL_MSK,
RTW_PWR_ADDR_MAC,
- RTW_PWR_CMD_WRITE, (BIT(4) | BIT(3)), 0},
+ RTW_PWR_CMD_WRITE, BIT(2), BIT(2)},
{0x0005,
RTW_PWR_CUT_ALL_MSK,
RTW_PWR_INTF_ALL_MSK,
--
2.17.1

2019-12-24 07:09:07

by Chris Chiu

[permalink] [raw]
Subject: Re: [PATCH 01/11] rtw88: fix rate mask for 1SS chip

On Fri, Dec 20, 2019 at 5:22 PM <[email protected]> wrote:
>
> From: Ping-Ke Shih <[email protected]>
>
> The rate mask is used to tell firmware the supported rate depends on
> negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
> only keep the part according to chip's NSS.
>
> This commit fixes the logic error of '&' operations for VHT/HT rate, and
> we should run this logic before adding legacy rate.
>
> To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
> NL80211_BAND_xxx is incorrect, so fix it as well.
>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> ---
Reviewed-by: Chris Chiu <[email protected]>

> drivers/net/wireless/realtek/rtw88/main.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index ae61415e1665..f369ddca953a 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -706,8 +706,8 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
> if (sta->vht_cap.cap & IEEE80211_VHT_CAP_SHORT_GI_80)
> is_support_sgi = true;
> } else if (sta->ht_cap.ht_supported) {
> - ra_mask |= (sta->ht_cap.mcs.rx_mask[NL80211_BAND_5GHZ] << 20) |
> - (sta->ht_cap.mcs.rx_mask[NL80211_BAND_2GHZ] << 12);
> + ra_mask |= (sta->ht_cap.mcs.rx_mask[1] << 20) |
> + (sta->ht_cap.mcs.rx_mask[0] << 12);
> if (sta->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)
> stbc_en = HT_STBC_EN;
> if (sta->ht_cap.cap & IEEE80211_HT_CAP_LDPC_CODING)
> @@ -717,6 +717,9 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
> is_support_sgi = true;
> }
>
> + if (efuse->hw_cap.nss == 1)
> + ra_mask &= RA_MASK_VHT_RATES_1SS | RA_MASK_HT_RATES_1SS;
> +
> if (hal->current_band_type == RTW_BAND_5G) {
> ra_mask |= (u64)sta->supp_rates[NL80211_BAND_5GHZ] << 4;
> if (sta->vht_cap.vht_supported) {
> @@ -750,11 +753,6 @@ void rtw_update_sta_info(struct rtw_dev *rtwdev, struct rtw_sta_info *si)
> wireless_set = 0;
> }
>
> - if (efuse->hw_cap.nss == 1) {
> - ra_mask &= RA_MASK_VHT_RATES_1SS;
> - ra_mask &= RA_MASK_HT_RATES_1SS;
> - }
> -
> switch (sta->bandwidth) {
> case IEEE80211_STA_RX_BW_80:
> bw_mode = RTW_CHANNEL_WIDTH_80;
> --
> 2.17.1
>

2019-12-24 07:18:30

by Chris Chiu

[permalink] [raw]
Subject: Re: [PATCH 03/11] rtw88: Use secondary channel offset enumeration

On Fri, Dec 20, 2019 at 5:22 PM <[email protected]> wrote:
>
> From: Ping-Ke Shih <[email protected]>
>
> The hardware value of secondary channel offset isn't very intuitive. This
> commit adds enumeration, so we can easier to check the logic with the
> suffix of enumeration name, likes _UPPER or _LOWER.
>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw88/mac.c | 6 +++---
> drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++-------
> drivers/net/wireless/realtek/rtw88/main.h | 10 ++++++++++
> drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
> drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
> 5 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
> index ed9bb427ba60..94d1b179e2e1 100644
> --- a/drivers/net/wireless/realtek/rtw88/mac.c
> +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> @@ -17,10 +17,10 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev, u8 channel, u8 bw,
>
> txsc20 = primary_ch_idx;
> if (bw == RTW_CHANNEL_WIDTH_80) {
> - if (txsc20 == 1 || txsc20 == 3)
> - txsc40 = 9;
> + if (txsc20 == RTW_SC_20_UPPER || txsc20 == RTW_SC_20_UPPERST)
> + txsc40 = RTW_SC_40_UPPER;
> else
> - txsc40 = 10;
> + txsc40 = RTW_SC_40_LOWER;
> }
> rtw_write8(rtwdev, REG_DATA_SC,
> BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));
> diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
> index f369ddca953a..cc61c390226c 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.c
> +++ b/drivers/net/wireless/realtek/rtw88/main.c
> @@ -333,10 +333,10 @@ void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
> bandwidth = RTW_CHANNEL_WIDTH_80;
> if (primary_freq > center_freq) {
> if (primary_freq - center_freq == 10) {
> - primary_chan_idx = 1;
> + primary_chan_idx = RTW_SC_20_UPPER;
> center_chan -= 2;
> } else {
> - primary_chan_idx = 3;
> + primary_chan_idx = RTW_SC_20_UPPERST;
> center_chan -= 6;
> }
> /* assign the center channel used
> @@ -345,10 +345,10 @@ void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
> cch_by_bw[RTW_CHANNEL_WIDTH_40] = center_chan + 4;
> } else {
> if (center_freq - primary_freq == 10) {
> - primary_chan_idx = 2;
> + primary_chan_idx = RTW_SC_20_LOWER;
> center_chan += 2;
> } else {
> - primary_chan_idx = 4;
> + primary_chan_idx = RTW_SC_20_LOWEST;
> center_chan += 6;
> }
> /* assign the center channel used
> diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
> index d012eefcd0da..144fbab38fd5 100644
> --- a/drivers/net/wireless/realtek/rtw88/main.h
> +++ b/drivers/net/wireless/realtek/rtw88/main.h
> @@ -95,6 +95,16 @@ enum rtw_bandwidth {
> RTW_CHANNEL_WIDTH_10 = 6,
> };
>
> +enum rtw_sc_offset {
> + RTW_SC_DONT_CARE = 0,
> + RTW_SC_20_UPPER = 1,
> + RTW_SC_20_LOWER = 2,
> + RTW_SC_20_UPPERST = 3,

I'll suppgest RTW_SC_20_UPMOST instead or simply RTW_SC_20_UPPEREST.

> + RTW_SC_20_LOWEST = 4,
> + RTW_SC_40_UPPER = 9,
> + RTW_SC_40_LOWER = 10,
> +};
> +
> enum rtw_net_type {
> RTW_NET_NO_LINK = 0,
> RTW_NET_AD_HOC = 1,
> --
> 2.17.1
>

2019-12-24 07:38:31

by Chris Chiu

[permalink] [raw]
Subject: Re: [PATCH 05/11] rtw88: 8822c: modify rf protection setting

On Fri, Dec 20, 2019 at 5:22 PM <[email protected]> wrote:
>
> From: Chien-Hsun Liao <[email protected]>
>
> According to some experiments, the original rf protection
> setting can not perfectly make sure that there is no hardware
> pi write during the direct write. So, modify the setting so
> that the hardware block of pi would be turned off during the
> direct write.
>

Sorry, I don't really understand this part. Does it mean rtw8822c_rstb_3wire()
is to disable/enable the hardware block of PI? In this patch, I can only
see the code block of ENABLE_PI/DISABLE_PI been removed and some
rtw_write_rf()s been protected by new rtw8822c_rstb_3wire(). If the new
function is to replace the ENABLE_PI/DISABLE_PI, maybe they should be
removed in the reg.h. And It seems rtw8822c_rstb_3wire() is only for 8822c,
means there's no such problem for 8822b?

Chris

> Signed-off-by: Chien-Hsun Liao <[email protected]>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw88/phy.c | 10 ----------
> drivers/net/wireless/realtek/rtw88/rtw8822c.c | 15 +++++++++++++++
> drivers/net/wireless/realtek/rtw88/rtw8822c.h | 5 +++++
> 3 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
> index a3e1e9578b65..4b2f11be60cf 100644
> --- a/drivers/net/wireless/realtek/rtw88/phy.c
> +++ b/drivers/net/wireless/realtek/rtw88/phy.c
> @@ -749,20 +749,10 @@ bool rtw_phy_write_rf_reg(struct rtw_dev *rtwdev, enum rtw_rf_path rf_path,
> direct_addr = base_addr[rf_path] + (addr << 2);
> mask &= RFREG_MASK;
>
> - if (addr == RF_CFGCH) {
> - rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, DISABLE_PI);
> - rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, DISABLE_PI);
> - }
> -
> rtw_write32_mask(rtwdev, direct_addr, mask, data);
>
> udelay(1);
>
> - if (addr == RF_CFGCH) {
> - rtw_write32_mask(rtwdev, REG_RSV_CTRL, BITS_RFC_DIRECT, ENABLE_PI);
> - rtw_write32_mask(rtwdev, REG_WLRF1, BITS_RFC_DIRECT, ENABLE_PI);
> - }
> -
> return true;
> }
>
> diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> index 7c8db951a5bc..4231f94d515e 100644
> --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
> @@ -1289,6 +1289,17 @@ static int rtw8822c_mac_init(struct rtw_dev *rtwdev)
> return 0;
> }
>
> +static void rtw8822c_rstb_3wire(struct rtw_dev *rtwdev, bool enable)
> +{
> + if (enable) {
> + rtw_write32_mask(rtwdev, REG_RSTB, BIT_RSTB_3WIRE, 0x1);
> + rtw_write32_mask(rtwdev, REG_ANAPAR_A, BIT_ANAPAR_UPDATE, 0x1);
> + rtw_write32_mask(rtwdev, REG_ANAPAR_B, BIT_ANAPAR_UPDATE, 0x1);
> + } else {
> + rtw_write32_mask(rtwdev, REG_RSTB, BIT_RSTB_3WIRE, 0x0);
> + }
> +}
> +
> static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
> {
> #define RF18_BAND_MASK (BIT(16) | BIT(9) | BIT(8))
> @@ -1337,6 +1348,8 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
> break;
> }
>
> + rtw8822c_rstb_3wire(rtwdev, false);
> +
> rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWE2, 0x04, 0x01);
> rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWA, 0x1f, 0x12);
> rtw_write_rf(rtwdev, RF_PATH_A, RF_LUTWD0, 0xfffff, rf_rxbb);
> @@ -1349,6 +1362,8 @@ static void rtw8822c_set_channel_rf(struct rtw_dev *rtwdev, u8 channel, u8 bw)
>
> rtw_write_rf(rtwdev, RF_PATH_A, RF_CFGCH, RFREG_MASK, rf_reg18);
> rtw_write_rf(rtwdev, RF_PATH_B, RF_CFGCH, RFREG_MASK, rf_reg18);
> +
> + rtw8822c_rstb_3wire(rtwdev, true);
> }
>
> static void rtw8822c_toggle_igi(struct rtw_dev *rtwdev)
> --
> 2.17.1
>

2019-12-24 07:45:14

by Tony Chuang

[permalink] [raw]
Subject: RE: [PATCH 03/11] rtw88: Use secondary channel offset enumeration

> On Fri, Dec 20, 2019 at 5:22 PM <[email protected]> wrote:
> >
> > From: Ping-Ke Shih <[email protected]>
> >
> > The hardware value of secondary channel offset isn't very intuitive. This
> > commit adds enumeration, so we can easier to check the logic with the
> > suffix of enumeration name, likes _UPPER or _LOWER.
> >
> > Signed-off-by: Ping-Ke Shih <[email protected]>
> > Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> > ---
> > drivers/net/wireless/realtek/rtw88/mac.c | 6 +++---
> > drivers/net/wireless/realtek/rtw88/main.c | 14 +++++++-------
> > drivers/net/wireless/realtek/rtw88/main.h | 10 ++++++++++
> > drivers/net/wireless/realtek/rtw88/rtw8822b.c | 2 +-
> > drivers/net/wireless/realtek/rtw88/rtw8822c.c | 2 +-
> > 5 files changed, 22 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/net/wireless/realtek/rtw88/mac.c
> b/drivers/net/wireless/realtek/rtw88/mac.c
> > index ed9bb427ba60..94d1b179e2e1 100644
> > --- a/drivers/net/wireless/realtek/rtw88/mac.c
> > +++ b/drivers/net/wireless/realtek/rtw88/mac.c
> > @@ -17,10 +17,10 @@ void rtw_set_channel_mac(struct rtw_dev *rtwdev,
> u8 channel, u8 bw,
> >
> > txsc20 = primary_ch_idx;
> > if (bw == RTW_CHANNEL_WIDTH_80) {
> > - if (txsc20 == 1 || txsc20 == 3)
> > - txsc40 = 9;
> > + if (txsc20 == RTW_SC_20_UPPER || txsc20 ==
> RTW_SC_20_UPPERST)
> > + txsc40 = RTW_SC_40_UPPER;
> > else
> > - txsc40 = 10;
> > + txsc40 = RTW_SC_40_LOWER;
> > }
> > rtw_write8(rtwdev, REG_DATA_SC,
> > BIT_TXSC_20M(txsc20) | BIT_TXSC_40M(txsc40));
> > diff --git a/drivers/net/wireless/realtek/rtw88/main.c
> b/drivers/net/wireless/realtek/rtw88/main.c
> > index f369ddca953a..cc61c390226c 100644
> > --- a/drivers/net/wireless/realtek/rtw88/main.c
> > +++ b/drivers/net/wireless/realtek/rtw88/main.c
> > @@ -333,10 +333,10 @@ void rtw_get_channel_params(struct
> cfg80211_chan_def *chandef,
> > bandwidth = RTW_CHANNEL_WIDTH_80;
> > if (primary_freq > center_freq) {
> > if (primary_freq - center_freq == 10) {
> > - primary_chan_idx = 1;
> > + primary_chan_idx =
> RTW_SC_20_UPPER;
> > center_chan -= 2;
> > } else {
> > - primary_chan_idx = 3;
> > + primary_chan_idx =
> RTW_SC_20_UPPERST;
> > center_chan -= 6;
> > }
> > /* assign the center channel used
> > @@ -345,10 +345,10 @@ void rtw_get_channel_params(struct
> cfg80211_chan_def *chandef,
> > cch_by_bw[RTW_CHANNEL_WIDTH_40] =
> center_chan + 4;
> > } else {
> > if (center_freq - primary_freq == 10) {
> > - primary_chan_idx = 2;
> > + primary_chan_idx =
> RTW_SC_20_LOWER;
> > center_chan += 2;
> > } else {
> > - primary_chan_idx = 4;
> > + primary_chan_idx =
> RTW_SC_20_LOWEST;
> > center_chan += 6;
> > }
> > /* assign the center channel used
> > diff --git a/drivers/net/wireless/realtek/rtw88/main.h
> b/drivers/net/wireless/realtek/rtw88/main.h
> > index d012eefcd0da..144fbab38fd5 100644
> > --- a/drivers/net/wireless/realtek/rtw88/main.h
> > +++ b/drivers/net/wireless/realtek/rtw88/main.h
> > @@ -95,6 +95,16 @@ enum rtw_bandwidth {
> > RTW_CHANNEL_WIDTH_10 = 6,
> > };
> >
> > +enum rtw_sc_offset {
> > + RTW_SC_DONT_CARE = 0,
> > + RTW_SC_20_UPPER = 1,
> > + RTW_SC_20_LOWER = 2,
> > + RTW_SC_20_UPPERST = 3,
>
> I'll suppgest RTW_SC_20_UPMOST instead or simply RTW_SC_20_UPPEREST.
>

OK, that makes sense :)

Yan-Hsuan

2019-12-24 07:50:34

by Tony Chuang

[permalink] [raw]
Subject: RE: [PATCH 05/11] rtw88: 8822c: modify rf protection setting

> On Fri, Dec 20, 2019 at 5:22 PM <[email protected]> wrote:
> >
> > From: Chien-Hsun Liao <[email protected]>
> >
> > According to some experiments, the original rf protection
> > setting can not perfectly make sure that there is no hardware
> > pi write during the direct write. So, modify the setting so
> > that the hardware block of pi would be turned off during the
> > direct write.
> >
>
> Sorry, I don't really understand this part. Does it mean rtw8822c_rstb_3wire()
> is to disable/enable the hardware block of PI? In this patch, I can only
> see the code block of ENABLE_PI/DISABLE_PI been removed and some
> rtw_write_rf()s been protected by new rtw8822c_rstb_3wire(). If the new
> function is to replace the ENABLE_PI/DISABLE_PI, maybe they should be
> removed in the reg.h. And It seems rtw8822c_rstb_3wire() is only for 8822c,
> means there's no such problem for 8822b?
>

Yes, rtw8822c_rstb_3wire() is to disable/enable PI. Only 8822c uses mix mode.
That means, 8822c uses direct write for RF registers except for register 0x0.
And 8822b uses sipi write (indirect). So 8822b doesn't have such problem.

Yan-Hsuan

2019-12-24 08:17:18

by Chris Chiu

[permalink] [raw]
Subject: Re: [PATCH 05/11] rtw88: 8822c: modify rf protection setting

On Tue, Dec 24, 2019 at 3:50 PM Tony Chuang <[email protected]> wrote:
>
> > On Fri, Dec 20, 2019 at 5:22 PM <[email protected]> wrote:
> > >
> > > From: Chien-Hsun Liao <[email protected]>
> > >
> > > According to some experiments, the original rf protection
> > > setting can not perfectly make sure that there is no hardware
> > > pi write during the direct write. So, modify the setting so
> > > that the hardware block of pi would be turned off during the
> > > direct write.
> > >
> >
> > Sorry, I don't really understand this part. Does it mean rtw8822c_rstb_3wire()
> > is to disable/enable the hardware block of PI? In this patch, I can only
> > see the code block of ENABLE_PI/DISABLE_PI been removed and some
> > rtw_write_rf()s been protected by new rtw8822c_rstb_3wire(). If the new
> > function is to replace the ENABLE_PI/DISABLE_PI, maybe they should be
> > removed in the reg.h. And It seems rtw8822c_rstb_3wire() is only for 8822c,
> > means there's no such problem for 8822b?
> >
>
> Yes, rtw8822c_rstb_3wire() is to disable/enable PI. Only 8822c uses mix mode.
> That means, 8822c uses direct write for RF registers except for register 0x0.
> And 8822b uses sipi write (indirect). So 8822b doesn't have such problem.
>
> Yan-Hsuan

Got it. Could you also explain this in the commit message so that we
won't misread
the code? Thanks.

Chris

2020-01-26 15:38:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 01/11] rtw88: fix rate mask for 1SS chip

<[email protected]> wrote:

> From: Ping-Ke Shih <[email protected]>
>
> The rate mask is used to tell firmware the supported rate depends on
> negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
> only keep the part according to chip's NSS.
>
> This commit fixes the logic error of '&' operations for VHT/HT rate, and
> we should run this logic before adding legacy rate.
>
> To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
> NL80211_BAND_xxx is incorrect, so fix it as well.
>
> Signed-off-by: Ping-Ke Shih <[email protected]>
> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
> Reviewed-by: Chris Chiu <[email protected]>

9 patches applied to wireless-drivers-next.git, thanks.

35a68fa5f96a rtw88: fix rate mask for 1SS chip
73a2d0b83424 rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M
e339b6493524 rtw88: 8822c: update power sequence to v15
3f43f10bd619 rtw88: remove unused spinlock
962562cde154 rtw88: remove unused variable 'in_lps'
65ae64d37575 rtw88: remove unused vif pointer in struct rtw_vif
fc83c616d4d9 rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()
f48abf064ade rtw88: assign NULL to skb after being kfree()'ed
bbdd1d854e0a rtw88: change max_num_of_tx_queue() definition to inline in pci.h

--
https://patchwork.kernel.org/patch/11305077/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2020-01-26 15:40:05

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 01/11] rtw88: fix rate mask for 1SS chip

Kalle Valo <[email protected]> writes:

> <[email protected]> wrote:
>
>> From: Ping-Ke Shih <[email protected]>
>>
>> The rate mask is used to tell firmware the supported rate depends on
>> negotiation. We loop 2 times for all VHT/HT 2SS rate mask first, and then
>> only keep the part according to chip's NSS.
>>
>> This commit fixes the logic error of '&' operations for VHT/HT rate, and
>> we should run this logic before adding legacy rate.
>>
>> To access HT MCS map, index 0/1 represent MCS 0-7/8-15 respectively. Use
>> NL80211_BAND_xxx is incorrect, so fix it as well.
>>
>> Signed-off-by: Ping-Ke Shih <[email protected]>
>> Signed-off-by: Yan-Hsuan Chuang <[email protected]>
>> Reviewed-by: Chris Chiu <[email protected]>
>
> 9 patches applied to wireless-drivers-next.git, thanks.
>
> 35a68fa5f96a rtw88: fix rate mask for 1SS chip
> 73a2d0b83424 rtw88: fix TX secondary channel offset of 40M if current bw is 20M or 40M
> e339b6493524 rtw88: 8822c: update power sequence to v15
> 3f43f10bd619 rtw88: remove unused spinlock
> 962562cde154 rtw88: remove unused variable 'in_lps'
> 65ae64d37575 rtw88: remove unused vif pointer in struct rtw_vif
> fc83c616d4d9 rtw88: use rtw_hci_stop() instead of rtwdev->hci.ops->stop()
> f48abf064ade rtw88: assign NULL to skb after being kfree()'ed
> bbdd1d854e0a rtw88: change max_num_of_tx_queue() definition to inline in pci.h

I dropped patches 3 and 5 as they had comments.

--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches