Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp947821pxb; Wed, 6 Apr 2022 05:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0Ywi3xhtkuq6PoEk7tLgiKest+5+YaWI9CdxTm5rXinJFj/R8kwwG+rNG79RfAsqnITPE X-Received: by 2002:a05:6e02:1a8f:b0:2c9:da3d:e970 with SMTP id k15-20020a056e021a8f00b002c9da3de970mr3939437ilv.239.1649246708417; Wed, 06 Apr 2022 05:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649246708; cv=none; d=google.com; s=arc-20160816; b=e1v0U2vR4iHp+KIix43VQLDPYQYaqAid+/CJnCU7iVOwbdF4xeDcqtDUdh0Je7K6I8 FKMeWdPWcezq4qdMts1mb4rw/kS9REdIV1BeN5kXihqFlwxC8m91lESrCLD0Mxqt5xe4 NNNAGaDDb3HTBgGYBpTjiYY9x6MHgnw400cCDL2IdPxZo/WfyapOFNtpFYywAZEv/6G6 YDSl75BkfpqTMVRSsChLig+Z3U8UIDLZRP0WsBrEuumx665TeqGuPXvs23O/EZzahvWf z9YA5djtkwX1G7r1NEG2eihLuLWYS7q2KiOJBMtsMauNKnytcTmUIZx5mIUg70SeUA+O AcXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w/DSVfD479HZtP2IfDuj/XFAEWCFTeY7Vktm1qsc/UY=; b=r4kd4JfhXYrnz7/pOvO16kVQXo0WCAq1/8ce6OkoB8ql+wG7bq/e88S7yCnZvefDdW A7pt3hD+l3JDkKlgngrCeK6klBw0ONrokgLIkkxw8Q2ZqCIz0SxVa1q/8uLNMEd2c1z2 P4/AE+QgpeOnSxejLHGM4PpyYd/SYgiwTf/hTEP3XkstgzNIbEdmDBRb2VhbdlsoHS9W ar+xeBbYFlhsYbejhn87gSGt9uvrguAAhXqCzB+wApsfe2UNQGzdv8dC7f9AwTT1BHa4 z+AzeZ8tRUIKsBsU5DNkHWF1RKKllDMkhVSDwIrKwsZBTmP/T2zJM8orUlZ5j3C/0mow ghog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pLtBKR3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q11-20020a0566022f0b00b0064958084543si9149315iow.96.2022.04.06.05.05.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:05:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pLtBKR3k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 331DA491BD3; Wed, 6 Apr 2022 03:32:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1840131AbiDFBHP (ORCPT + 99 others); Tue, 5 Apr 2022 21:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349263AbiDEJtb (ORCPT ); Tue, 5 Apr 2022 05:49:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E67F196; Tue, 5 Apr 2022 02:43:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E743DB81B7A; Tue, 5 Apr 2022 09:43:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A5CBC385A2; Tue, 5 Apr 2022 09:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151803; bh=ilqLsuz/Ma+wTb22AXwt8jOnSVqdW4vrad/y6wPbT/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLtBKR3kcFL+YD7d/rHm/LcSfzeGbkSUdnRJt6/mL4OfL8fZsFHkqQ9Jwf46D6j6A G9wbdWPwbABlQ7TYxPG7AkCgnt/e3A1koi3zdiaIhdYpkCaUSp2+DKkoiM68QcXi1a ymnPj7OWYr5tv5aOY767FdrPcDkIYVHDAp1X7HZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 548/913] mt76: mt7921: fix mt7921_queues_acq implementation Date: Tue, 5 Apr 2022 09:26:50 +0200 Message-Id: <20220405070356.274488132@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit 849ee6ac9dd3efd0a57cbc98b9a9d6ae87374aff ] Fix mt7921_queues_acq implementation according to the vendor sdk. Fixes: 474a9f21e2e20 ("mt76: mt7921: add debugfs support") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 13 ++++++------- drivers/net/wireless/mediatek/mt76/mt7921/regs.h | 11 +++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c index 30f3b3085c78..8d5e261cd10f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c @@ -130,23 +130,22 @@ mt7921_queues_acq(struct seq_file *s, void *data) mt7921_mutex_acquire(dev); - for (i = 0; i < 16; i++) { - int j, acs = i / 4, index = i % 4; + for (i = 0; i < 4; i++) { u32 ctrl, val, qlen = 0; + int j; - val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, index)); - ctrl = BIT(31) | BIT(15) | (acs << 8); + val = mt76_rr(dev, MT_PLE_AC_QEMPTY(i)); + ctrl = BIT(31) | BIT(11) | (i << 24); for (j = 0; j < 32; j++) { if (val & BIT(j)) continue; - mt76_wr(dev, MT_PLE_FL_Q0_CTRL, - ctrl | (j + (index << 5))); + mt76_wr(dev, MT_PLE_FL_Q0_CTRL, ctrl | j); qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL, GENMASK(11, 0)); } - seq_printf(s, "AC%d%d: queued=%d\n", acs, index, qlen); + seq_printf(s, "AC%d: queued=%d\n", i, qlen); } mt7921_mutex_release(dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/regs.h b/drivers/net/wireless/mediatek/mt76/mt7921/regs.h index 26fb11823762..41c2855e7a3d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/regs.h @@ -17,13 +17,12 @@ #define MT_PLE_BASE 0x8000 #define MT_PLE(ofs) (MT_PLE_BASE + (ofs)) -#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) -#define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) -#define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) -#define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc) +#define MT_PLE_FL_Q0_CTRL MT_PLE(0x3e0) +#define MT_PLE_FL_Q1_CTRL MT_PLE(0x3e4) +#define MT_PLE_FL_Q2_CTRL MT_PLE(0x3e8) +#define MT_PLE_FL_Q3_CTRL MT_PLE(0x3ec) -#define MT_PLE_AC_QEMPTY(ac, n) MT_PLE(0x300 + 0x10 * (ac) + \ - ((n) << 2)) +#define MT_PLE_AC_QEMPTY(_n) MT_PLE(0x500 + 0x40 * (_n)) #define MT_PLE_AMSDU_PACK_MSDU_CNT(n) MT_PLE(0x10e0 + ((n) << 2)) #define MT_MDP_BASE 0xf000 -- 2.34.1