blob: c1b159ebcffee4412987c4ba1d22cb080c1ea8d4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*** -*- linux-c -*- **********************************************************
2
3 Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
4
5 Copyright 2004 Simon Kelley.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This software is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Atmel wireless lan drivers; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/pci.h>
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/init.h>
26#include <linux/netdevice.h>
27#include "atmel.h"
28
29MODULE_AUTHOR("Simon Kelley");
30MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
31MODULE_LICENSE("GPL");
32MODULE_SUPPORTED_DEVICE("Atmel at76c506 PCI wireless cards");
33
Alexey Dobriyana3aa1882010-01-07 11:58:11 +000034static DEFINE_PCI_DEVICE_TABLE(card_ids) = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 { 0x1114, 0x0506, PCI_ANY_ID, PCI_ANY_ID },
36 { 0, }
37};
38
39MODULE_DEVICE_TABLE(pci, card_ids);
40
41static int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
42static void atmel_pci_remove(struct pci_dev *);
43
44static struct pci_driver atmel_driver = {
45 .name = "atmel",
46 .id_table = card_ids,
47 .probe = atmel_pci_probe,
Bill Pemberton991683c2012-12-03 09:56:29 -050048 .remove = atmel_pci_remove,
Linus Torvalds1da177e2005-04-16 15:20:36 -070049};
50
51
Bill Pemberton991683c2012-12-03 09:56:29 -050052static int atmel_pci_probe(struct pci_dev *pdev,
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 const struct pci_device_id *pent)
54{
55 struct net_device *dev;
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040056
Linus Torvalds1da177e2005-04-16 15:20:36 -070057 if (pci_enable_device(pdev))
58 return -ENODEV;
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040059
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 pci_set_master(pdev);
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040061
62 dev = init_atmel_card(pdev->irq, pdev->resource[1].start,
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 ATMEL_FW_TYPE_506,
64 &pdev->dev, NULL, NULL);
65 if (!dev)
66 return -ENODEV;
Dmitry Torokhov5c877fe2006-10-08 00:14:30 -040067
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 pci_set_drvdata(pdev, dev);
69 return 0;
70}
71
Bill Pemberton991683c2012-12-03 09:56:29 -050072static void atmel_pci_remove(struct pci_dev *pdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070073{
simon@thekelleys.org.ukb16a2282005-10-30 15:50:15 +000074 stop_atmel_card(pci_get_drvdata(pdev));
Linus Torvalds1da177e2005-04-16 15:20:36 -070075}
76
Axel Lin5b0a3b72012-04-14 10:38:36 +080077module_pci_driver(atmel_driver);