atmel_pci.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*** -*- linux-c -*- **********************************************************
  2. Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
  3. Copyright 2004 Simon Kelley.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This software is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with Atmel wireless lan drivers; if not, see
  14. <http://www.gnu.org/licenses/>.
  15. ******************************************************************************/
  16. #include <linux/pci.h>
  17. #include <linux/kernel.h>
  18. #include <linux/module.h>
  19. #include <linux/netdevice.h>
  20. #include "atmel.h"
  21. MODULE_AUTHOR("Simon Kelley");
  22. MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
  23. MODULE_LICENSE("GPL");
  24. MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards");
  25. static const struct pci_device_id card_ids[] = {
  26. { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
  27. { 0, }
  28. };
  29. MODULE_DEVICE_TABLE(pci, card_ids);
  30. static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
  31. static void atmel_pci_remove(struct pci_dev *);
  32. static struct pci_driver atmel_driver = {
  33. .name = "atmel",
  34. .id_table = card_ids,
  35. .probe = atmel_pci_probe,
  36. .remove = atmel_pci_remove,
  37. };
  38. static int atmel_pci_probe(struct pci_dev *pdev,
  39. const struct pci_device_id *pent)
  40. {
  41. struct net_device *dev;
  42. if (pci_enable_device(pdev))
  43. return -ENODEV;
  44. pci_set_master(pdev);
  45. dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
  46. ATMEL_FW_TYPE_506,
  47. &pdev->dev, NULL, NULL);
  48. if (!dev) {
  49. pci_disable_device(pdev);
  50. return -ENODEV;
  51. }
  52. pci_set_drvdata(pdev, dev);
  53. return 0;
  54. }
  55. static void atmel_pci_remove(struct pci_dev *pdev)
  56. {
  57. stop_atmel_card(pci_get_drvdata(pdev));
  58. }
  59. module_pci_driver(atmel_driver);