From patchwork Sun Mar 8 22:08:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 216346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7457AC10F28 for ; Sun, 8 Mar 2020 22:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 49BC420848 for ; Sun, 8 Mar 2020 22:09:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583705381; bh=52y2x5H0lix5N4OacHXxNPB/4QL9ffOqbHlJRPuA5Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NqcKmG/uoKeVyKFAsibnH/GEnqsh/uD5rsMesSx0qfnC/yUC92Rf3Ia1KZoRUYXbi sLybsyhiIuiVI4IpftRi8EJM1mH52eKaRNEQV7rMVVH1gV3s3Y+MgF4MGgBidZZlrO AM8rrdkdRF3yWNPl5pYcCfoSituY/nGGbWvEISmw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbgCHWJk (ORCPT ); Sun, 8 Mar 2020 18:09:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:39736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbgCHWJk (ORCPT ); Sun, 8 Mar 2020 18:09:40 -0400 Received: from localhost.localdomain (unknown [151.48.128.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6BB162083E; Sun, 8 Mar 2020 22:09:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583705379; bh=52y2x5H0lix5N4OacHXxNPB/4QL9ffOqbHlJRPuA5Y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uOXBHK+EWn9U+NZqDsXlOjYHLSAA2JIUwLBAft1xzkkSRaFYy3sg+Zn8JsKEM8WMX wz0kKTMIctDnpl99T7S+LPWNQyMy7hA/zztswGHGSSCx4jkz4k5g/WcFrQZJOxSWqa wnj5SFgOBVj0qCC7u7lUacZI5uBRrs5X7YDWlbis= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, sean.wang@mediatek.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com Subject: [PATCH v2 20/25] mt76: mt7615: introduce uni cmd command types Date: Sun, 8 Mar 2020 23:08:32 +0100 Message-Id: X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Introduce mcu uni command type. Uni commands rely on a stripped verions of mt7615_mcu_txd data strutture. Split mt7615_mcu_txd_common and mt7615_mcu_txd. Uni commands will be use by mt7663e driver Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 +++++++-- drivers/net/wireless/mediatek/mt76/mt7615/mcu.h | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index e73cd3cb014a..73c68ce871a6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -52,7 +52,8 @@ struct mt7615_fw_trailer { void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, int cmd, int *wait_seq) { - int mcu_cmd = cmd & MCU_CMD_MASK; + int txd_len, mcu_cmd = cmd & MCU_CMD_MASK; + bool uni_cmd = cmd & MCU_UNI_PREFIX; struct mt7615_mcu_txd *mcu_txd; u8 seq, q_idx, pkt_fmt; __le32 *txd; @@ -62,7 +63,8 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, if (!seq) seq = ++dev->mt76.mcu.msg_seq & 0xf; - mcu_txd = (struct mt7615_mcu_txd *)skb_push(skb, sizeof(*mcu_txd)); + txd_len = uni_cmd ? sizeof(*mcu_txd) - 20 : sizeof(*mcu_txd); + mcu_txd = (struct mt7615_mcu_txd *)skb_push(skb, txd_len); if (cmd != MCU_CMD_FW_SCATTER) { q_idx = MT_TX_MCU_PORT_RX_Q0; @@ -91,6 +93,9 @@ void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, if (cmd & MCU_FW_PREFIX) { mcu_txd->set_query = MCU_Q_NA; mcu_txd->cid = mcu_cmd; + } else if (uni_cmd) { + mcu_txd->ext_cid_ack = MCU_CMD_UNI_EXT_ACK; + mcu_txd->cid = mcu_cmd; } else { mcu_txd->cid = MCU_CMD_EXT_CID; mcu_txd->set_query = MCU_Q_SET; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h index 8ae08a2bf10d..bdbc5d9567cd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.h @@ -180,7 +180,8 @@ enum { }; #define MCU_FW_PREFIX BIT(31) -#define MCU_CMD_MASK ~MCU_FW_PREFIX +#define MCU_UNI_PREFIX BIT(30) +#define MCU_CMD_MASK ~(MCU_FW_PREFIX | MCU_UNI_PREFIX) enum { MCU_CMD_TARGET_ADDRESS_LEN_REQ = MCU_FW_PREFIX | 0x01, @@ -217,6 +218,12 @@ enum { MCU_EXT_CMD_SET_RDD_PATTERN = 0x7d, }; +#define MCU_CMD_ACK BIT(0) +#define MCU_CMD_UNI BIT(1) +#define MCU_CMD_QUERY BIT(2) + +#define MCU_CMD_UNI_EXT_ACK (MCU_CMD_ACK | MCU_CMD_UNI | MCU_CMD_QUERY) + enum { PATCH_SEM_RELEASE = 0x0, PATCH_SEM_GET = 0x1