atmel_pci.c 1.6 KB

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