From patchwork Sat Aug 25 10:40:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10576123 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 C84B6109C for ; Sat, 25 Aug 2018 10:42:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B81402AE6D for ; Sat, 25 Aug 2018 10:42:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC5A32B009; Sat, 25 Aug 2018 10:42:12 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 56CBB2AE6D for ; Sat, 25 Aug 2018 10:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=YbiWsBbxyCt73ENTXdwmYpLV0Jsof3CaL5qH3q9ZEEs=; b=U4+ RXlVMC4ms8DBx8KrBot2S4A+oC4PBr+ETSs/rDfT3EuSBfGl6ooivWu6I2GHR7ZhPI2Zs2My3nbtd TqrKT2coXnT012czqoZNsnkip0kKtER7RdTlcWmdwhZ9McmoWZCqFij6kBiUR8mJnwe1A/20FoGC3 PpSGFNjsO70BQHtSylSnH7dHtGmzSaLL+iedBQp8nScKzFgbig5JdNc+YWFozQas2U4PQ1Ey/kYzs LB0qv/X3eTqOQdgMsuRj4U/6lxwH5I6hvOxRG5yiI3AfWUweIoxhe7cHUxey2Wy07Ya0drZ2lgsLB U+1JeCdRZaQKCQtdWOGu2XTMDaTdc1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftW1B-0005SX-Qa for patchwork-linux-mediatek@patchwork.kernel.org; Sat, 25 Aug 2018 10:42:09 +0000 Received: from mail-wm0-f67.google.com ([74.125.82.67]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ftW0P-0004vm-2L for linux-mediatek@lists.infradead.org; Sat, 25 Aug 2018 10:41:26 +0000 Received: by mail-wm0-f67.google.com with SMTP id n11-v6so3849737wmc.2 for ; Sat, 25 Aug 2018 03:41:10 -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; bh=/WLpZF0IP0X8cVD7B6dDqoy8w1iEKF4b6BbWQbQpTW4=; b=Klukws3ZBtovsV1s8XY9kh7eX30dpWQ2j/Yf2YYnDHOiBdmitXtxuGjXCu0z9No7aY 0anIuCt9bcrFV03sjd5ta6TyZLSaFmvqMBI/sYiGj3LN4m7AqnOqZGDBCECLEqdYHqnW 447SKG8db+esqOBwxYv0emOTkN401x4Of+QKfm4Ekjz8vTE5XCoo+YKhiRX41yFxxuER VQeEI7prcoj+xf+nz1O28dbrZZDFZjVl2cdLn8Kwj5PUAS5Xfqz6gAhAy2OSZz367mDh 4X6+srPoR0zFRsBo60SrjRwaUIynrblJyAienccVYRRCemqLT2mQcy9hmYBpfA8/5qTy uETA== X-Gm-Message-State: APzg51Axh8gdeRsjftt8dkfGAYc++03XSt7B2Krx5wIOzqGgCCKGF17V aFdPi6V41DAsGYJ+Ewr+WN7Ofw== X-Google-Smtp-Source: ANB0VdZB0XYeEx743az/9HpzHGp50XbppPrw+nqHVJwbL57Y8QCe4hh5yfBtD+fzUhZmx1o2og1Jdg== X-Received: by 2002:a1c:6a06:: with SMTP id f6-v6mr859283wmc.159.1535193669402; Sat, 25 Aug 2018 03:41:09 -0700 (PDT) Received: from localhost.localdomain ([151.66.53.29]) by smtp.gmail.com with ESMTPSA id l18-v6sm16391708wru.75.2018.08.25.03.41.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Aug 2018 03:41:08 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Subject: [PATCH 07/16] mt76x0: remove mt76x0_vendor_single_wr routine Date: Sat, 25 Aug 2018 12:40:47 +0200 Message-Id: <20180825104056.9130-8-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.18.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180825_034121_149670_34B89107 X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, sgruszka@redhat.com MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Remove mt76x0_vendor_single_wr routine and use mt76u_single_wr utility function for mcu firmware loading Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/mcu.c | 13 +++++-------- .../net/wireless/mediatek/mt76/mt76x0/usb.c | 19 ------------------- .../net/wireless/mediatek/mt76/mt76x0/usb.h | 2 -- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c index c8ea3126e7dc..cf3acee12dc3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/mcu.c @@ -416,15 +416,12 @@ static int __mt76x0_dma_fw(struct mt76x0_dev *dev, memcpy(buf.buf + sizeof(reg), data, len); memset(buf.buf + sizeof(reg) + len, 0, 8); - ret = mt76x0_vendor_single_wr(dev, MT_VEND_WRITE_FCE, - MT_FCE_DMA_ADDR, dst_addr); - if (ret) - return ret; + mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, MT_FCE_DMA_ADDR, + dst_addr); + len = roundup(len, 4); - ret = mt76x0_vendor_single_wr(dev, MT_VEND_WRITE_FCE, - MT_FCE_DMA_LEN, len << 16); - if (ret) - return ret; + mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, MT_FCE_DMA_LEN, + len << 16); buf.len = MT_DMA_HDR_LEN + len + 4; ret = mt76x0_usb_submit_buf(dev, USB_DIR_OUT, MT_EP_OUT_INBAND_CMD, diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c index fdb71b907419..a9835bb7b921 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.c @@ -131,25 +131,6 @@ int mt76x0_vendor_request(struct mt76x0_dev *dev, const u8 req, return ret; } -int mt76x0_vendor_single_wr(struct mt76x0_dev *dev, const u8 req, - const u16 offset, const u32 val) -{ - struct mt76x0_dev *mdev = dev; - int ret; - - mutex_lock(&mdev->usb_ctrl_mtx); - - ret = mt76x0_vendor_request(dev, req, USB_DIR_OUT, - val & 0xffff, offset, NULL, 0); - if (!ret) - ret = mt76x0_vendor_request(dev, req, USB_DIR_OUT, - val >> 16, offset + 2, NULL, 0); - - mutex_unlock(&mdev->usb_ctrl_mtx); - - return ret; -} - void mt76x0_addr_wr(struct mt76x0_dev *dev, const u32 offset, const u8 *addr) { mt76_wr(dev, offset, get_unaligned_le32(addr)); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h index d23ca45a294e..931c36554ff4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb.h @@ -54,7 +54,5 @@ void mt76x0_complete_urb(struct urb *urb); int mt76x0_vendor_request(struct mt76x0_dev *dev, const u8 req, const u8 direction, const u16 val, const u16 offset, void *buf, const size_t buflen); -int mt76x0_vendor_single_wr(struct mt76x0_dev *dev, const u8 req, - const u16 offset, const u32 val); #endif