From patchwork Fri Sep 28 11:38:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10619783 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B309B15A6 for ; Fri, 28 Sep 2018 11:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A60B42B1CD for ; Fri, 28 Sep 2018 11:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99EBF2B2BD; Fri, 28 Sep 2018 11:39:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B24A2B1CD for ; Fri, 28 Sep 2018 11:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729528AbeI1SCm (ORCPT ); Fri, 28 Sep 2018 14:02:42 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55928 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729480AbeI1SCl (ORCPT ); Fri, 28 Sep 2018 14:02:41 -0400 Received: by mail-wm1-f65.google.com with SMTP id 206-v6so1882674wmb.5 for ; Fri, 28 Sep 2018 04:39:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=O/KRut/6OnVTHohLxqYsEzDCoe7rPrOM1qDZrFV9Sdk=; b=NhqTG6oINRQHO3GxGVXPb3YXq4Qych1TLOpJm+bBgaEhsvrUqysd7H2rUnwuR/lhJL 6t47Z9MdkEG35fhyUCkBYn+XM9R72Y7llPhRz3aUr+x1AcVYi4h4Eis/zqaFHzNDKa5i xgmDK531ETLsJoVTQ17leR2DEHqpNjxgv2ft3JbpxfcUpPFK4JDCeobFMoX68XWaaZvw Bdg4WseCKcOMHvGBI7DFzniYKLUrnRqMeyuhhPjpi/r3lbr0zRsvA9hTf7s+NdgVkskj 1XuApcK4pYBZI3fH3VULOFn3xJPEsKfgumk5HTiXoIYtMebpJDZGJPhdfxkVWv8DozdQ 6EmQ== X-Gm-Message-State: ABuFfoj+WzuQO7vO4Aktp3+4GtwpZUIgVEJ28bedyKuS+ticgi4IK0GK V1rCY/3Hk5rXYhr4QnecaId/fberzaM= X-Google-Smtp-Source: ACcGV62QJsQDjXCGAsv7GzzFgqRtlXBuhL5GfiDmDDcln8/MqXiSxC7BMjgX7FUMX91TNUHiLjWawA== X-Received: by 2002:a1c:a683:: with SMTP id p125-v6mr1491860wme.14.1538134758311; Fri, 28 Sep 2018 04:39:18 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id s10-v6sm2395655wmd.22.2018.09.28.04.39.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Sep 2018 04:39:17 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: sgruszka@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH v3 02/24] mt76: move wait_for_wpdma in mt76x02_dma.h Date: Fri, 28 Sep 2018 13:38:45 +0200 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move wait_for_wpdma utility routine in mt76x02_dma.h in order to be reused by mt76x0 driver. Moreover add the possibility to specify the timeout value in wait_for_wpdma signature Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x02_dma.h | 10 ++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 8 -------- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt76x2u_mac.c | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h b/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h index 32a323ebc6a7..2396d49a84dd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_dma.h @@ -18,6 +18,7 @@ #define __MT76x02_DMA_H #include "dma.h" +#include "mt76x02_regs.h" #define MT_TXD_INFO_LEN GENMASK(15, 0) #define MT_TXD_INFO_NEXT_VLD BIT(16) @@ -57,4 +58,13 @@ enum dma_msg_port { DISCARD, }; +static inline bool +mt76x02_wait_for_wpdma(struct mt76_dev *dev, int timeout) +{ + return __mt76_poll(dev, MT_WPDMA_GLO_CFG, + MT_WPDMA_GLO_CFG_TX_DMA_BUSY | + MT_WPDMA_GLO_CFG_RX_DMA_BUSY, + 0, timeout); +} + #endif /* __MT76x02_DMA_H */ diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2.h b/drivers/net/wireless/mediatek/mt76/mt76x2.h index a6dd35d00968..b950361e5f87 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x2.h @@ -151,14 +151,6 @@ static inline bool mt76x2_wait_for_bbp(struct mt76x2_dev *dev) 0, 100); } -static inline bool wait_for_wpdma(struct mt76x2_dev *dev) -{ - return mt76_poll(dev, MT_WPDMA_GLO_CFG, - MT_WPDMA_GLO_CFG_TX_DMA_BUSY | - MT_WPDMA_GLO_CFG_RX_DMA_BUSY, - 0, 1000); -} - extern const struct ieee80211_ops mt76x2_ops; struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c index 72005faee00e..68244b47312a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -19,6 +19,7 @@ #include "mt76x2_eeprom.h" #include "mt76x2_mcu.h" #include "mt76x02_util.h" +#include "mt76x02_dma.h" static void mt76x2_mac_pbf_init(struct mt76x2_dev *dev) @@ -206,7 +207,7 @@ int mt76x2_mac_start(struct mt76x2_dev *dev) memset(dev->aggr_stats, 0, sizeof(dev->aggr_stats)); mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX); - wait_for_wpdma(dev); + mt76x02_wait_for_wpdma(&dev->mt76, 1000); usleep_range(50, 100); mt76_set(dev, MT_WPDMA_GLO_CFG, diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2u_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x2u_mac.c index 0f5d781b13dc..f28c6fbcc305 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2u_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2u_mac.c @@ -119,7 +119,7 @@ int mt76x2u_mac_start(struct mt76x2_dev *dev) mt76x2u_mac_reset_counters(dev); mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX); - wait_for_wpdma(dev); + mt76x02_wait_for_wpdma(&dev->mt76, 1000); usleep_range(50, 100); mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);