Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10736762pxu; Wed, 30 Dec 2020 10:09:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcWPLBNRUpi9xbvJoTiGwRLJPTJrZWlMx/8ipnDvnNdFYlnlibf3GlpM2j8fmd5CnHe6QM X-Received: by 2002:a17:906:d1cb:: with SMTP id bs11mr31209419ejb.535.1609351789223; Wed, 30 Dec 2020 10:09:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609351789; cv=none; d=google.com; s=arc-20160816; b=Ya7rapyROOTjkTwazE+zeBO4q3i2oeLSiLa9ckQ7DLqVdoVyyARraOEUayzfROOMKr HYUXhM7fkOtMb6TKsWev3/ZUG7zWGfTAN7f38kDjL7b+Z9J8qFO+Ua0FszcuBEYxjGw3 dsQ7Zhjb0hHDiw+5UN665BSEvuA6ZMeYyW93DUesNfGjTDXkfXcuA9eya3vFBsyUiL98 9Wu4waTXymXKXZCsFMcLC9JMvXfXwfO6A/JMZ0BK4/Xa/6YDrKZSx7/3yBZF589H4hx7 dV5tyJWu+aA/Sx0AN1Zx2eBQKpd+76MZGMlMhMzyiEpt2866PLOhbq8+aKb5ZFcKL+l1 /umw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=9PHnKQqn2d4uxJJsPo+E+7bA4+7rImGMy4F/MskI4MQ=; b=FT/VBY+42IWiL6IuarP3CN8rpqG+AhM96dBOOHfDa+OHwO5nsmAsv1l2Sy2w5ZqUv1 iQmC/yIItLXb9K4TkXKpNhSG3ybhm/Yb2iTv02dd3tyXXodXXXnSFZxyiy9b/3dOVbUq BzVc1nuXFwCLYdG6ml4+Ucigh/ygIiKHGGd8Vx+hprr2jeqHzpLeQktTtktpdpDl2UEw aUOC3pQ6AvetgSO5V3msggl8d4nqKO/aXLq0fPSeE35fVwjK5fBqwQkTKY77M01AOkJs hVt+KW/RxRnjDHoA7XemWNMKfhXIVl854FXT09218dyG5lFiZCdWxwMFKvylBhwIJgKj fyWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si23607804edc.286.2020.12.30.10.09.26; Wed, 30 Dec 2020 10:09:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbgL3SHj (ORCPT + 99 others); Wed, 30 Dec 2020 13:07:39 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:54814 "EHLO mailgw02.mediatek.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726644AbgL3SHj (ORCPT ); Wed, 30 Dec 2020 13:07:39 -0500 X-UUID: 56fe371807954201a0b92558a1ae5d3a-20201231 X-UUID: 56fe371807954201a0b92558a1ae5d3a-20201231 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 368335277; Thu, 31 Dec 2020 02:06:32 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 31 Dec 2020 02:06:30 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 31 Dec 2020 02:06:30 +0800 From: To: , CC: , , , , , , , , , , Lorenzo Bianconi Subject: [PATCH -next v4 01/13] mt76: mt7921: add module support Date: Thu, 31 Dec 2020 02:06:12 +0800 Message-ID: <6efa97c619a5d2d2030c3f0c0da8e8a19b107feb.1609347310.git.objelf@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 737F51C9DF3BDAFE8A554919884B5D576B618563AB0B44AE298FD38779BB962C2000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Add mt7921 as the pci driver module. The purpose of the patch is to check about if the following patches are able to compile properly. Co-developed-by: Lorenzo Bianconi Signed-off-by: Lorenzo Bianconi Co-developed-by: Soul Huang Signed-off-by: Soul Huang Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/Kconfig | 1 + drivers/net/wireless/mediatek/mt76/Makefile | 1 + .../net/wireless/mediatek/mt76/mt7921/Kconfig | 10 +++ .../wireless/mediatek/mt76/mt7921/Makefile | 5 ++ .../net/wireless/mediatek/mt76/mt7921/pci.c | 63 +++++++++++++++++++ 5 files changed, 80 insertions(+) create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/Kconfig create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/Makefile create mode 100644 drivers/net/wireless/mediatek/mt76/mt7921/pci.c diff --git a/drivers/net/wireless/mediatek/mt76/Kconfig b/drivers/net/wireless/mediatek/mt76/Kconfig index 31015d2a8e7d..5f42ce3267cb 100644 --- a/drivers/net/wireless/mediatek/mt76/Kconfig +++ b/drivers/net/wireless/mediatek/mt76/Kconfig @@ -29,3 +29,4 @@ source "drivers/net/wireless/mediatek/mt76/mt76x2/Kconfig" source "drivers/net/wireless/mediatek/mt76/mt7603/Kconfig" source "drivers/net/wireless/mediatek/mt76/mt7615/Kconfig" source "drivers/net/wireless/mediatek/mt76/mt7915/Kconfig" +source "drivers/net/wireless/mediatek/mt76/mt7921/Kconfig" diff --git a/drivers/net/wireless/mediatek/mt76/Makefile b/drivers/net/wireless/mediatek/mt76/Makefile index e53584db0756..1d72093b61a3 100644 --- a/drivers/net/wireless/mediatek/mt76/Makefile +++ b/drivers/net/wireless/mediatek/mt76/Makefile @@ -31,3 +31,4 @@ obj-$(CONFIG_MT76x2_COMMON) += mt76x2/ obj-$(CONFIG_MT7603E) += mt7603/ obj-$(CONFIG_MT7615_COMMON) += mt7615/ obj-$(CONFIG_MT7915E) += mt7915/ +obj-$(CONFIG_MT7921E) += mt7921/ diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/Kconfig b/drivers/net/wireless/mediatek/mt76/mt7921/Kconfig new file mode 100644 index 000000000000..24932d2e8dee --- /dev/null +++ b/drivers/net/wireless/mediatek/mt76/mt7921/Kconfig @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: ISC +config MT7921E + tristate "MediaTek MT7921E (PCIe) support" + select MT76_CORE + depends on MAC80211 + depends on PCI + help + This adds support for MT7921E 802.11ax 2x2:2SS wireless devices. + + To compile this driver as a module, choose M here. diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/Makefile b/drivers/net/wireless/mediatek/mt76/mt7921/Makefile new file mode 100644 index 000000000000..fa7b42721631 --- /dev/null +++ b/drivers/net/wireless/mediatek/mt76/mt7921/Makefile @@ -0,0 +1,5 @@ +#SPDX-License-Identifier: ISC + +obj-$(CONFIG_MT7921E) += mt7921e.o + +mt7921e-y := pci.o diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c new file mode 100644 index 000000000000..9f003775c4d8 --- /dev/null +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c @@ -0,0 +1,63 @@ +// SPDX-License-Identifier: ISC +/* Copyright (C) 2020 MediaTek Inc. + * + */ + +#include +#include +#include + +static const struct pci_device_id mt7921_pci_device_table[] = { + { PCI_DEVICE(0x14c3, 0x7961) }, + { }, +}; + +static int mt7921_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *id) +{ + int ret; + + ret = pcim_enable_device(pdev); + if (ret) + return ret; + + ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev)); + if (ret) + return ret; + + pci_set_master(pdev); + + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_LEGACY); + if (ret < 0) + return ret; + + ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); + if (ret) + goto err_free_pci_vec; + + return 0; + +err_free_pci_vec: + pci_free_irq_vectors(pdev); + + return ret; +} + +static void mt7921_pci_remove(struct pci_dev *pdev) +{ + pci_free_irq_vectors(pdev); +} + +struct pci_driver mt7921_pci_driver = { + .name = KBUILD_MODNAME, + .id_table = mt7921_pci_device_table, + .probe = mt7921_pci_probe, + .remove = mt7921_pci_remove, +}; + +module_pci_driver(mt7921_pci_driver); + +MODULE_DEVICE_TABLE(pci, mt7921_pci_device_table); +MODULE_AUTHOR("Sean Wang "); +MODULE_AUTHOR("Lorenzo Bianconi "); +MODULE_LICENSE("Dual BSD/GPL"); -- 2.25.1