Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp558061pxb; Mon, 16 Aug 2021 11:39:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzizladSGx06MQooaPq90jyLWWHi+qFoCsCzoeJjI6oTmZ6I8yFu8c37D0qd6yDfR2TEtgR X-Received: by 2002:a92:b711:: with SMTP id k17mr127089ili.247.1629139144385; Mon, 16 Aug 2021 11:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629139144; cv=none; d=google.com; s=arc-20160816; b=Xzg18tqlhuuDMZq44jEmiZRnp1GguITlpUD7n0VkUfBEOlaNDl4wrgx+JImAKRKFXo hbvHYvaLQI15QhB6QOiDeUVu+ark8r9aUwWs8DQ4JkHzfjsB6jnCQvsgmRRfrOCabRFx T1wm0eO5e7hBES6AEeIkLA3k1dDFSN84yAtqemCVvpNc1nHFqW3Kj3xtB861DZ2Pv/Lu rtOxl6CsLNrgl1eGSeLDP3tSgwXiSrRXwRYML4Oxxs4B2Jab4Ew+7AUA1pZ9RB8Cx4c/ NTvSp84a2UHGDZ4wtm7TsNc2DK1RiMzcudJHC65PLYO8VnfqmiRGrU8LuPvrzP63FOvm A8gg== 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=ZscMcLqg8ZuHlkxGsNJOSQ5TXXb/h9pRFJf1w2x3wQE=; b=NbpzZ/W9/dytOpuse9OHqX4t3YNfaStugPid3xE2xHRPsr2s9rHWyBBDvskwRTxJna uG6JYDjoQ+XsKI3xjhgPehcCtrh6mFdCc3ugKXacbSVR5+yRxh6w77lwEKIlMZwOBuu3 LQTOcx9AoGmwM8xlkpgCghnpTQTVTWUsZzP+aLtXF0DiQzsoJQe86JMwWQN//uCzH5bm jvHn0+DquvdCAiRlAJCqZm5Jz2/OPq2A6CNieTbHRJ3wR6Io9qv6/1DJ5Eazbd08WNhE el4Lf+Pki9f7I+MHNMhhwwB57Lpf+fN2vkYIB+w4/4pNikQhY60B1XuZE0ilZqylZPI2 wHqQ== 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 u13si105051jak.109.2021.08.16.11.38.40; Mon, 16 Aug 2021 11:39:04 -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 S232165AbhHPSiO (ORCPT + 99 others); Mon, 16 Aug 2021 14:38:14 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:34780 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S231652AbhHPSiO (ORCPT ); Mon, 16 Aug 2021 14:38:14 -0400 X-UUID: be3af381f02747728c769b3ded82cac0-20210817 X-UUID: be3af381f02747728c769b3ded82cac0-20210817 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 2106951730; Tue, 17 Aug 2021 02:37:38 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Aug 2021 02:37:37 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 17 Aug 2021 02:37:37 +0800 From: Ryder Lee To: Felix Fietkau CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , , Ryder Lee Subject: [PATCH v2 1/3] mt76: mt7915: update mac timing settings Date: Tue, 17 Aug 2021 02:37:33 +0800 Message-ID: <3f393508b9ed8251f4e2408356110af092c8ad3e.1629133569.git.ryder.lee@mediatek.com> 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 1. EIFS has been divided into OFDM/CCK fields after 11ax generation. 2. For 5G/6G SIFS setting, hardware counts extra 6us for OFDM. Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 14 ++++++-------- drivers/net/wireless/mediatek/mt76/mt7915/regs.h | 5 ++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 0ed86cbf722b..1b8e37e265cb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1575,17 +1575,12 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) FIELD_PREP(MT_TIMEOUT_VAL_CCA, 48); u32 ofdm = FIELD_PREP(MT_TIMEOUT_VAL_PLCP, 60) | FIELD_PREP(MT_TIMEOUT_VAL_CCA, 28); - int sifs, offset; + int offset; bool is_5ghz = phy->mt76->chandef.chan->band == NL80211_BAND_5GHZ; if (!test_bit(MT76_STATE_RUNNING, &phy->mt76->state)) return; - if (is_5ghz) - sifs = 16; - else - sifs = 10; - if (ext_phy) { coverage_class = max_t(s16, dev->phy.coverage_class, coverage_class); @@ -1607,11 +1602,14 @@ void mt7915_mac_set_timing(struct mt7915_phy *phy) mt76_wr(dev, MT_TMAC_CDTR(ext_phy), cck + reg_offset); mt76_wr(dev, MT_TMAC_ODTR(ext_phy), ofdm + reg_offset); mt76_wr(dev, MT_TMAC_ICR0(ext_phy), - FIELD_PREP(MT_IFS_EIFS, 360) | + FIELD_PREP(MT_IFS_EIFS_OFDM, is_5ghz ? 84 : 78) | FIELD_PREP(MT_IFS_RIFS, 2) | - FIELD_PREP(MT_IFS_SIFS, sifs) | + FIELD_PREP(MT_IFS_SIFS, 10) | FIELD_PREP(MT_IFS_SLOT, phy->slottime)); + mt76_wr(dev, MT_TMAC_ICR1(ext_phy), + FIELD_PREP(MT_IFS_EIFS_CCK, 314)); + if (phy->slottime < 20 || is_5ghz) val = MT7915_CFEND_RATE_DEFAULT; else diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/regs.h b/drivers/net/wireless/mediatek/mt76/mt7915/regs.h index a213b5cb82f8..91c1fb56b0ed 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/regs.h @@ -72,11 +72,14 @@ #define MT_TMAC_TRCR0_I2T_CHK GENMASK(24, 16) #define MT_TMAC_ICR0(_band) MT_WF_TMAC(_band, 0x0a4) -#define MT_IFS_EIFS GENMASK(8, 0) +#define MT_IFS_EIFS_OFDM GENMASK(8, 0) #define MT_IFS_RIFS GENMASK(14, 10) #define MT_IFS_SIFS GENMASK(22, 16) #define MT_IFS_SLOT GENMASK(30, 24) +#define MT_TMAC_ICR1(_band) MT_WF_TMAC(_band, 0x0b4) +#define MT_IFS_EIFS_CCK GENMASK(8, 0) + #define MT_TMAC_CTCR0(_band) MT_WF_TMAC(_band, 0x0f4) #define MT_TMAC_CTCR0_INS_DDLMT_REFTIME GENMASK(5, 0) #define MT_TMAC_CTCR0_INS_DDLMT_EN BIT(17) -- 2.29.2