1 // SPDX-License-Identifier: ISC
3 #include <linux/kernel.h>
4 #include <linux/module.h>
9 static const struct pci_device_id mt76pci_device_table
[] = {
10 { PCI_DEVICE(0x14c3, 0x7603) },
15 mt76pci_probe(struct pci_dev
*pdev
, const struct pci_device_id
*id
)
17 struct mt7603_dev
*dev
;
18 struct mt76_dev
*mdev
;
21 ret
= pcim_enable_device(pdev
);
25 ret
= pcim_iomap_regions(pdev
, BIT(0), pci_name(pdev
));
31 ret
= pci_set_dma_mask(pdev
, DMA_BIT_MASK(32));
35 mdev
= mt76_alloc_device(&pdev
->dev
, sizeof(*dev
), &mt7603_ops
,
40 dev
= container_of(mdev
, struct mt7603_dev
, mt76
);
41 mt76_mmio_init(mdev
, pcim_iomap_table(pdev
)[0]);
43 mdev
->rev
= (mt76_rr(dev
, MT_HW_CHIPID
) << 16) |
44 (mt76_rr(dev
, MT_HW_REV
) & 0xff);
45 dev_info(mdev
->dev
, "ASIC revision: %04x\n", mdev
->rev
);
47 mt76_wr(dev
, MT_INT_MASK_CSR
, 0);
49 ret
= devm_request_irq(mdev
->dev
, pdev
->irq
, mt7603_irq_handler
,
50 IRQF_SHARED
, KBUILD_MODNAME
, dev
);
54 ret
= mt7603_register_device(dev
);
60 mt76_free_device(&dev
->mt76
);
66 mt76pci_remove(struct pci_dev
*pdev
)
68 struct mt76_dev
*mdev
= pci_get_drvdata(pdev
);
69 struct mt7603_dev
*dev
= container_of(mdev
, struct mt7603_dev
, mt76
);
71 mt7603_unregister_device(dev
);
74 MODULE_DEVICE_TABLE(pci
, mt76pci_device_table
);
75 MODULE_FIRMWARE(MT7603_FIRMWARE_E1
);
76 MODULE_FIRMWARE(MT7603_FIRMWARE_E2
);
78 struct pci_driver mt7603_pci_driver
= {
79 .name
= KBUILD_MODNAME
,
80 .id_table
= mt76pci_device_table
,
81 .probe
= mt76pci_probe
,
82 .remove
= mt76pci_remove
,