1 /* Synopsys DesignWare Core Enterprise Ethernet (XLGMAC) Driver
3 * Copyright (c) 2017 Synopsys, Inc. (www.synopsys.com)
5 * This program is dual-licensed; you may select either version 2 of
6 * the GNU General Public License ("GPL") or BSD license ("BSD").
8 * This Synopsys DWC XLGMAC software driver and associated documentation
9 * (hereinafter the "Software") is an unsupported proprietary work of
10 * Synopsys, Inc. unless otherwise expressly agreed to in writing between
11 * Synopsys and you. The Software IS NOT an item of Licensed Software or a
12 * Licensed Product under any End User Software License Agreement or
13 * Agreement for Licensed Products with Synopsys or any supplement thereto.
14 * Synopsys is a registered trademark of Synopsys, Inc. Other names included
15 * in the SOFTWARE may be the trademarks of their respective owners.
18 #include <linux/kernel.h>
19 #include <linux/module.h>
20 #include <linux/pci.h>
22 #include "dwc-xlgmac.h"
23 #include "dwc-xlgmac-reg.h"
25 static int xlgmac_probe(struct pci_dev
*pcidev
, const struct pci_device_id
*id
)
27 struct device
*dev
= &pcidev
->dev
;
28 struct xlgmac_resources res
;
31 ret
= pcim_enable_device(pcidev
);
33 dev_err(dev
, "ERROR: failed to enable device\n");
37 for (i
= 0; i
< PCI_STD_NUM_BARS
; i
++) {
38 if (pci_resource_len(pcidev
, i
) == 0)
40 ret
= pcim_iomap_regions(pcidev
, BIT(i
), XLGMAC_DRV_NAME
);
46 pci_set_master(pcidev
);
48 memset(&res
, 0, sizeof(res
));
49 res
.irq
= pcidev
->irq
;
50 res
.addr
= pcim_iomap_table(pcidev
)[i
];
52 return xlgmac_drv_probe(&pcidev
->dev
, &res
);
55 static void xlgmac_remove(struct pci_dev
*pcidev
)
57 xlgmac_drv_remove(&pcidev
->dev
);
60 static const struct pci_device_id xlgmac_pci_tbl
[] = {
61 { PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS
, 0x7302) },
64 MODULE_DEVICE_TABLE(pci
, xlgmac_pci_tbl
);
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
,
73 module_pci_driver(xlgmac_pci_driver
);
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");