2005-05-13 02:54:16 +00:00
|
|
|
#define PRISM2_PCI
|
|
|
|
|
|
|
|
/* Host AP driver's support for Intersil Prism2.5 PCI cards is based on
|
|
|
|
* driver patches from Reyk Floeter <reyk@vantronix.net> and
|
|
|
|
* Andy Warner <andyw@pobox.com> */
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/if.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/netdevice.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2005-05-13 02:54:16 +00:00
|
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <linux/wireless.h>
|
|
|
|
#include <net/iw_handler.h>
|
|
|
|
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
#include "hostap_wlan.h"
|
|
|
|
|
|
|
|
|
|
|
|
static char *dev_info = "hostap_pci";
|
|
|
|
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Jouni Malinen");
|
|
|
|
MODULE_DESCRIPTION("Support for Intersil Prism2.5-based 802.11 wireless LAN "
|
|
|
|
"PCI cards.");
|
|
|
|
MODULE_SUPPORTED_DEVICE("Intersil Prism2.5-based WLAN PCI cards");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
|
|
|
2005-08-15 02:08:41 +00:00
|
|
|
/* struct local_info::hw_priv */
|
|
|
|
struct hostap_pci_priv {
|
|
|
|
void __iomem *mem_start;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-05-13 02:54:16 +00:00
|
|
|
/* FIX: do we need mb/wmb/rmb with memory operations? */
|
|
|
|
|
|
|
|
|
2010-01-07 11:58:11 +00:00
|
|
|
static DEFINE_PCI_DEVICE_TABLE(prism2_pci_id_table) = {
|
2005-05-13 02:54:16 +00:00
|
|
|
/* Intersil Prism3 ISL3872 11Mb/s WLAN Controller */
|
|
|
|
{ 0x1260, 0x3872, PCI_ANY_ID, PCI_ANY_ID },
|
|
|
|
/* Intersil Prism2.5 ISL3874 11Mb/s WLAN Controller */
|
|
|
|
{ 0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID },
|
|
|
|
/* Samsung MagicLAN SWL-2210P */
|
|
|
|
{ 0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef PRISM2_IO_DEBUG
|
|
|
|
|
|
|
|
static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-10-03 00:18:59 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
local_info_t *local;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
iface = netdev_priv(dev);
|
|
|
|
local = iface->local;
|
2005-10-03 00:18:59 +00:00
|
|
|
hw_priv = local->hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
spin_lock_irqsave(&local->lock, flags);
|
|
|
|
prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
|
2005-08-15 02:08:41 +00:00
|
|
|
writeb(v, hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
spin_unlock_irqrestore(&local->lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-10-03 00:18:59 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
local_info_t *local;
|
|
|
|
unsigned long flags;
|
|
|
|
u8 v;
|
|
|
|
|
|
|
|
iface = netdev_priv(dev);
|
|
|
|
local = iface->local;
|
2005-10-03 00:18:59 +00:00
|
|
|
hw_priv = local->hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
spin_lock_irqsave(&local->lock, flags);
|
2005-08-15 02:08:41 +00:00
|
|
|
v = readb(hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
|
|
|
|
spin_unlock_irqrestore(&local->lock, flags);
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-10-03 00:18:59 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
local_info_t *local;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
iface = netdev_priv(dev);
|
|
|
|
local = iface->local;
|
2005-10-03 00:18:59 +00:00
|
|
|
hw_priv = local->hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
spin_lock_irqsave(&local->lock, flags);
|
|
|
|
prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
|
2005-08-15 02:08:41 +00:00
|
|
|
writew(v, hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
spin_unlock_irqrestore(&local->lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-10-03 00:18:59 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
local_info_t *local;
|
|
|
|
unsigned long flags;
|
|
|
|
u16 v;
|
|
|
|
|
|
|
|
iface = netdev_priv(dev);
|
|
|
|
local = iface->local;
|
2005-10-03 00:18:59 +00:00
|
|
|
hw_priv = local->hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
spin_lock_irqsave(&local->lock, flags);
|
2005-08-15 02:08:41 +00:00
|
|
|
v = readw(hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
|
|
|
|
spin_unlock_irqrestore(&local->lock, flags);
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
|
|
|
|
#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
|
|
|
|
#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
|
|
|
|
#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
|
2007-12-21 08:30:16 +00:00
|
|
|
#define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), le16_to_cpu((v)))
|
|
|
|
#define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw_debug(dev, (a)))
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
#else /* PRISM2_IO_DEBUG */
|
|
|
|
|
|
|
|
static inline void hfa384x_outb(struct net_device *dev, int a, u8 v)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-08-15 02:08:41 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
iface = netdev_priv(dev);
|
2005-08-15 02:08:41 +00:00
|
|
|
hw_priv = iface->local->hw_priv;
|
|
|
|
writeb(v, hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline u8 hfa384x_inb(struct net_device *dev, int a)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-08-15 02:08:41 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
iface = netdev_priv(dev);
|
2005-08-15 02:08:41 +00:00
|
|
|
hw_priv = iface->local->hw_priv;
|
|
|
|
return readb(hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void hfa384x_outw(struct net_device *dev, int a, u16 v)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-08-15 02:08:41 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
iface = netdev_priv(dev);
|
2005-08-15 02:08:41 +00:00
|
|
|
hw_priv = iface->local->hw_priv;
|
|
|
|
writew(v, hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16 hfa384x_inw(struct net_device *dev, int a)
|
|
|
|
{
|
|
|
|
struct hostap_interface *iface;
|
2005-08-15 02:08:41 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
iface = netdev_priv(dev);
|
2005-08-15 02:08:41 +00:00
|
|
|
hw_priv = iface->local->hw_priv;
|
|
|
|
return readw(hw_priv->mem_start + a);
|
2005-05-13 02:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define HFA384X_OUTB(v,a) hfa384x_outb(dev, (a), (v))
|
|
|
|
#define HFA384X_INB(a) hfa384x_inb(dev, (a))
|
|
|
|
#define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v))
|
|
|
|
#define HFA384X_INW(a) hfa384x_inw(dev, (a))
|
2007-12-21 08:30:16 +00:00
|
|
|
#define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), le16_to_cpu((v)))
|
|
|
|
#define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw(dev, (a)))
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
#endif /* PRISM2_IO_DEBUG */
|
|
|
|
|
|
|
|
|
|
|
|
static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
|
|
|
|
int len)
|
|
|
|
{
|
|
|
|
u16 d_off;
|
2007-12-21 08:30:16 +00:00
|
|
|
__le16 *pos;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
|
2007-12-21 08:30:16 +00:00
|
|
|
pos = (__le16 *) buf;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
for ( ; len > 1; len -= 2)
|
|
|
|
*pos++ = HFA384X_INW_DATA(d_off);
|
|
|
|
|
|
|
|
if (len & 1)
|
|
|
|
*((char *) pos) = HFA384X_INB(d_off);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
|
|
|
|
{
|
|
|
|
u16 d_off;
|
2007-12-21 08:30:16 +00:00
|
|
|
__le16 *pos;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
|
2007-12-21 08:30:16 +00:00
|
|
|
pos = (__le16 *) buf;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
for ( ; len > 1; len -= 2)
|
|
|
|
HFA384X_OUTW_DATA(*pos++, d_off);
|
|
|
|
|
|
|
|
if (len & 1)
|
|
|
|
HFA384X_OUTB(*((char *) pos), d_off);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* FIX: This might change at some point.. */
|
|
|
|
#include "hostap_hw.c"
|
|
|
|
|
|
|
|
static void prism2_pci_cor_sreset(local_info_t *local)
|
|
|
|
{
|
|
|
|
struct net_device *dev = local->dev;
|
|
|
|
u16 reg;
|
|
|
|
|
|
|
|
reg = HFA384X_INB(HFA384X_PCICOR_OFF);
|
|
|
|
printk(KERN_DEBUG "%s: Original COR value: 0x%0x\n", dev->name, reg);
|
|
|
|
|
|
|
|
/* linux-wlan-ng uses extremely long hold and settle times for
|
|
|
|
* COR sreset. A comment in the driver code mentions that the long
|
|
|
|
* delays appear to be necessary. However, at least IBM 22P6901 seems
|
|
|
|
* to work fine with shorter delays.
|
|
|
|
*
|
|
|
|
* Longer delays can be configured by uncommenting following line: */
|
|
|
|
/* #define PRISM2_PCI_USE_LONG_DELAYS */
|
|
|
|
|
|
|
|
#ifdef PRISM2_PCI_USE_LONG_DELAYS
|
|
|
|
int i;
|
|
|
|
|
|
|
|
HFA384X_OUTW(reg | 0x0080, HFA384X_PCICOR_OFF);
|
|
|
|
mdelay(250);
|
|
|
|
|
|
|
|
HFA384X_OUTW(reg & ~0x0080, HFA384X_PCICOR_OFF);
|
|
|
|
mdelay(500);
|
|
|
|
|
|
|
|
/* Wait for f/w to complete initialization (CMD:BUSY == 0) */
|
|
|
|
i = 2000000 / 10;
|
|
|
|
while ((HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) && --i)
|
|
|
|
udelay(10);
|
|
|
|
|
|
|
|
#else /* PRISM2_PCI_USE_LONG_DELAYS */
|
|
|
|
|
|
|
|
HFA384X_OUTW(reg | 0x0080, HFA384X_PCICOR_OFF);
|
|
|
|
mdelay(2);
|
|
|
|
HFA384X_OUTW(reg & ~0x0080, HFA384X_PCICOR_OFF);
|
|
|
|
mdelay(2);
|
|
|
|
|
|
|
|
#endif /* PRISM2_PCI_USE_LONG_DELAYS */
|
|
|
|
|
|
|
|
if (HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) {
|
|
|
|
printk(KERN_DEBUG "%s: COR sreset timeout\n", dev->name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void prism2_pci_genesis_reset(local_info_t *local, int hcr)
|
|
|
|
{
|
|
|
|
struct net_device *dev = local->dev;
|
|
|
|
|
|
|
|
HFA384X_OUTW(0x00C5, HFA384X_PCICOR_OFF);
|
|
|
|
mdelay(10);
|
|
|
|
HFA384X_OUTW(hcr, HFA384X_PCIHCR_OFF);
|
|
|
|
mdelay(10);
|
|
|
|
HFA384X_OUTW(0x0045, HFA384X_PCICOR_OFF);
|
|
|
|
mdelay(10);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static struct prism2_helper_functions prism2_pci_funcs =
|
|
|
|
{
|
|
|
|
.card_present = NULL,
|
|
|
|
.cor_sreset = prism2_pci_cor_sreset,
|
|
|
|
.genesis_reset = prism2_pci_genesis_reset,
|
|
|
|
.hw_type = HOSTAP_HW_PCI,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int prism2_pci_probe(struct pci_dev *pdev,
|
|
|
|
const struct pci_device_id *id)
|
|
|
|
{
|
|
|
|
unsigned long phymem;
|
|
|
|
void __iomem *mem = NULL;
|
|
|
|
local_info_t *local = NULL;
|
|
|
|
struct net_device *dev = NULL;
|
|
|
|
static int cards_found /* = 0 */;
|
|
|
|
int irq_registered = 0;
|
|
|
|
struct hostap_interface *iface;
|
2005-08-15 02:08:41 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
|
|
|
|
2006-12-02 11:33:40 +00:00
|
|
|
hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
|
2005-08-15 02:08:41 +00:00
|
|
|
if (hw_priv == NULL)
|
|
|
|
return -ENOMEM;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
if (pci_enable_device(pdev))
|
2006-03-20 03:21:49 +00:00
|
|
|
goto err_out_free;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
phymem = pci_resource_start(pdev, 0);
|
|
|
|
|
|
|
|
if (!request_mem_region(phymem, pci_resource_len(pdev, 0), "Prism2")) {
|
|
|
|
printk(KERN_ERR "prism2: Cannot reserve PCI memory region\n");
|
|
|
|
goto err_out_disable;
|
|
|
|
}
|
|
|
|
|
2008-10-21 04:42:39 +00:00
|
|
|
mem = pci_ioremap_bar(pdev, 0);
|
2005-05-13 02:54:16 +00:00
|
|
|
if (mem == NULL) {
|
|
|
|
printk(KERN_ERR "prism2: Cannot remap PCI memory region\n") ;
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2005-07-30 19:49:58 +00:00
|
|
|
dev = prism2_init_local_data(&prism2_pci_funcs, cards_found,
|
|
|
|
&pdev->dev);
|
2005-05-13 02:54:16 +00:00
|
|
|
if (dev == NULL)
|
|
|
|
goto fail;
|
|
|
|
iface = netdev_priv(dev);
|
|
|
|
local = iface->local;
|
2005-08-15 02:08:41 +00:00
|
|
|
local->hw_priv = hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
cards_found++;
|
|
|
|
|
|
|
|
dev->irq = pdev->irq;
|
2005-08-15 02:08:41 +00:00
|
|
|
hw_priv->mem_start = mem;
|
2010-07-13 18:06:32 +00:00
|
|
|
dev->base_addr = (unsigned long) mem;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
prism2_pci_cor_sreset(local);
|
|
|
|
|
|
|
|
pci_set_drvdata(pdev, dev);
|
|
|
|
|
2006-07-02 02:29:39 +00:00
|
|
|
if (request_irq(dev->irq, prism2_interrupt, IRQF_SHARED, dev->name,
|
2005-05-13 02:54:16 +00:00
|
|
|
dev)) {
|
|
|
|
printk(KERN_WARNING "%s: request_irq failed\n", dev->name);
|
|
|
|
goto fail;
|
|
|
|
} else
|
|
|
|
irq_registered = 1;
|
|
|
|
|
|
|
|
if (!local->pri_only && prism2_hw_config(dev, 1)) {
|
|
|
|
printk(KERN_DEBUG "%s: hardware initialization failed\n",
|
|
|
|
dev_info);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
printk(KERN_INFO "%s: Intersil Prism2.5 PCI: "
|
|
|
|
"mem=0x%lx, irq=%d\n", dev->name, phymem, dev->irq);
|
|
|
|
|
|
|
|
return hostap_hw_ready(dev);
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (irq_registered && dev)
|
|
|
|
free_irq(dev->irq, dev);
|
|
|
|
|
|
|
|
if (mem)
|
|
|
|
iounmap(mem);
|
|
|
|
|
|
|
|
release_mem_region(phymem, pci_resource_len(pdev, 0));
|
|
|
|
|
|
|
|
err_out_disable:
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
prism2_free_local_data(dev);
|
2006-03-20 03:21:49 +00:00
|
|
|
|
|
|
|
err_out_free:
|
2005-10-03 00:19:00 +00:00
|
|
|
kfree(hw_priv);
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void prism2_pci_remove(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct net_device *dev;
|
|
|
|
struct hostap_interface *iface;
|
|
|
|
void __iomem *mem_start;
|
2005-08-15 02:08:41 +00:00
|
|
|
struct hostap_pci_priv *hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
dev = pci_get_drvdata(pdev);
|
|
|
|
iface = netdev_priv(dev);
|
2005-08-15 02:08:41 +00:00
|
|
|
hw_priv = iface->local->hw_priv;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
/* Reset the hardware, and ensure interrupts are disabled. */
|
|
|
|
prism2_pci_cor_sreset(iface->local);
|
|
|
|
hfa384x_disable_interrupts(dev);
|
|
|
|
|
|
|
|
if (dev->irq)
|
|
|
|
free_irq(dev->irq, dev);
|
|
|
|
|
2005-08-15 02:08:41 +00:00
|
|
|
mem_start = hw_priv->mem_start;
|
2005-05-13 02:54:16 +00:00
|
|
|
prism2_free_local_data(dev);
|
2005-10-03 00:19:00 +00:00
|
|
|
kfree(hw_priv);
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
iounmap(mem_start);
|
|
|
|
|
|
|
|
release_mem_region(pci_resource_start(pdev, 0),
|
|
|
|
pci_resource_len(pdev, 0));
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
2005-07-13 07:33:46 +00:00
|
|
|
static int prism2_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
2005-05-13 02:54:16 +00:00
|
|
|
{
|
|
|
|
struct net_device *dev = pci_get_drvdata(pdev);
|
|
|
|
|
|
|
|
if (netif_running(dev)) {
|
|
|
|
netif_stop_queue(dev);
|
|
|
|
netif_device_detach(dev);
|
|
|
|
}
|
|
|
|
prism2_suspend(dev);
|
|
|
|
pci_save_state(pdev);
|
|
|
|
pci_disable_device(pdev);
|
2005-09-03 22:56:58 +00:00
|
|
|
pci_set_power_state(pdev, PCI_D3hot);
|
2005-05-13 02:54:16 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int prism2_pci_resume(struct pci_dev *pdev)
|
|
|
|
{
|
|
|
|
struct net_device *dev = pci_get_drvdata(pdev);
|
2006-11-08 01:53:48 +00:00
|
|
|
int err;
|
2005-05-13 02:54:16 +00:00
|
|
|
|
2006-11-08 01:53:48 +00:00
|
|
|
err = pci_enable_device(pdev);
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
|
|
|
|
dev->name);
|
|
|
|
return err;
|
|
|
|
}
|
2005-05-13 02:54:16 +00:00
|
|
|
pci_restore_state(pdev);
|
|
|
|
prism2_hw_config(dev, 0);
|
|
|
|
if (netif_running(dev)) {
|
|
|
|
netif_device_attach(dev);
|
|
|
|
netif_start_queue(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_PM */
|
|
|
|
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(pci, prism2_pci_id_table);
|
|
|
|
|
2007-10-29 18:20:26 +00:00
|
|
|
static struct pci_driver prism2_pci_driver = {
|
2005-09-24 04:58:58 +00:00
|
|
|
.name = "hostap_pci",
|
2005-05-13 02:54:16 +00:00
|
|
|
.id_table = prism2_pci_id_table,
|
|
|
|
.probe = prism2_pci_probe,
|
|
|
|
.remove = prism2_pci_remove,
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
.suspend = prism2_pci_suspend,
|
|
|
|
.resume = prism2_pci_resume,
|
|
|
|
#endif /* CONFIG_PM */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int __init init_prism2_pci(void)
|
|
|
|
{
|
2007-10-29 18:20:26 +00:00
|
|
|
return pci_register_driver(&prism2_pci_driver);
|
2005-05-13 02:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void __exit exit_prism2_pci(void)
|
|
|
|
{
|
2007-10-29 18:20:26 +00:00
|
|
|
pci_unregister_driver(&prism2_pci_driver);
|
2005-05-13 02:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module_init(init_prism2_pci);
|
|
|
|
module_exit(exit_prism2_pci);
|