Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*** -*- linux-c -*- **********************************************************
0003 
0004      Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
0005 
0006          Copyright 2004 Simon Kelley.
0007 
0008 
0009 ******************************************************************************/
0010 #include <linux/pci.h>
0011 #include <linux/kernel.h>
0012 #include <linux/module.h>
0013 #include <linux/netdevice.h>
0014 #include "atmel.h"
0015 
0016 MODULE_AUTHOR("Simon Kelley");
0017 MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
0018 MODULE_LICENSE("GPL");
0019 
0020 static const struct pci_device_id card_ids[] = {
0021     { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
0022     { 0, }
0023 };
0024 
0025 MODULE_DEVICE_TABLE(pci, card_ids);
0026 
0027 static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
0028 static void atmel_pci_remove(struct pci_dev *);
0029 
0030 static struct pci_driver atmel_driver = {
0031     .name     = "atmel",
0032     .id_table = card_ids,
0033     .probe    = atmel_pci_probe,
0034     .remove   = atmel_pci_remove,
0035 };
0036 
0037 
0038 static int atmel_pci_probe(struct pci_dev *pdev,
0039                      const struct pci_device_id *pent)
0040 {
0041     struct net_device *dev;
0042 
0043     if (pci_enable_device(pdev))
0044         return -ENODEV;
0045 
0046     pci_set_master(pdev);
0047 
0048     dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
0049                   ATMEL_FW_TYPE_506,
0050                   &pdev->dev, NULL, NULL);
0051     if (!dev) {
0052         pci_disable_device(pdev);
0053         return -ENODEV;
0054     }
0055 
0056     pci_set_drvdata(pdev, dev);
0057     return 0;
0058 }
0059 
0060 static void atmel_pci_remove(struct pci_dev *pdev)
0061 {
0062     stop_atmel_card(pci_get_drvdata(pdev));
0063 }
0064 
0065 module_pci_driver(atmel_driver);