2005-04-16 16:20:36 -06:00
|
|
|
/*======================================================================
|
|
|
|
|
|
|
|
Aironet driver for 4500 and 4800 series cards
|
|
|
|
|
|
|
|
This code is released under both the GPL version 2 and BSD licenses.
|
|
|
|
Either license may be used. The respective licenses are found at
|
|
|
|
the end of this file.
|
|
|
|
|
|
|
|
This code was developed by Benjamin Reed <breed@users.sourceforge.net>
|
|
|
|
including portions of which come from the Aironet PC4500
|
|
|
|
Developer's Reference Manual and used with permission. Copyright
|
|
|
|
(C) 1999 Benjamin Reed. All Rights Reserved. Permission to use
|
|
|
|
code in the Developer's manual was granted for this driver by
|
|
|
|
Aironet.
|
|
|
|
|
|
|
|
In addition this module was derived from dummy_cs.
|
|
|
|
The initial developer of dummy_cs is David A. Hinds
|
|
|
|
<dahinds@users.sourceforge.net>. Portions created by David A. Hinds
|
2009-03-06 08:09:41 -07:00
|
|
|
are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
======================================================================*/
|
|
|
|
|
|
|
|
#ifdef __IN_PCMCIA_PACKAGE__
|
|
|
|
#include <pcmcia/k_compat.h>
|
|
|
|
#endif
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/ptrace.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
|
|
|
|
#include <pcmcia/cistpl.h>
|
|
|
|
#include <pcmcia/cisreg.h>
|
|
|
|
#include <pcmcia/ds.h>
|
|
|
|
|
2009-03-06 08:09:41 -07:00
|
|
|
#include <linux/io.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-05 09:42:27 -07:00
|
|
|
#include "airo.h"
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*====================================================================*/
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Benjamin Reed");
|
2009-03-06 08:09:41 -07:00
|
|
|
MODULE_DESCRIPTION("Support for Cisco/Aironet 802.11 wireless ethernet "
|
|
|
|
"cards. This is the module that links the PCMCIA card "
|
|
|
|
"with the airo module.");
|
2005-04-16 16:20:36 -06:00
|
|
|
MODULE_LICENSE("Dual BSD/GPL");
|
|
|
|
MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards");
|
|
|
|
|
|
|
|
/*====================================================================*/
|
|
|
|
|
2006-03-31 08:26:06 -07:00
|
|
|
static int airo_config(struct pcmcia_device *link);
|
2006-03-31 08:21:06 -07:00
|
|
|
static void airo_release(struct pcmcia_device *link);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2005-11-14 13:23:14 -07:00
|
|
|
static void airo_detach(struct pcmcia_device *p_dev);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
typedef struct local_info_t {
|
|
|
|
struct net_device *eth_dev;
|
|
|
|
} local_info_t;
|
|
|
|
|
2006-03-31 08:26:06 -07:00
|
|
|
static int airo_probe(struct pcmcia_device *p_dev)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
local_info_t *local;
|
2005-11-14 13:25:51 -07:00
|
|
|
|
2009-10-24 07:53:36 -06:00
|
|
|
dev_dbg(&p_dev->dev, "airo_attach()\n");
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Allocate space for private device-specific data */
|
2005-11-07 16:03:15 -07:00
|
|
|
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
2013-02-03 10:28:14 -07:00
|
|
|
if (!local)
|
2005-11-14 13:25:51 -07:00
|
|
|
return -ENOMEM;
|
2013-02-03 10:28:14 -07:00
|
|
|
|
2006-03-05 02:45:09 -07:00
|
|
|
p_dev->priv = local;
|
2005-11-14 13:25:51 -07:00
|
|
|
|
2006-03-31 08:26:06 -07:00
|
|
|
return airo_config(p_dev);
|
2005-04-16 16:20:36 -06:00
|
|
|
} /* airo_attach */
|
|
|
|
|
2006-03-31 08:21:06 -07:00
|
|
|
static void airo_detach(struct pcmcia_device *link)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2009-10-24 07:53:36 -06:00
|
|
|
dev_dbg(&link->dev, "airo_detach\n");
|
2005-11-14 13:25:35 -07:00
|
|
|
|
2006-03-01 16:09:29 -07:00
|
|
|
airo_release(link);
|
2005-11-14 13:25:35 -07:00
|
|
|
|
2009-03-06 08:09:41 -07:00
|
|
|
if (((local_info_t *)link->priv)->eth_dev) {
|
|
|
|
stop_airo_card(((local_info_t *)link->priv)->eth_dev, 0);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
2009-03-06 08:09:41 -07:00
|
|
|
((local_info_t *)link->priv)->eth_dev = NULL;
|
2005-11-14 13:23:14 -07:00
|
|
|
|
2005-10-28 14:53:13 -06:00
|
|
|
kfree(link->priv);
|
2005-04-16 16:20:36 -06:00
|
|
|
} /* airo_detach */
|
|
|
|
|
2010-07-30 05:13:46 -06:00
|
|
|
static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data)
|
2008-08-02 06:28:43 -06:00
|
|
|
{
|
2010-07-30 05:13:46 -06:00
|
|
|
if (p_dev->config_index == 0)
|
|
|
|
return -EINVAL;
|
2008-08-02 06:28:43 -06:00
|
|
|
|
2010-07-30 05:13:46 -06:00
|
|
|
return pcmcia_request_io(p_dev);
|
2008-08-02 06:28:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-31 08:26:06 -07:00
|
|
|
static int airo_config(struct pcmcia_device *link)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
local_info_t *dev;
|
2009-10-24 07:53:36 -06:00
|
|
|
int ret;
|
2006-03-31 08:21:06 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
dev = link->priv;
|
|
|
|
|
2009-10-24 07:53:36 -06:00
|
|
|
dev_dbg(&link->dev, "airo_config\n");
|
2006-03-01 16:09:29 -07:00
|
|
|
|
2010-07-30 01:51:52 -06:00
|
|
|
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
|
2010-07-30 05:13:46 -06:00
|
|
|
CONF_AUTO_AUDIO | CONF_AUTO_SET_IO;
|
2010-07-30 01:51:52 -06:00
|
|
|
|
2010-07-28 01:32:02 -06:00
|
|
|
ret = pcmcia_loop_config(link, airo_cs_config_check, NULL);
|
2009-10-24 07:53:36 -06:00
|
|
|
if (ret)
|
2008-08-02 06:28:43 -06:00
|
|
|
goto failed;
|
|
|
|
|
2010-03-07 04:21:16 -07:00
|
|
|
if (!link->irq)
|
|
|
|
goto failed;
|
2009-03-06 08:09:41 -07:00
|
|
|
|
2010-07-29 11:27:09 -06:00
|
|
|
ret = pcmcia_enable_device(link);
|
2009-10-24 07:53:36 -06:00
|
|
|
if (ret)
|
|
|
|
goto failed;
|
2009-03-06 08:09:41 -07:00
|
|
|
((local_info_t *)link->priv)->eth_dev =
|
2010-03-07 04:21:16 -07:00
|
|
|
init_airo_card(link->irq,
|
2010-07-24 07:58:54 -06:00
|
|
|
link->resource[0]->start, 1, &link->dev);
|
2009-03-06 08:09:41 -07:00
|
|
|
if (!((local_info_t *)link->priv)->eth_dev)
|
2009-10-24 07:53:36 -06:00
|
|
|
goto failed;
|
2009-03-06 08:09:41 -07:00
|
|
|
|
2006-03-31 08:26:06 -07:00
|
|
|
return 0;
|
|
|
|
|
2008-08-02 06:28:43 -06:00
|
|
|
failed:
|
2005-04-16 16:20:36 -06:00
|
|
|
airo_release(link);
|
2006-03-31 08:26:06 -07:00
|
|
|
return -ENODEV;
|
2005-04-16 16:20:36 -06:00
|
|
|
} /* airo_config */
|
|
|
|
|
2006-03-31 08:21:06 -07:00
|
|
|
static void airo_release(struct pcmcia_device *link)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2009-10-24 07:53:36 -06:00
|
|
|
dev_dbg(&link->dev, "airo_release\n");
|
2006-03-31 08:21:06 -07:00
|
|
|
pcmcia_disable_device(link);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2006-03-31 08:21:06 -07:00
|
|
|
static int airo_suspend(struct pcmcia_device *link)
|
2005-11-14 13:21:18 -07:00
|
|
|
{
|
|
|
|
local_info_t *local = link->priv;
|
|
|
|
|
2006-03-01 16:09:29 -07:00
|
|
|
netif_device_detach(local->eth_dev);
|
2005-11-14 13:21:18 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-03-31 08:21:06 -07:00
|
|
|
static int airo_resume(struct pcmcia_device *link)
|
2005-11-14 13:21:18 -07:00
|
|
|
{
|
|
|
|
local_info_t *local = link->priv;
|
|
|
|
|
2006-03-01 16:09:29 -07:00
|
|
|
if (link->open) {
|
2005-11-14 13:21:18 -07:00
|
|
|
reset_airo_card(local->eth_dev);
|
|
|
|
netif_device_attach(local->eth_dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-05-03 20:29:01 -06:00
|
|
|
static const struct pcmcia_device_id airo_ids[] = {
|
2005-06-27 17:28:20 -06:00
|
|
|
PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a),
|
|
|
|
PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005),
|
|
|
|
PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0007),
|
|
|
|
PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0007),
|
|
|
|
PCMCIA_DEVICE_NULL,
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pcmcia, airo_ids);
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
static struct pcmcia_driver airo_driver = {
|
|
|
|
.owner = THIS_MODULE,
|
2010-08-08 03:36:26 -06:00
|
|
|
.name = "airo_cs",
|
2006-03-31 08:26:06 -07:00
|
|
|
.probe = airo_probe,
|
2005-11-14 13:23:14 -07:00
|
|
|
.remove = airo_detach,
|
2005-06-27 17:28:20 -06:00
|
|
|
.id_table = airo_ids,
|
2005-11-14 13:21:18 -07:00
|
|
|
.suspend = airo_suspend,
|
|
|
|
.resume = airo_resume,
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
2013-03-06 11:27:43 -07:00
|
|
|
module_pcmcia_driver(airo_driver);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
In addition:
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
3. The name of the author may not be used to endorse or promote
|
|
|
|
products derived from this software without specific prior written
|
|
|
|
permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
|
|
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
2009-03-06 08:09:41 -07:00
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
2005-04-16 16:20:36 -06:00
|
|
|
*/
|