This source file includes following definitions.
- xlgmac_probe
- xlgmac_remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <linux/kernel.h>
19 #include <linux/module.h>
20 #include <linux/pci.h>
21
22 #include "dwc-xlgmac.h"
23 #include "dwc-xlgmac-reg.h"
24
25 static int xlgmac_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
26 {
27 struct device *dev = &pcidev->dev;
28 struct xlgmac_resources res;
29 int i, ret;
30
31 ret = pcim_enable_device(pcidev);
32 if (ret) {
33 dev_err(dev, "ERROR: failed to enable device\n");
34 return ret;
35 }
36
37 for (i = 0; i <= PCI_STD_RESOURCE_END; i++) {
38 if (pci_resource_len(pcidev, i) == 0)
39 continue;
40 ret = pcim_iomap_regions(pcidev, BIT(i), XLGMAC_DRV_NAME);
41 if (ret)
42 return ret;
43 break;
44 }
45
46 pci_set_master(pcidev);
47
48 memset(&res, 0, sizeof(res));
49 res.irq = pcidev->irq;
50 res.addr = pcim_iomap_table(pcidev)[i];
51
52 return xlgmac_drv_probe(&pcidev->dev, &res);
53 }
54
55 static void xlgmac_remove(struct pci_dev *pcidev)
56 {
57 xlgmac_drv_remove(&pcidev->dev);
58 }
59
60 static const struct pci_device_id xlgmac_pci_tbl[] = {
61 { PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, 0x7302) },
62 { 0 }
63 };
64 MODULE_DEVICE_TABLE(pci, xlgmac_pci_tbl);
65
66 static struct pci_driver xlgmac_pci_driver = {
67 .name = XLGMAC_DRV_NAME,
68 .id_table = xlgmac_pci_tbl,
69 .probe = xlgmac_probe,
70 .remove = xlgmac_remove,
71 };
72
73 module_pci_driver(xlgmac_pci_driver);
74
75 MODULE_DESCRIPTION(XLGMAC_DRV_DESC);
76 MODULE_VERSION(XLGMAC_DRV_VERSION);
77 MODULE_AUTHOR("Jie Deng <jiedeng@synopsys.com>");
78 MODULE_LICENSE("Dual BSD/GPL");