linux/drivers/net/wireless/atmel/atmel_pci.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-or-later
   2/*** -*- linux-c -*- **********************************************************
   3
   4     Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
   5
   6         Copyright 2004 Simon Kelley.
   7
   8
   9******************************************************************************/
  10#include <linux/pci.h>
  11#include <linux/kernel.h>
  12#include <linux/module.h>
  13#include <linux/netdevice.h>
  14#include "atmel.h"
  15
  16MODULE_AUTHOR("Simon Kelley");
  17MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
  18MODULE_LICENSE("GPL");
  19MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards");
  20
  21static const struct pci_device_id card_ids[] = {
  22        { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
  23        { 0, }
  24};
  25
  26MODULE_DEVICE_TABLE(pci, card_ids);
  27
  28static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
  29static void atmel_pci_remove(struct pci_dev *);
  30
  31static struct pci_driver atmel_driver = {
  32        .name     = "atmel",
  33        .id_table = card_ids,
  34        .probe    = atmel_pci_probe,
  35        .remove   = atmel_pci_remove,
  36};
  37
  38
  39static int atmel_pci_probe(struct pci_dev *pdev,
  40                                     const struct pci_device_id *pent)
  41{
  42        struct net_device *dev;
  43
  44        if (pci_enable_device(pdev))
  45                return -ENODEV;
  46
  47        pci_set_master(pdev);
  48
  49        dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
  50                              ATMEL_FW_TYPE_506,
  51                              &pdev->dev, NULL, NULL);
  52        if (!dev) {
  53                pci_disable_device(pdev);
  54                return -ENODEV;
  55        }
  56
  57        pci_set_drvdata(pdev, dev);
  58        return 0;
  59}
  60
  61static void atmel_pci_remove(struct pci_dev *pdev)
  62{
  63        stop_atmel_card(pci_get_drvdata(pdev));
  64}
  65
  66module_pci_driver(atmel_driver);
  67