[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]
[Description]
Refactor and sync kernel/wifi from Openwrt
[Release-log]
N/A
diff --git a/recipes-connectivity/linux-mt76/files/patches/0005-mt76-mt7915-fix-mt7915_mcu_set_chan_info.patch b/recipes-connectivity/linux-mt76/files/patches/0005-mt76-mt7915-fix-mt7915_mcu_set_chan_info.patch
new file mode 100644
index 0000000..9662e57
--- /dev/null
+++ b/recipes-connectivity/linux-mt76/files/patches/0005-mt76-mt7915-fix-mt7915_mcu_set_chan_info.patch
@@ -0,0 +1,94 @@
+From 508127725db04741df06adee31b2cadf53ef11f6 Mon Sep 17 00:00:00 2001
+From: Howard Hsu <howard-yh.hsu@mediatek.com>
+Date: Tue, 25 Oct 2022 14:22:52 +0800
+Subject: [PATCH] Fix parameter in channel switch mcu command. use Tx path
+ instead of Tx stream in mt7915_set_chan_info().
+
+Change-Id: Ia5e7da735dbe0c5f702352ad58ea69277096e54a
+---
+ mt7915/main.c | 8 ++++----
+ mt7915/mcu.c | 16 ++++++++--------
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/mt7915/main.c b/mt7915/main.c
+index 01d64b2f..aa18e557 100644
+--- a/mt7915/main.c
++++ b/mt7915/main.c
+@@ -1016,7 +1016,7 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+ struct mt7915_dev *dev = mt7915_hw_dev(hw);
+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
+ int max_nss = hweight8(hw->wiphy->available_antennas_tx);
+- bool ext_phy = phy != &dev->phy;
++ u8 chainshift = dev->chainshift;
+
+ if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
+ return -EINVAL;
+@@ -1026,10 +1026,10 @@ mt7915_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
+ phy->mt76->antenna_mask = tx_ant;
+
+ /* handle a variant of mt7916 which has 3T3R but nss2 on 5 GHz band */
+- if (is_mt7916(&dev->mt76) && ext_phy && hweight8(tx_ant) == max_nss)
+- phy->mt76->chainmask = dev->chainmask >> dev->chainshift;
++ if (is_mt7916(&dev->mt76) && phy->band_idx && hweight8(tx_ant) == max_nss)
++ phy->mt76->chainmask = (dev->chainmask >> chainshift) << chainshift;
+ else
+- phy->mt76->chainmask = tx_ant << (dev->chainshift * ext_phy);
++ phy->mt76->chainmask = tx_ant << (chainshift * phy->band_idx);
+
+ mt76_set_stream_caps(phy->mt76, true);
+ mt7915_set_stream_vht_txbf_caps(phy);
+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
+index 38a08b9a..b8f06957 100644
+--- a/mt7915/mcu.c
++++ b/mt7915/mcu.c
+@@ -2776,8 +2776,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+ u8 control_ch;
+ u8 center_ch;
+ u8 bw;
+- u8 tx_streams_num;
+- u8 rx_streams; /* mask or num */
++ u8 tx_path_num;
++ u8 rx_path; /* mask or num */
+ u8 switch_reason;
+ u8 band_idx;
+ u8 center_ch2; /* for 80+80 only */
+@@ -2793,8 +2793,8 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+ .control_ch = chandef->chan->hw_value,
+ .center_ch = ieee80211_frequency_to_channel(freq1),
+ .bw = mt76_connac_chan_bw(chandef),
+- .tx_streams_num = hweight8(phy->mt76->antenna_mask),
+- .rx_streams = phy->mt76->antenna_mask,
++ .tx_path_num = hweight16(phy->mt76->chainmask),
++ .rx_path = phy->mt76->chainmask >> (dev->chainshift * phy->band_idx),
+ .band_idx = phy->band_idx,
+ .channel_band = ch_band[chandef->chan->band],
+ };
+@@ -2802,13 +2802,13 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+ #ifdef CONFIG_NL80211_TESTMODE
+ if (phy->mt76->test.tx_antenna_mask &&
+ mt76_testmode_enabled(phy->mt76)) {
+- req.tx_streams_num = fls(phy->mt76->test.tx_antenna_mask);
+- req.rx_streams = phy->mt76->test.tx_antenna_mask;
++ req.tx_path_num = fls(phy->mt76->test.tx_antenna_mask);
++ req.rx_path = phy->mt76->test.tx_antenna_mask;
+ }
+ #endif
+
+ if (mt76_connac_spe_idx(phy->mt76->antenna_mask))
+- req.tx_streams_num = fls(phy->mt76->antenna_mask);
++ req.tx_path_num = fls(phy->mt76->antenna_mask);
+
+ if (cmd == MCU_EXT_CMD(SET_RX_PATH) ||
+ dev->mt76.hw->conf.flags & IEEE80211_CONF_MONITOR)
+@@ -2822,7 +2822,7 @@ int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
+ req.switch_reason = CH_SWITCH_NORMAL;
+
+ if (cmd == MCU_EXT_CMD(CHANNEL_SWITCH))
+- req.rx_streams = hweight8(req.rx_streams);
++ req.rx_path = hweight8(req.rx_path);
+
+ if (chandef->width == NL80211_CHAN_WIDTH_80P80) {
+ int freq2 = chandef->center_freq2;
+--
+2.18.0
+
diff --git a/recipes-connectivity/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch b/recipes-connectivity/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch
index d92030c..ec3a0a3 100644
--- a/recipes-connectivity/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch
+++ b/recipes-connectivity/linux-mt76/files/patches/3006-mt76-mt7915-add-statistic-for-H-W-Rx-Path.patch
@@ -5,15 +5,12 @@
Change-Id: Id94d663f08e91c83d296bd57e5e9b65a505ae1c7
---
- mt76.h | 4 ++++
- mt76_connac.h | 5 +++++
- mt76_connac_mcu.h | 35 +++++++++++++++++++++++++++++++++++
- mt7915/mac.c | 25 +++++++++++++++++++++++++
- mt7915/main.c | 9 ++++++++-
- mt7915/mcu.c | 21 +++++++++++++++++++++
- mt7915/mmio.c | 6 ++++++
- mt7915/mt7915.h | 3 +++
- 8 files changed, 107 insertions(+), 1 deletion(-)
+ mt76.h | 4 ++++
+ mt7915/mac.c | 25 +++++++++++++++++++++++++
+ mt7915/main.c | 9 ++++++++-
+ mt7915/mmio.c | 17 +++++++++++++++++
+ mt7915/mt7915.h | 2 ++
+ 5 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/mt76.h b/mt76.h
index 3530d213..47a92132 100644
@@ -30,68 +27,6 @@
};
enum mt76_wcid_flags {
-diff --git a/mt76_connac.h b/mt76_connac.h
-index 9a468878..7ecc7253 100644
---- a/mt76_connac.h
-+++ b/mt76_connac.h
-@@ -224,6 +224,11 @@ static inline bool is_mt76_fw_txp(struct mt76_dev *dev)
- }
- }
-
-+static inline bool is_wo_mcu(struct mt76_dev *dev)
-+{
-+ return is_mt7986(dev);
-+}
-+
- static inline u8 mt76_connac_chan_bw(struct cfg80211_chan_def *chandef)
- {
- static const u8 width_to_bw[] = {
-diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
-index 27a36241..475c3910 100644
---- a/mt76_connac_mcu.h
-+++ b/mt76_connac_mcu.h
-@@ -1211,6 +1211,41 @@ enum {
- MCU_CE_CMD_GET_TXPWR = 0xd0,
- };
-
-+enum wo_event_id {
-+ WO_EVT_LOG_DUMP = 0x1,
-+ WO_EVT_PROFILING = 0x2,
-+ WO_EVT_RXCNT_INFO = 0x3
-+};
-+
-+enum wo_cmd_id {
-+ WO_CMD_WED_CFG = 0,
-+ WO_CMD_WED_RX_STAT,
-+ WO_CMD_RRO_SER,
-+ WO_CMD_DBG_INFO,
-+ WO_CMD_DEV_INFO,
-+ WO_CMD_BSS_INFO,
-+ WO_CMD_STA_REC,
-+ WO_CMD_DEV_INFO_DUMP,
-+ WO_CMD_BSS_INFO_DUMP,
-+ WO_CMD_STA_REC_DUMP,
-+ WO_CMD_BA_INFO_DUMP,
-+ WO_CMD_FBCMD_Q_DUMP,
-+ WO_CMD_FW_LOG_CTRL,
-+ WO_CMD_LOG_FLUSH,
-+ WO_CMD_CHANGE_STATE,
-+ WO_CMD_CPU_STATS_ENABLE,
-+ WO_CMD_CPU_STATS_DUMP,
-+ WO_CMD_EXCEPTION_INIT,
-+ WO_CMD_PROF_CTRL,
-+ WO_CMD_STA_BA_DUMP,
-+ WO_CMD_BA_CTRL_DUMP,
-+ WO_CMD_RXCNT_CTRL,
-+ WO_CMD_RXCNT_INFO,
-+ WO_CMD_SET_CAP,
-+ WO_CMD_CCIF_RING_DUMP,
-+ WO_CMD_WED_END
-+};
-+
- enum {
- PATCH_SEM_RELEASE,
- PATCH_SEM_GET
diff --git a/mt7915/mac.c b/mt7915/mac.c
index e78f30fc..7fb161db 100644
--- a/mt7915/mac.c
@@ -155,38 +90,6 @@
}
}
-diff --git a/mt7915/mcu.c b/mt7915/mcu.c
-index 6603effd..87e02de7 100644
---- a/mt7915/mcu.c
-+++ b/mt7915/mcu.c
-@@ -293,6 +293,27 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)
- return mt76_mcu_send_msg(&dev->mt76, cmd, &req, sizeof(req), false);
- }
-
-+int mt7915_mcu_wo_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2)
-+{
-+ struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
-+ struct {
-+ __le32 args[2];
-+ } req = {
-+ .args = {
-+ cpu_to_le32(a1),
-+ cpu_to_le32(a2),
-+ },
-+ };
-+
-+ if (!mtk_wed_device_active(wed))
-+ return -1;
-+
-+ if (!is_wo_mcu(&dev->mt76))
-+ return -1;
-+
-+ return mtk_soc_wed_ops->msg_update(wed, cmd, (void *)&req, sizeof(req));
-+}
-+
- static void
- mt7915_mcu_csa_finish(void *priv, u8 *mac, struct ieee80211_vif *vif)
- {
diff --git a/mt7915/mmio.c b/mt7915/mmio.c
index 6a1877d4..cd8326b0 100644
--- a/mt7915/mmio.c
@@ -208,12 +111,23 @@
dev->mt76.rx_token_size = wed->wlan.rx_pkt;
if (mtk_wed_device_attach(wed))
return 0;
-@@ -630,6 +633,9 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -630,6 +633,20 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
if (ret)
return ret;
-+ if (is_wo_mcu(&dev->mt76))
-+ mt7915_mcu_wo_cmd(dev, WO_CMD_RXCNT_CTRL, 1, 6);
++ if (wed->ver != 1) {
++ struct {
++ __le32 args[2];
++ } req = {
++ .args = {
++ cpu_to_le32(1),
++ cpu_to_le32(6),
++ },
++ };
++
++ mtk_wed_device_update_msg(wed, WED_WO_RXCNT_CTRL,
++ (void *)&req, sizeof(req));
++ }
+
return 1;
#else
@@ -231,14 +145,6 @@
int mt7915_register_device(struct mt7915_dev *dev);
void mt7915_unregister_device(struct mt7915_dev *dev);
void mt7915_eeprom_rebonding(struct mt7915_dev *dev);
-@@ -633,6 +635,7 @@ int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
- struct cfg80211_chan_def *chandef);
- int mt7915_mcu_rf_regval(struct mt7915_dev *dev, u32 regidx, u32 *val, bool set);
- int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
-+int mt7915_mcu_wo_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2);
- int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
- int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
- void mt7915_mcu_rx_event(struct mt7915_dev *dev, struct sk_buff *skb);
--
2.25.1
diff --git a/recipes-connectivity/linux-mt76/files/patches/patches.inc b/recipes-connectivity/linux-mt76/files/patches/patches.inc
index cd457a5..bdcae31 100644
--- a/recipes-connectivity/linux-mt76/files/patches/patches.inc
+++ b/recipes-connectivity/linux-mt76/files/patches/patches.inc
@@ -4,6 +4,7 @@
file://0002-mt76-mt7915-rework-rx-testmode-stats.patch \
file://0003-mt76-mt7915-drop-undefined-action-frame.patch \
file://0004-mt76-connac-update-nss-calculation-in-txs.patch \
+ file://0005-mt76-mt7915-fix-mt7915_mcu_set_chan_info.patch \
file://100-Revert-of-net-pass-the-dst-buffer-to-of_get_mac_addr.patch \
file://100-aggregation-definitions.patch \
file://1001-mt76-mt7915-add-mtk-internal-debug-tools-for-mt76.patch \