Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4440200pxb; Sat, 6 Nov 2021 14:04:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZx1Euv9Pg1wUVmAw215qfcpjTry7Kg2ISF+tDFf6Ze8rszbq1/wqsNt4uZihUZBqj+LmW X-Received: by 2002:a05:6638:32aa:: with SMTP id f42mr13485701jav.115.1636232664150; Sat, 06 Nov 2021 14:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636232664; cv=none; d=google.com; s=arc-20160816; b=DZNg4n+wKkmmZ6QwjOLHnOxBa0t5OHBi7ke6Qjup2SX10Eit+4GgM3zWsiFBiBzl+O 5icYKycRNb/OBYHZscp5Bv1enFRGaw5RMieeXqX2YN8zOvdfrGDRzjs9f+Pu1hxnZmIS q5MZZ2HTXBvz/uSRp766mqYctoBy+LHz785qrrKcx5QlrjQtSyyb1/Fd+720+aHu3uO4 VOWcfUoafqfVwa+g6tXkzvcuDRfKqIt+Y7+rHda2eEAjnC3SzAPkU7aHHCtZUpli6BNK wIPwkU5R+SXQvLvziJ+Wr49AwV4DhRWZMpVxwVsSlxHxkRrEJwM35F1rM3Ml7KhTB9SQ bHOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=mC7XWDVULnVslpaHtOR6obuGP56eNhZbPh0jhaUJg5E=; b=luHMoKsqOA5HUjfKxTvVfGFkuHqUOqORnvs7pu/NPcBtLV+FHZO59GpQ0QFDkTOq8Z d6yJXmnPqm8ZZRoKgBYqcapcXE5gWQGIkBwCzLbHtLHKNYMCjEcnhpkJWpftJe63n+hz GI0A2rDoqHdw7A43YhxcwAwx73wOCdWqGNO6FZEWMXq2CviKf+huPyknKjxMuFUyOJCI w2M9v+Abc5o/52lel9hliDqCAXVqikFqYpRtJmtvCnyjRYqJRNYP9MWWA2SvOtk5Lqm6 /ZBrq9y16WLuLSeQhJw2qfx+X1KwsooWaSbQ1H4yGdTaGTLNHAQFNleDGJqoCtXP4lGn NhuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si25871275ils.92.2021.11.06.14.04.07; Sat, 06 Nov 2021 14:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234443AbhKFPO4 (ORCPT + 67 others); Sat, 6 Nov 2021 11:14:56 -0400 Received: from mailgw02.mediatek.com ([216.200.240.185]:60467 "EHLO mailgw02.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234441AbhKFPOz (ORCPT ); Sat, 6 Nov 2021 11:14:55 -0400 X-UUID: 65459a5846d546e9b778a9d8b62e4544-20211106 X-UUID: 65459a5846d546e9b778a9d8b62e4544-20211106 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1016553486; Sat, 06 Nov 2021 08:12:11 -0700 Received: from mtkmbs10n2.mediatek.inc (172.21.101.183) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 6 Nov 2021 08:06:32 -0700 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs10n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Sat, 6 Nov 2021 23:06:31 +0800 From: Deren Wu To: Felix Fietkau , Lorenzo Bianconi CC: Sean Wang , Soul Huang , YN Chen , Leon Yen , Eric-SY Chang , Deren Wu , KM Lin , Robin Chiu , CH Yeh , Posh Sun , Eric Liang , Stella Chang , Evelyn Tsai , Ryder Lee , Shayne Chen , linux-wireless , linux-mediatek , Deren Wu Subject: [PATCH] mt76: mt7921: introduce 160 MHz channel bandwidth support Date: Sat, 6 Nov 2021 22:35:43 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Deren Wu Introduce the basic configuration for chips with BW160 capability Signed-off-by: Deren Wu --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 1 + drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7921/main.c | 12 ++++++++++++ 4 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index e2da720a91b6..babca8086027 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -346,6 +346,7 @@ struct mt76_hw_cap { bool has_2ghz; bool has_5ghz; bool has_6ghz; + bool has_bw160; }; #define MT_DRV_TXWI_NO_FREE BIT(0) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 26b4b875dcc0..4da20537aaf9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1775,6 +1775,7 @@ static void mt76_connac_mcu_parse_phy_cap(struct mt76_dev *dev, dev->phy.chainmask = dev->phy.antenna_mask; dev->phy.cap.has_2ghz = cap->hw_path & BIT(WF0_24G); dev->phy.cap.has_5ghz = cap->hw_path & BIT(WF0_5G); + dev->phy.cap.has_bw160 = (cap->max_bw >= IEEE80211_STA_RX_BW_160); } int mt76_connac_mcu_get_nic_capability(struct mt76_phy *phy) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 210998f086ab..30c0246fba3a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -264,6 +264,10 @@ int mt7921_register_device(struct mt7921_dev *dev) IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | (3 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT); + if (dev->mt76.phy.cap.has_bw160) + dev->mphy.sband_5g.sband.vht_cap.cap |= + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ | + IEEE80211_VHT_CAP_SHORT_GI_160; dev->mphy.hw->wiphy->available_antennas_rx = dev->mphy.chainmask; dev->mphy.hw->wiphy->available_antennas_tx = dev->mphy.chainmask; diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 633c6d2a57ac..af8c675f909f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -128,11 +128,23 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band, IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU | IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB | IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB; + + if (phy->mt76->cap.has_bw160) { + he_cap_elem->phy_cap_info[0] |= + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G; + he_cap_elem->phy_cap_info[8] |= + IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU | + IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU; + } break; } he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map); he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map); + if (phy->mt76->cap.has_bw160) { + he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map); + he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map); + } memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); if (he_cap_elem->phy_cap_info[6] & -- 2.18.0