Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2893697pxb; Tue, 12 Oct 2021 16:02:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfeRLumdGUynSqi9HcSfaFOHW+LG6CjxpdoGm8ciFgCvTqZ0HF/F+/jSpITjg0a21TjjS6 X-Received: by 2002:aa7:9844:0:b0:44c:ce0a:f736 with SMTP id n4-20020aa79844000000b0044cce0af736mr30653865pfq.1.1634079731618; Tue, 12 Oct 2021 16:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634079731; cv=none; d=google.com; s=arc-20160816; b=bs1hv680zxjMeJ895AWownHQ/kyYv9HvZLqqWDccNWzJ4eRC71Olrubyp7TrkuN7Hi /vFxMn94vqsB8Qb1jSHLWlLBXcnt5JoDjcyoJbcG0tJwV5Mflzwvi+UOPTTGhTuqs0DI dGVMC32xGIGhE259fgnzk8yTmg993WN+Cwo9CWQXzEABz10uX4X8lAtUmAbiZumJTC1L Xc7hnZQFZNlnH7u5cC6CqT8+kBjcEv1c0DeQLC1i+miG3H5CCbpl1HWyx/vApuWjC8SS 3C2L+clU14098MvvZrb3s1xv7vbKFy5BKcB2sWTdoVls4oAPsdMQPInJvvEAfIk5FrP9 Mh5g== 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=qN6oNrfq78YrntoSxBh8CIRgIC414fFTNY6aGHA7xkE=; b=TYiWVAAr8LYo19eEPD28yXSSde8RzIPh9nym1INBHiW2ZbXCVOb6JfpGTrLrBQOmuM iPviQbOScMJaTppw3N1316jSw6TZ+PyMJsPD4bVSxdK7T/RueriNgKcwkzu7Sf3HLis1 Czm+uVyG5tpks9n2oNR6aP4axZQkdR0B6JEbbhMs40ptt5OAZcAJpOVie6CEREVgmiNy ZfgbHQxG7jc2iZY1NEbaW4oN28PoyM7d4kisv8pvTLVOREtQGg3qT81z0vTu972EYLls riekOR34TWsWXNy9fMgUVFuECKxCIltrmdLcERKRwwR8mFm6QWkQMBdxGXzOvEu5+ipV h6IQ== 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 q15si19904763plx.191.2021.10.12.16.02.01; Tue, 12 Oct 2021 16:02:11 -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 S235747AbhJLXD6 (ORCPT + 63 others); Tue, 12 Oct 2021 19:03:58 -0400 Received: from mailgw01.mediatek.com ([216.200.240.184]:34259 "EHLO mailgw01.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbhJLXD5 (ORCPT ); Tue, 12 Oct 2021 19:03:57 -0400 X-UUID: 115737f18eaf4f8385a767bb796bed03-20211012 X-UUID: 115737f18eaf4f8385a767bb796bed03-20211012 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 1726609347; Tue, 12 Oct 2021 16:01:52 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 12 Oct 2021 15:52:34 -0700 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 13 Oct 2021 06:52:33 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v4 06/16] mt76: connac: move mcu reg access utility routines in mt76_connac_lib module Date: Wed, 13 Oct 2021 06:51:59 +0800 Message-ID: <9db79a69d6557dee8e55954e0b97066b5d15c5a7.1634077769.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 c569e320f843..404c6bf8578e 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 848f43c44258..e5a0a6827145 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1113,4 +1113,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