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