2 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <linux/kernel.h>
18 #include <linux/module.h>
19 #include <linux/pci.h>
25 mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
27 struct mt76x0_dev *dev;
30 ret = pcim_enable_device(pdev);
34 ret = pcim_iomap_regions(pdev, BIT(0), pci_name(pdev));
40 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
44 dev = mt76x0_alloc_device(&pdev->dev, NULL);
48 mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
50 dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION);
51 dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev);
53 ret = mt76x0e_mcu_init(dev);
60 ieee80211_free_hw(mt76_hw(dev));
65 mt76x0e_remove(struct pci_dev *pdev)
67 struct mt76_dev *mdev = pci_get_drvdata(pdev);
69 mt76_unregister_device(mdev);
70 ieee80211_free_hw(mdev->hw);
73 static const struct pci_device_id mt76x0e_device_table[] = {
74 { PCI_DEVICE(0x14c3, 0x7630) },
75 { PCI_DEVICE(0x14c3, 0x7650) },
79 MODULE_DEVICE_TABLE(pci, mt76x0e_device_table);
80 MODULE_LICENSE("Dual BSD/GPL");
82 static struct pci_driver mt76x0e_driver = {
83 .name = KBUILD_MODNAME,
84 .id_table = mt76x0e_device_table,
85 .probe = mt76x0e_probe,
86 .remove = mt76x0e_remove,
89 module_pci_driver(mt76x0e_driver);