Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp49117pxb; Tue, 14 Sep 2021 18:18:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHQ3BMGWqBkQV6ArSGzg0GIXF5R059LGwsrXNzpwu7FzDFyGq7a5DG6cmT828Nvqkyj4VT X-Received: by 2002:a05:6512:38a1:: with SMTP id o1mr15335192lft.645.1631668723928; Tue, 14 Sep 2021 18:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631668723; cv=none; d=google.com; s=arc-20160816; b=dw2efblDg2HODiIFakNz2iSyF8z9wM/W4zybSn8LiYXbj1IvXmliJRpZscqnntl7rU qajg5Kco4xfaylN3DroW1WqC8f3O3YVSIECd/KtdXyka4zO50OezMnq6di79YK8Zc/p1 IyuDM1ZpMMfNT8tI0iiKu232aGsbGFQ+cP5QYt9lascPbEPxcIa8TKtqpycsZl/4DUqa YBZBMbkXuZr7ZB7c1V6vK2EPiAr08+/VXuvtRgETJdaxBqFaYz27Kn8NDNTFM9WeJoaP Hmel4f+DSc6KDOlQ2HsO8Xe1FK1vC74xOSfAXnk/nLePPoiH7dDETvDCD4bOnprLteV4 8S0Q== 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=6NNu/1yZM/N0UQyQahMr/hXYbE+uzNlPc5GxDvbXmiU=; b=B8pSF4PWcf8STiZ5M9hEGs0ojOORir58iH93jJQXCyMrw6N6zFJkvOiDTEMlX4ueSd ee6MZbOAO08c/sa3JuG1z0pT18jGzwaJCBb1sw93Fm+wtjB5kI6OCE9obTDC0sh7AxLe RWETIOhZScruaQHiiA7EgbrlpwAjgCdfGUvEoG2cobBL2zALQA0kFl29mH+4STydF5uB 1cuxj4wXSMf6g0IYW/I0Uql9NQE/R8uJm1iZSw1nJ3Majz+rfNUFYJHAvERWU+silfrq Gqftn0nsbOcZKjV0BOGQ6PHph9Be/5B6QYgNnEtbsiVGxAPCZg2d1S3TyJ9kMGmBa/kF OQbg== 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 2si13656275lft.457.2021.09.14.18.18.14; Tue, 14 Sep 2021 18:18:43 -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 S230053AbhIOBQn (ORCPT + 99 others); Tue, 14 Sep 2021 21:16:43 -0400 Received: from mailgw02.mediatek.com ([216.200.240.185]:38002 "EHLO mailgw02.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbhIOBQm (ORCPT ); Tue, 14 Sep 2021 21:16:42 -0400 X-UUID: b877ac070dc1413e839d036a8e15cb8a-20210914 X-UUID: b877ac070dc1413e839d036a8e15cb8a-20210914 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 1137424783; Tue, 14 Sep 2021 18:15:22 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 14 Sep 2021 18:15:20 -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; Wed, 15 Sep 2021 09:15:19 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH v1 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module Date: Wed, 15 Sep 2021 09:14:39 +0800 Message-ID: <4d805c4ef066eb6976f0a00710d4b5b3cf20e0cf.1631667941.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 Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 27 +++++++++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 3 +++ 2 files changed, 30 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index ae692052de97..a53f6344a184 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -2406,6 +2406,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 ea46dde364e1..6444cb6a73d6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1111,4 +1111,7 @@ 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