atmel_pci.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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, write to the Free Software
  14. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. ******************************************************************************/
  16. #include <linux/pci.h>
  17. #include <linux/kernel.h>
  18. #include <linux/module.h>
  19. #include <linux/init.h>
  20. #include <linux/netdevice.h>
  21. #include "atmel.h"
  22. MODULE_AUTHOR("Simon Kelley");
  23. MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
  24. MODULE_LICENSE("GPL");
  25. MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards");
  26. static DEFINE_PCI_DEVICE_TABLE(card_ids) = {
  27. { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
  28. { 0, }
  29. };
  30. MODULE_DEVICE_TABLE(pci, card_ids);
  31. static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
  32. static void atmel_pci_remove(struct pci_dev *);
  33. static struct pci_driver atmel_driver = {
  34. .name = "atmel",
  35. .id_table = card_ids,
  36. .probe = atmel_pci_probe,
  37. .remove = __devexit_p(atmel_pci_remove),
  38. };
  39. static int __devinit atmel_pci_probe(struct pci_dev *pdev,
  40. const struct pci_device_id *pent)
  41. {
  42. struct net_device *dev;
  43. if (pci_enable_device(pdev))
  44. return -ENODEV;
  45. pci_set_master(pdev);
  46. dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
  47. ATMEL_FW_TYPE_506,
  48. &pdev->dev, NULL, NULL);
  49. if (!dev)
  50. return -ENODEV;
  51. pci_set_drvdata(pdev, dev);
  52. return 0;
  53. }
  54. static void __devexit atmel_pci_remove(struct pci_dev *pdev)
  55. {
  56. stop_atmel_card(pci_get_drvdata(pdev));
  57. }
  58. static int __init atmel_init_module(void)
  59. {
  60. return pci_register_driver(&atmel_driver);
  61. }
  62. static void __exit atmel_cleanup_module(void)
  63. {
  64. pci_unregister_driver(&atmel_driver);
  65. }
  66. module_init(atmel_init_module);
  67. module_exit(atmel_cleanup_module);