From patchwork Fri Feb 28 13:29:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 216403 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,URIBL_BLOCKED,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 CBA21C3F2D2 for ; Fri, 28 Feb 2020 13:29:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2E07246AF for ; Fri, 28 Feb 2020 13:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582896578; bh=f8RbrseGRCEYx1Vjvw+blcmWjgiQe/rZQwvLiN/IQgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AIKTnqxtlmcLHcMNbfZ1+v3MejDyXXuxMpRxU3bytcx6oDvVrSe8nUxt2JjWVX/4R MH2HDZmkmPhoLJqgx6XyQo2ZQU0PB6SzilSSd2/UbpgwAScdDBnvOjWmXq49jMn5+R 3aBoyEAtPiJ6vzoN6optnZOHl1scbvNVtm/c4Tnk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726747AbgB1N3h (ORCPT ); Fri, 28 Feb 2020 08:29:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:42664 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726400AbgB1N3h (ORCPT ); Fri, 28 Feb 2020 08:29:37 -0500 Received: from lore-desk-wlan.redhat.com (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 BEA9F2469D; Fri, 28 Feb 2020 13:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582896576; bh=f8RbrseGRCEYx1Vjvw+blcmWjgiQe/rZQwvLiN/IQgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2bVuBDtrmkZ1uImr71X2QjAXD6ZPf8fwzrJ4GUeiYtbybZxHaUe6t/AEVnt3e98JV 1SzKwEtXL75T2JcB6FbqPVcHmpU1XaiPp8C1VI8vtIi4jviS59CVbVe8Y6E3aEVZZV Z/ts8EZMzSV4mPUz5rgwxdmapzj4UbFH186Pqws4= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, sean.wang@mediatek.com Subject: [PATCH 2/6] mt76: mt7615: introduce mt7615_mcu_fill_msg Date: Fri, 28 Feb 2020 14:29:23 +0100 Message-Id: <9b64674550f709022ccfb36dbfa221f50f7127f3.1582893136.git.lorenzo@kernel.org> 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 mt7615_mcu_fill_msg routine to initialize mcu messages. mt7615_mcu_fill_msg will be reused adding mt7663u support Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 20 +++++++++++-------- .../wireless/mediatek/mt76/mt7615/mt7615.h | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 89f679c16a71..9975ee3b6c99 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -79,22 +79,20 @@ struct mt7663_fw_buf { #define FW_START_OVERRIDE BIT(0) #define FW_START_WORKING_PDA_CR4 BIT(2) -static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb, - int cmd, int *wait_seq) +void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, + int cmd, int *wait_seq) { struct mt7615_mcu_txd *mcu_txd; u8 seq, q_idx, pkt_fmt; - enum mt76_txq_id qid; - u32 val; __le32 *txd; + u32 val; seq = ++dev->mt76.mcu.msg_seq & 0xf; if (!seq) seq = ++dev->mt76.mcu.msg_seq & 0xf; - mcu_txd = (struct mt7615_mcu_txd *)skb_push(skb, - sizeof(struct mt7615_mcu_txd)); - memset(mcu_txd, 0, sizeof(struct mt7615_mcu_txd)); + mcu_txd = (struct mt7615_mcu_txd *)skb_push(skb, sizeof(*mcu_txd)); + memset(mcu_txd, 0, sizeof(*mcu_txd)); if (cmd != -MCU_CMD_FW_SCATTER) { q_idx = MT_TX_MCU_PORT_RX_Q0; @@ -103,7 +101,6 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb, q_idx = MT_TX_MCU_PORT_RX_FWDL; pkt_fmt = MT_TX_TYPE_FW; } - txd = mcu_txd->txd; val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len) | @@ -134,7 +131,14 @@ static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb, if (wait_seq) *wait_seq = seq; +} + +static int __mt7615_mcu_msg_send(struct mt7615_dev *dev, struct sk_buff *skb, + int cmd, int *wait_seq) +{ + enum mt76_txq_id qid; + mt7615_mcu_fill_msg(dev, skb, cmd, wait_seq); if (test_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state)) qid = MT_TXQ_MCU; else diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h index 7bf31ac2797e..1614a0b8ecb8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h @@ -376,6 +376,8 @@ int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val); int mt7615_mcu_ctrl_pm_state(struct mt7615_dev *dev, int band, int enter); int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index); void mt7615_mcu_exit(struct mt7615_dev *dev); +void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb, + int cmd, int *wait_seq); int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, enum mt76_txq_id qid, struct mt76_wcid *wcid, From patchwork Fri Feb 28 13:29:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 216402 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 06C28C3F2D2 for ; Fri, 28 Feb 2020 13:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C933E246A3 for ; Fri, 28 Feb 2020 13:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582896581; bh=q1v0uaAwmXeSc2SBPs0Pyq2gvzi2dB/Y28BZb+ikqf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gQlxNmbYWz59rmQy4UDA6Wj16zDsDz1TVJ6qVfkPkkzlvJ0/5eZXKw8gMFR7MS3ji Pl9ouZ82ki9N7mEu9iFSg/3cCqXEe0rJVcLX9q24rBCTsmy4YpayKxsyoHZLjz21ti 7XjjcXRo0d4Q8OkrIgZqNhXZrhfvbjjClj2zlfb8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgB1N3l (ORCPT ); Fri, 28 Feb 2020 08:29:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:42734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726673AbgB1N3k (ORCPT ); Fri, 28 Feb 2020 08:29:40 -0500 Received: from lore-desk-wlan.redhat.com (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 74609246A8; Fri, 28 Feb 2020 13:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582896580; bh=q1v0uaAwmXeSc2SBPs0Pyq2gvzi2dB/Y28BZb+ikqf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKToyO4JqBAN5n5SpoV4acqF0z1Jj4vC67XMRgYEy46b/7l26rAsdhsIPgENwctOl ByTeIdWq/P/3T9sINZ2JeZHRHDjvZ/j/ayzrv1j51baSooOfEa0cGtQw+x4tR2bl4b I/btsFLrdJLWUd6MeXYqfCpAx+1v23MVEuyiRwI4= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, sean.wang@mediatek.com Subject: [PATCH 4/6] mt76: mt7615: cleanup fw queue just for mmio devices Date: Fri, 28 Feb 2020 14:29:25 +0100 Message-Id: <59ea8135306064e6c93d832f8d6e59e9c2a3b66e.1582893136.git.lorenzo@kernel.org> 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 In order to reuse mt7615_mcu_send_firmware routine adding support for usb devices, clean fw hw queue just for mmio devices Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 43a376814be7..e3b4248d2b16 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -351,7 +351,9 @@ static int mt7615_mcu_send_firmware(struct mt7615_dev *dev, const void *data, data += cur_len; len -= cur_len; - mt76_queue_tx_cleanup(dev, MT_TXQ_FWDL, false); + + if (mt76_is_mmio(&dev->mt76)) + mt76_queue_tx_cleanup(dev, MT_TXQ_FWDL, false); } return ret; From patchwork Fri Feb 28 13:29:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 216401 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 DC7BCC3F2D2 for ; Fri, 28 Feb 2020 13:29:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2879246A8 for ; Fri, 28 Feb 2020 13:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582896585; bh=ueRno9wU2ahuD234sm4+J9KY4nKcWSDVStSvZRzy9lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xIVZIvf0ws86A6Rd0gnl6EileiZMwt2fg4iSPyLqjVuxMRZdKyVZehx5lybIVe1ir DIV+IsclOywc4cqGU0hV1MrDowMk/LXKolHOx3kThD0ftF5CfgP09Vuzzp0/6LE/Qh QcQb6U0wFUtlLQDfJtFpuQNpudnTTf30EyDJdDY0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726418AbgB1N3p (ORCPT ); Fri, 28 Feb 2020 08:29:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:42774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbgB1N3o (ORCPT ); Fri, 28 Feb 2020 08:29:44 -0500 Received: from lore-desk-wlan.redhat.com (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 1C92F246A3; Fri, 28 Feb 2020 13:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582896584; bh=ueRno9wU2ahuD234sm4+J9KY4nKcWSDVStSvZRzy9lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wGD05IUSKBqdOO9G5aRu5joFlfEMQ8Dmcx6Ea7sPvYcvHjbo0YJWw09yLLGYOojUE 6OX0wc+PPMNYFqn8tJT9zV3RxQ2Hlbc3zrFq4KmaEksHo5+dSqnrjutL53EQOsyZJp WpSQSW6UbBU2dHcgfgjCBwVNp68xSvosJrd19T3c= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, sean.wang@mediatek.com Subject: [PATCH 6/6] mt76: mt7615: move mt7615_mac_wtbl_addr in mac.h Date: Fri, 28 Feb 2020 14:29:27 +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 Move mt7615_mac_wtbl_addr in mac.h to reuse it in mt7663u driver Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 5 ----- drivers/net/wireless/mediatek/mt76/mt7615/mac.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index a14ca0825582..dcd1141792d6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -707,11 +707,6 @@ void mt7615_txp_skb_unmap(struct mt76_dev *dev, mt7615_txp_skb_unmap_hw(dev, &txp->hw); } -static u32 mt7615_mac_wtbl_addr(struct mt7615_dev *dev, int wcid) -{ - return MT_WTBL_BASE(dev) + 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, diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h index 5fe6a0e667a9..0fb9c0b2bca4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.h +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.h @@ -405,4 +405,9 @@ mt7615_txwi_to_txp(struct mt76_dev *dev, struct mt76_txwi_cache *t) return (struct mt7615_txp_common *)(txwi + MT_TXD_SIZE); } +static inline u32 mt7615_mac_wtbl_addr(struct mt7615_dev *dev, int wcid) +{ + return MT_WTBL_BASE(dev) + wcid * MT_WTBL_ENTRY_SIZE; +} + #endif