Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2366830ybn; Thu, 26 Sep 2019 10:48:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAdpHUESXQRmpm0ZHjeKqE2LINOyHX7YqOjCARQS0cRfY2Wgli5v/qSvuHUv52ripJtOn7 X-Received: by 2002:a50:e613:: with SMTP id y19mr5102799edm.290.1569520104253; Thu, 26 Sep 2019 10:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569520104; cv=none; d=google.com; s=arc-20160816; b=Jqb/dGUV5flmvj+7o8TdcX3oOjX8AOGmu5eCInY2/qtDAH5/9hQ0Ch1Uev75d2rpcR 60LU2Jp359bvSMyyYfc6TsjMBrZLFg+kVFZrkdzVl5irlIrNi4J7Lbcxl5S1MSroVEJl ncrTY6NO2xxU36DNiwiCc/qo9TdVBkL1sGnDkK1drVibFgTBAMrxtTq6JKc2JJGQ8Ygq IbQJx2STMHXqyFf7dCEBiOVP7oQBrULgiqisnVAj9jAqb5I1WFBWcQ8444tUjljlq+1I o1khJe5h+t07Nu+sH8YzeZIWovG++XOTT00gf7a+9l8mzHJjb9oSsotD+9mEyQBG7zOh BDqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from:dkim-signature; bh=rA60bGR8u4HU6kcFr9xXmRBRPNRoWZEzKJE5aXlYE4w=; b=g6WYAQ5D8YYe48ZujxexHzpdJvmeINClCpkhw625O9C6K+zvZQXJEYv39IGNLhn4Y7 26/Pbdn7mPFLtxz9ueWavgGDyaN1owDafNjUw9u0K2qU3HtBA0gS5fflGcQtftfi6Yx/ sDq9qgi0Dz6RDmD3wbqiIYFv0dj6eoDf5ogoigEnbdwp2IppXY2NKEYMsJFzNhWyfhcq X6iDyrmZGyc5hWU3vYD1t6LH6G6xauONhYWnHEwvYdbEccVnzTj9AEWRMqBRks6HtHrb AOg7dHsA3j+wbWygh2kNf9RE2CBqnqA9SG7yo4b0rRRVKmvQ8TrbdjLI3EGZvAgAyghF 5hdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=IGYFsQvI; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qx24si1468584ejb.138.2019.09.26.10.47.59; Thu, 26 Sep 2019 10:48:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=IGYFsQvI; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbfIZRrh (ORCPT + 99 others); Thu, 26 Sep 2019 13:47:37 -0400 Received: from nbd.name ([46.4.11.11]:55240 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727796AbfIZRrg (ORCPT ); Thu, 26 Sep 2019 13:47:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=rA60bGR8u4HU6kcFr9xXmRBRPNRoWZEzKJE5aXlYE4w=; b=IGYFsQvICOy3hq0P4ZobR09ca4 MUwxWQlUuhzzBNTiTJ/YJ9ym5Jdq9TgoUItxm2+tgbZfG7fUN1mjU4brael1nCgh83RqAxecIITdE 3X96LbfOCwF0VjtcUKy7OvHGHuD36hSmznz8Kf2fSIjzoUgcp8nrK0pBqmJz4bkisV0o=; Received: from p54ae9b80.dip0.t-ipconnect.de ([84.174.155.128] helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iDXrZ-0000yb-A3 for linux-wireless@vger.kernel.org; Thu, 26 Sep 2019 19:47:33 +0200 Received: by maeck.local (Postfix, from userid 501) id B483269B6A83; Thu, 26 Sep 2019 19:47:32 +0200 (CEST) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 13/15] mt76: mt7615: introduce mt7615_mac_wtbl_update routine Date: Thu, 26 Sep 2019 19:47:30 +0200 Message-Id: <20190926174732.42375-13-nbd@nbd.name> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190926174732.42375-1-nbd@nbd.name> References: <20190926174732.42375-1-nbd@nbd.name> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Lorenzo Bianconi Introduce mt7615_mac_wtbl_update utility routine in order to update WTBL update register Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 16 +++++++++++----- .../net/wireless/mediatek/mt76/mt7615/mt7615.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index f688390bfd3a..2e36b3289fa6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -492,6 +492,15 @@ static u32 mt7615_mac_wtbl_addr(int wcid) return MT_WTBL_BASE + wcid * MT_WTBL_ENTRY_SIZE; } +bool mt7615_mac_wtbl_update(struct mt7615_dev *dev, int idx, u32 mask) +{ + mt76_rmw(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_WLAN_IDX, + FIELD_PREP(MT_WTBL_UPDATE_WLAN_IDX, idx) | mask); + + return mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, + 0, 5000); +} + void mt7615_mac_set_rates(struct mt7615_dev *dev, struct mt7615_sta *sta, struct ieee80211_tx_rate *probe_rate, struct ieee80211_tx_rate *rates) @@ -724,11 +733,8 @@ mt7615_mac_wtbl_update_pk(struct mt7615_dev *dev, struct mt76_wcid *wcid, mt76_wr(dev, MT_WTBL_RICR0, w0); mt76_wr(dev, MT_WTBL_RICR1, w1); - mt76_wr(dev, MT_WTBL_UPDATE, - FIELD_PREP(MT_WTBL_UPDATE_WLAN_IDX, wcid->idx) | - MT_WTBL_UPDATE_RXINFO_UPDATE); - - if (!mt76_poll(dev, MT_WTBL_UPDATE, MT_WTBL_UPDATE_BUSY, 0, 5000)) + if (!mt7615_mac_wtbl_update(dev, wcid->idx, + MT_WTBL_UPDATE_RXINFO_UPDATE)) return -ETIMEDOUT; return 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h index fe084555754b..070afba63e43 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h @@ -231,6 +231,7 @@ static inline void mt7615_irq_disable(struct mt7615_dev *dev, u32 mask) } void mt7615_update_channel(struct mt76_dev *mdev); +bool mt7615_mac_wtbl_update(struct mt7615_dev *dev, int idx, u32 mask); void mt7615_mac_reset_counters(struct mt7615_dev *dev); void mt7615_mac_cca_stats_reset(struct mt7615_dev *dev); void mt7615_mac_set_scs(struct mt7615_dev *dev, bool enable); -- 2.17.0