Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3469454pxb; Mon, 18 Oct 2021 16:15:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzOx/dqGMva29eINzfcTF7VPLn0Q6OYLOCN87LTSe281+mWb+Venlnc87PHGB1USfFa1km X-Received: by 2002:a05:6a00:9aa:b0:44d:4390:d940 with SMTP id u42-20020a056a0009aa00b0044d4390d940mr32042023pfg.14.1634598933062; Mon, 18 Oct 2021 16:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634598933; cv=none; d=google.com; s=arc-20160816; b=d0mF8oNs/W27LhGRZXMLh4+MWBE0DXwBj8wEDBc/THa8V+AEfERMJLKanzWQtmEsau ECcAzKhxAufhyr02Je1e16RwiF5gaMfyEiLi+/HluDzTV4BbJjqFyZ4B1djQ4sFv5Y5z 1ERw81MqAPoqpGHdBdvPoBJeg6gX5W870afvp+whp02ptOPTBMfL0Jkc57Gpl3l5X1Jv /s0wE4AypO8FmW68R/sy69x13kvbQ/mYYXXM/u2hO9entzF7PfpkUCYy/oRxjigcFM12 kz62glA0Ier9lmybBp6jmBft3FT/DKwL7xBSFHS8Vr2VoF4qtHDNxtjrXJVZZGf4W9Ak mOVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=yzNyaIBh6psmtlqLVuY+LSnve91JPLkDAhot+24cgUM=; b=NipB/35zSpoqB5gd9SxE/LDUcRDI40SriOQe78RoqwNGZMeC5m4G/liZb/80nmeQD3 k4at39bhu6Wbyqr1yHzR73q9H14kEDYBiWj4ffETefEzKm9hC1neaQhRAvbkwv8wp1xJ CiVzeOIIwdJQW6TmK+hyJEexiiPCBxKXPQMVQIet7mUsfDwyu1mYfdc9R21Bz1wKg8uA u3ywVS36OCBJ0oZNPsml9ONg+TTVz6zU0hohqQBRkmAekS+ylkkM7FJsxLFIjku1Rtrx PncziKa37wFqhXJv0IEPoo0zPy+bL1NmhYwR5mfJfV+PzVvQAD3IxwC79W7xjM6KA1/K 54fA== 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 r11si3180371plr.110.2021.10.18.16.15.18; Mon, 18 Oct 2021 16:15:33 -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 S231454AbhJRXRY (ORCPT + 64 others); Mon, 18 Oct 2021 19:17:24 -0400 Received: from mailgw01.mediatek.com ([216.200.240.184]:25617 "EHLO mailgw01.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbhJRXRX (ORCPT ); Mon, 18 Oct 2021 19:17:23 -0400 X-UUID: b6a31d5f84054886a25d98ba78d70fe2-20211018 X-UUID: b6a31d5f84054886a25d98ba78d70fe2-20211018 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 937409363; Mon, 18 Oct 2021 16:15:09 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 18 Oct 2021 16:12:09 -0700 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 19 Oct 2021 07:12:09 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 06/17] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module Date: Tue, 19 Oct 2021 07:11:36 +0800 Message-ID: <429a4e73846c70944c782acc053f439e283c199f.1634598341.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Move mcu reg access shared between mt7663s and mt7921s in mt76_connac_lib module. Tested-by: Deren Wu Acked-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 2 ++ 2 files changed, 29 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 9a1af2ba7e8e..70d72dfa239e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2412,6 +2412,33 @@ void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac, } EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_suspend_iter); +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset) +{ + struct { + __le32 addr; + __le32 val; + } __packed req = { + .addr = cpu_to_le32(offset), + }; + + return mt76_mcu_send_msg(dev, MCU_CMD_REG_READ, &req, sizeof(req), + true); +} +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_rr); + +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val) +{ + struct { + __le32 addr; + __le32 val; + } __packed req = { + .addr = cpu_to_le32(offset), + .val = cpu_to_le32(val), + }; + + mt76_mcu_send_msg(dev, MCU_CMD_REG_WRITE, &req, sizeof(req), false); +} +EXPORT_SYMBOL_GPL(mt76_connac_mcu_reg_wr); #endif /* CONFIG_PM */ MODULE_AUTHOR("Lorenzo Bianconi "); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 751e621a6f9b..b89faab04996 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1114,4 +1114,6 @@ void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb, int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy); int mt76_connac_mcu_set_p2p_oppps(struct ieee80211_hw *hw, struct ieee80211_vif *vif); +u32 mt76_connac_mcu_reg_rr(struct mt76_dev *dev, u32 offset); +void mt76_connac_mcu_reg_wr(struct mt76_dev *dev, u32 offset, u32 val); #endif /* __MT76_CONNAC_MCU_H */ -- 2.25.1