blob: 47f7ccb32414e9ccad453f22361beba23842b13e [file] [log] [blame]
Thomas Gleixnerf4f6a4a2019-05-23 11:14:43 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*** -*- linux-c -*- **********************************************************
3
4 Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
5
6 Copyright 2004 Simon Kelley.
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <linux/pci.h>
11#include <linux/kernel.h>
12#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#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
Benoit Taine9baa3c32014-08-08 15:56:03 +020021static const struct pci_device_id card_ids[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 { 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,
Bill Pemberton991683c2012-12-03 09:56:29 -050035 .remove = atmel_pci_remove,
Linus Torvalds1da177e2005-04-16 15:20:36 -070036};
37
38
Bill Pemberton991683c2012-12-03 09:56:29 -050039static int atmel_pci_probe(struct pci_dev *pdev,
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 const struct pci_device_id *pent)
41{
42 struct net_device *dev;
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040043
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 if (pci_enable_device(pdev))
45 return -ENODEV;
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040046
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 pci_set_master(pdev);
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040048
49 dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 ATMEL_FW_TYPE_506,
51 &pdev->dev, NULL, NULL);
YueHaibing88027c8f2018-05-23 18:34:45 +080052 if (!dev) {
53 pci_disable_device(pdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054 return -ENODEV;
YueHaibing88027c8f2018-05-23 18:34:45 +080055 }
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040056
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 pci_set_drvdata(pdev, dev);
58 return 0;
59}
60
Bill Pemberton991683c2012-12-03 09:56:29 -050061static void atmel_pci_remove(struct pci_dev *pdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070062{
simon@thekelleys.org.ukb16a2282005-10-30 15:50:15 +000063 stop_atmel_card(pci_get_drvdata(pdev));
Linus Torvalds1da177e2005-04-16 15:20:36 -070064}
65
Axel Lin5b0a3b72012-04-14 10:38:36 +080066module_pci_driver(atmel_driver);