[][MAC80211][mt76][remove BW160 and BW80+80 support]

[Description]
Remove BW160 and BW80+80 capability in mt7915.

[Release-log]
N/A

Change-Id: I6ea6152c83d4f0d1bcf651cb79161d62c9c48b62
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7080360
diff --git a/autobuild_mac80211_release/package/kernel/mt76/patches/0008-wifi-mt76-mt7915-remove-BW160-and-BW80-80-support.patch b/autobuild_mac80211_release/package/kernel/mt76/patches/0008-wifi-mt76-mt7915-remove-BW160-and-BW80-80-support.patch
new file mode 100644
index 0000000..af2ed13
--- /dev/null
+++ b/autobuild_mac80211_release/package/kernel/mt76/patches/0008-wifi-mt76-mt7915-remove-BW160-and-BW80-80-support.patch
@@ -0,0 +1,116 @@
+From 98aa346042bd21fe8c0b1594736edca16be436db Mon Sep 17 00:00:00 2001
+From: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
+Date: Wed, 4 Jan 2023 17:03:52 +0800
+Subject: [PATCH] wifi: mt76: mt7915: remove BW160 and BW80+80 support
+
+Remove BW160 and BW80+80 capability in mt7915.
+
+Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
+Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
+Signed-off-by: Money Wang<Money.Wang@mediatek.com>
+Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+ mt7915/init.c | 38 +++++++++-----------------------------
+ 1 file changed, 9 insertions(+), 29 deletions(-)
+
+diff --git a/mt7915/init.c b/mt7915/init.c
+index b23a2fb8..ec297e04 100644
+--- a/mt7915/init.c
++++ b/mt7915/init.c
+@@ -38,8 +38,7 @@ static const struct ieee80211_iface_combination if_comb[] = {
+ 				       BIT(NL80211_CHAN_WIDTH_20) |
+ 				       BIT(NL80211_CHAN_WIDTH_40) |
+ 				       BIT(NL80211_CHAN_WIDTH_80) |
+-				       BIT(NL80211_CHAN_WIDTH_160) |
+-				       BIT(NL80211_CHAN_WIDTH_80P80),
++				       BIT(NL80211_CHAN_WIDTH_160),
+ 	}
+ };
+ 
+@@ -410,11 +409,6 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
+ 			phy->mt76->sband_5g.sband.vht_cap.cap |=
+ 				IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
+ 				IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
+-
+-			if (!dev->dbdc_support)
+-				phy->mt76->sband_5g.sband.vht_cap.cap |=
+-					IEEE80211_VHT_CAP_SHORT_GI_160 |
+-					IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
+ 		} else {
+ 			phy->mt76->sband_5g.sband.vht_cap.cap |=
+ 				IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
+@@ -850,13 +844,9 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
+ 	int sts = hweight8(phy->mt76->chainmask);
+ 	u8 c, sts_160 = sts;
+ 
+-	/* Can do 1/2 of STS in 160Mhz mode for mt7915 */
+-	if (is_mt7915(&dev->mt76)) {
+-		if (!dev->dbdc_support)
+-			sts_160 /= 2;
+-		else
+-			sts_160 = 0;
+-	}
++	/* mt7915 doesn't support bw160 */
++	if (is_mt7915(&dev->mt76))
++		sts_160 = 0;
+ 
+ #ifdef CONFIG_MAC80211_MESH
+ 	if (vif == NL80211_IFTYPE_MESH_POINT)
+@@ -910,9 +900,6 @@ mt7915_set_stream_he_txbf_caps(struct mt7915_phy *phy,
+ 	elem->phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER;
+ 	elem->phy_cap_info[4] |= IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER;
+ 
+-	/* num_snd_dim
+-	 * for mt7915, max supported sts is 2 for bw > 80MHz and 0 if dbdc
+-	 */
+ 	c = FIELD_PREP(IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK,
+ 		       sts - 1);
+ 	if (sts_160)
+@@ -960,15 +947,10 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
+ 	int i, idx = 0, nss = hweight8(phy->mt76->antenna_mask);
+ 	u16 mcs_map = 0;
+ 	u16 mcs_map_160 = 0;
+-	u8 nss_160;
++	u8 nss_160 = nss;
+ 
+-	if (!is_mt7915(&dev->mt76))
+-		nss_160 = nss;
+-	else if (!dev->dbdc_support)
+-		/* Can do 1/2 of NSS streams in 160Mhz mode for mt7915 */
+-		nss_160 = nss / 2;
+-	else
+-		/* Can't do 160MHz with mt7915 dbdc */
++	/* Can't do 160MHz with mt7915 */
++	if (is_mt7915(&dev->mt76))
+ 		nss_160 = 0;
+ 
+ 	for (i = 0; i < 8; i++) {
+@@ -1018,8 +1000,7 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
+ 		else if (nss_160)
+ 			he_cap_elem->phy_cap_info[0] =
+ 				IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
+-				IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G |
+-				IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G;
++				IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
+ 		else
+ 			he_cap_elem->phy_cap_info[0] =
+ 				IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
+@@ -1091,12 +1072,11 @@ mt7915_init_he_caps(struct mt7915_phy *phy, enum nl80211_band band,
+ 			break;
+ 		}
+ 
++		memset(he_mcs, 0, sizeof(*he_mcs));
+ 		he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map);
+ 		he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map);
+ 		he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map_160);
+ 		he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map_160);
+-		he_mcs->rx_mcs_80p80 = cpu_to_le16(mcs_map_160);
+-		he_mcs->tx_mcs_80p80 = cpu_to_le16(mcs_map_160);
+ 
+ 		mt7915_set_stream_he_txbf_caps(phy, he_cap, i);
+ 
+-- 
+2.39.0
+