From patchwork Sun Mar 13 16:22:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12779373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF971C433FE for ; Sun, 13 Mar 2022 16:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ChskwJDy5ZUIJ9TrR+0yRd0eX/Q/wIWa+ovOh6ioiDE=; b=uMpxW7e26/d8aQ L3yUBJrWIHiPj5Ef+Ta75U8pny0f+kGeYOyyh4M88+mxr/xBb+IPmUrHsxmBkQm4dbVoIWbXCDQD6 XHwFID3ey+tHXekvMZm62xspvX5ae56lhThche8gFQK7ssW+FMjeHEwIUh5KLfAAZIbZohUsupiXR sEE2iTcox+Y7vonBPUOnvV+86kaQ98r8vy5MUPaPDuTUVZZzqFY2RIsl3ksZeE/0bf45v0o+8n2K2 7syf4FfjCWTbUQg4QbmsydOxOjyHaJrD9Bd7qKshCF1XOLpclBTYhVtBVq6rrB3fdEHowCH2Zpp6Y NfnGsKLSBqruuYZAPuxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTR0A-0038oi-Ct; Sun, 13 Mar 2022 16:23:26 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTR04-0038jr-8Q for linux-mediatek@lists.infradead.org; Sun, 13 Mar 2022 16:23:24 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CF625B80C9E; Sun, 13 Mar 2022 16:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA9B6C340E8; Sun, 13 Mar 2022 16:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647188597; bh=DVaBtUDkkMcB4eyNDjBZeuwCK+da3683tL6OZe4IULQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kPQQ0kmwjGG0qUV7smUx2MJIxTrrls9AnamNHlqs0cytd+uGoKBH7i3/4V3nhub4M ef9buwiUcL3mz2q4baPjQP4XR6uE4xBmzOOTjnKaUcaEn8oJ6fSvphwuLQmg1bXlQW Sw1Txz+fscFgW+prhHZqWnAV113Bbh+GaXlhnPH2cUFhpWY3yIX8/lIRdkk4CwvlGb ONMXFTLXm0kFmOndm2/j5tLucQPdauVFrsJV1qNHwjGi1SjLto0OL6wYrQzjTN0dNx pqJ/z238rsm8bmKXAjSmKljaZmAbeEQuTSRrBghjIrf5xDBJKA/00E/e6y2QVj0LEK RnWAsaHo3Tjhw== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, sean.wang@mediatek.com, deren.wu@mediatek.com, linux-mediatek@lists.infradead.org Subject: [PATCH v4 5/9] mt76: mt7921: update mt7921_skb_add_usb_sdio_hdr to support usb Date: Sun, 13 Mar 2022 17:22:37 +0100 Message-Id: <4ced0548dc8f60266cca3e1800b42f962d29a156.1647188302.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220313_092320_639632_5DE62182 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org This is a preliminary patch to add mt7921u driver support. Tested-by: Sean Wang Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h | 10 ++++++---- drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h index 394a677140da..66b331d003b4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h @@ -352,12 +352,14 @@ static inline void mt7921_mcu_tx_cleanup(struct mt7921_dev *dev) mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WA], false); } -static inline void mt7921_skb_add_sdio_hdr(struct sk_buff *skb, - enum mt7921_sdio_pkt_type type) +static inline void +mt7921_skb_add_usb_sdio_hdr(struct mt7921_dev *dev, struct sk_buff *skb, + int type) { - u32 hdr; + u32 hdr, len; - hdr = FIELD_PREP(MT7921_SDIO_HDR_TX_BYTES, skb->len + sizeof(hdr)) | + len = mt76_is_usb(&dev->mt76) ? skb->len : skb->len + sizeof(hdr); + hdr = FIELD_PREP(MT7921_SDIO_HDR_TX_BYTES, len) | FIELD_PREP(MT7921_SDIO_HDR_PKT_TYPE, type); put_unaligned_le32(hdr, skb_push(skb, sizeof(hdr))); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c index 4fd1d4765b04..5462ab05fb13 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mac.c @@ -183,7 +183,7 @@ int mt7921s_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, pktid = mt76_tx_status_skb_add(&dev->mt76, wcid, skb); mt7921s_write_txwi(dev, wcid, qid, sta, key, pktid, skb); - mt7921_skb_add_sdio_hdr(skb, MT7921_SDIO_DATA); + mt7921_skb_add_usb_sdio_hdr(dev, skb, MT7921_SDIO_DATA); pad = round_up(skb->len, 4) - skb->len; err = mt76_skb_adjust_pad(skb, pad); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c index 5d8af18c7026..54a5c712a3c3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c @@ -36,7 +36,7 @@ mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, if (cmd == MCU_CMD(FW_SCATTER)) type = MT7921_SDIO_FWDL; - mt7921_skb_add_sdio_hdr(skb, type); + mt7921_skb_add_usb_sdio_hdr(dev, skb, type); pad = round_up(skb->len, 4) - skb->len; __skb_put_zero(skb, pad);