mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 05:16:57 +00:00
MediaTek has asked to switch from the ISC license to BSD-3-Clause-Clear, in order to improve clarity and the legal integrity of the code. The BSD-3-Clause license includes the "no endorsement" clause, which is important for protecting the reputation of the original authors and contributors by preventing unauthorized use of their names for endorsement purposes. This clause is absent in the BSD-2-Clause license, which is more permissive but lacks this specific protection. This change also cleans up the license of some Kconfig/Makefile files, which were accidentally marked as GPL. The GPL 2.0 remains in use on mt76x0, as well as two source files in mt7615 for which the license situation still needs to be clarified. Signed-off-by: Felix Fietkau <[email protected]>
84 lines
1.8 KiB
C
84 lines
1.8 KiB
C
// SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/pci.h>
|
|
|
|
#include "mt7603.h"
|
|
|
|
static const struct pci_device_id mt76pci_device_table[] = {
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7603) },
|
|
{ },
|
|
};
|
|
|
|
static int
|
|
mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|
{
|
|
struct mt7603_dev *dev;
|
|
struct mt76_dev *mdev;
|
|
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 = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
|
|
if (ret)
|
|
return ret;
|
|
|
|
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt7603_ops,
|
|
&mt7603_drv_ops);
|
|
if (!mdev)
|
|
return -ENOMEM;
|
|
|
|
dev = container_of(mdev, struct mt7603_dev, mt76);
|
|
mt76_mmio_init(mdev, pcim_iomap_table(pdev)[0]);
|
|
|
|
mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) |
|
|
(mt76_rr(dev, MT_HW_REV) & 0xff);
|
|
dev_info(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
|
|
|
|
mt76_wr(dev, MT_INT_MASK_CSR, 0);
|
|
|
|
ret = devm_request_irq(mdev->dev, pdev->irq, mt7603_irq_handler,
|
|
IRQF_SHARED, KBUILD_MODNAME, dev);
|
|
if (ret)
|
|
goto error;
|
|
|
|
ret = mt7603_register_device(dev);
|
|
if (ret)
|
|
goto error;
|
|
|
|
return 0;
|
|
error:
|
|
mt76_free_device(&dev->mt76);
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void
|
|
mt76pci_remove(struct pci_dev *pdev)
|
|
{
|
|
struct mt76_dev *mdev = pci_get_drvdata(pdev);
|
|
struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
|
|
|
|
mt7603_unregister_device(dev);
|
|
}
|
|
|
|
MODULE_DEVICE_TABLE(pci, mt76pci_device_table);
|
|
MODULE_FIRMWARE(MT7603_FIRMWARE_E1);
|
|
MODULE_FIRMWARE(MT7603_FIRMWARE_E2);
|
|
|
|
struct pci_driver mt7603_pci_driver = {
|
|
.name = KBUILD_MODNAME,
|
|
.id_table = mt76pci_device_table,
|
|
.probe = mt76pci_probe,
|
|
.remove = mt76pci_remove,
|
|
};
|