"cards (PLX).");
MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PLX)");
MODULE_LICENSE("GPL");
+MODULE_VERSION(PRISM2_VERSION);
static int ignore_cis;
MODULE_PARM_DESC(ignore_cis, "Do not verify manfid information in CIS");
+/* struct local_info::hw_priv */
+struct hostap_plx_priv {
+ void __iomem *attr_mem;
+ unsigned int cor_offset;
+};
+
+
#define PLX_MIN_ATTR_LEN 512 /* at least 2 x 256 is needed for CIS */
#define COR_SRESET 0x80
#define COR_LEVLREQ 0x40
static void prism2_plx_cor_sreset(local_info_t *local)
{
unsigned char corsave;
+ struct hostap_plx_priv *hw_priv = local->hw_priv;
printk(KERN_DEBUG "%s: Doing reset via direct COR access.\n",
dev_info);
/* Set sreset bit of COR and clear it after hold time */
- if (local->attr_mem == NULL) {
+ if (hw_priv->attr_mem == NULL) {
/* TMD7160 - COR at card's first I/O addr */
- corsave = inb(local->cor_offset);
- outb(corsave | COR_SRESET, local->cor_offset);
+ corsave = inb(hw_priv->cor_offset);
+ outb(corsave | COR_SRESET, hw_priv->cor_offset);
mdelay(2);
- outb(corsave & ~COR_SRESET, local->cor_offset);
+ outb(corsave & ~COR_SRESET, hw_priv->cor_offset);
mdelay(2);
} else {
/* PLX9052 */
- corsave = readb(local->attr_mem + local->cor_offset);
+ corsave = readb(hw_priv->attr_mem + hw_priv->cor_offset);
writeb(corsave | COR_SRESET,
- local->attr_mem + local->cor_offset);
+ hw_priv->attr_mem + hw_priv->cor_offset);
mdelay(2);
writeb(corsave & ~COR_SRESET,
- local->attr_mem + local->cor_offset);
+ hw_priv->attr_mem + hw_priv->cor_offset);
mdelay(2);
}
}
static void prism2_plx_genesis_reset(local_info_t *local, int hcr)
{
unsigned char corsave;
+ struct hostap_plx_priv *hw_priv = local->hw_priv;
- if (local->attr_mem == NULL) {
+ if (hw_priv->attr_mem == NULL) {
/* TMD7160 - COR at card's first I/O addr */
- corsave = inb(local->cor_offset);
- outb(corsave | COR_SRESET, local->cor_offset);
+ corsave = inb(hw_priv->cor_offset);
+ outb(corsave | COR_SRESET, hw_priv->cor_offset);
mdelay(10);
- outb(hcr, local->cor_offset + 2);
+ outb(hcr, hw_priv->cor_offset + 2);
mdelay(10);
- outb(corsave & ~COR_SRESET, local->cor_offset);
+ outb(corsave & ~COR_SRESET, hw_priv->cor_offset);
mdelay(10);
} else {
/* PLX9052 */
- corsave = readb(local->attr_mem + local->cor_offset);
+ corsave = readb(hw_priv->attr_mem + hw_priv->cor_offset);
writeb(corsave | COR_SRESET,
- local->attr_mem + local->cor_offset);
+ hw_priv->attr_mem + hw_priv->cor_offset);
mdelay(10);
- writeb(hcr, local->attr_mem + local->cor_offset + 2);
+ writeb(hcr, hw_priv->attr_mem + hw_priv->cor_offset + 2);
mdelay(10);
writeb(corsave & ~COR_SRESET,
- local->attr_mem + local->cor_offset);
+ hw_priv->attr_mem + hw_priv->cor_offset);
mdelay(10);
}
}
{
.card_present = NULL,
.cor_sreset = prism2_plx_cor_sreset,
- .dev_open = NULL,
- .dev_close = NULL,
.genesis_reset = prism2_plx_genesis_reset,
.hw_type = HOSTAP_HW_PLX,
};
static int cards_found /* = 0 */;
int irq_registered = 0;
int tmd7160;
+ struct hostap_plx_priv *hw_priv;
+
+ hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
+ if (hw_priv == NULL)
+ return -ENOMEM;
+ memset(hw_priv, 0, sizeof(*hw_priv));
if (pci_enable_device(pdev))
return -EIO;
goto fail;
iface = netdev_priv(dev);
local = iface->local;
+ local->hw_priv = hw_priv;
cards_found++;
dev->irq = pdev->irq;
dev->base_addr = pccard_ioaddr;
- local->attr_mem = attr_mem;
- local->cor_offset = cor_offset;
+ hw_priv->attr_mem = attr_mem;
+ hw_priv->cor_offset = cor_offset;
pci_set_drvdata(pdev, dev);
fail:
prism2_free_local_data(dev);
+ kfree(hw_priv);
if (irq_registered && dev)
free_irq(dev->irq, dev);
{
struct net_device *dev;
struct hostap_interface *iface;
+ struct hostap_plx_priv *hw_priv;
dev = pci_get_drvdata(pdev);
iface = netdev_priv(dev);
+ hw_priv = iface->local->hw_priv;
/* Reset the hardware, and ensure interrupts are disabled. */
prism2_plx_cor_sreset(iface->local);
hfa384x_disable_interrupts(dev);
- if (iface->local->attr_mem)
- iounmap(iface->local->attr_mem);
+ if (hw_priv->attr_mem)
+ iounmap(hw_priv->attr_mem);
if (dev->irq)
free_irq(dev->irq, dev);
prism2_free_local_data(dev);
+ kfree(hw_priv);
pci_disable_device(pdev);
}
MODULE_DEVICE_TABLE(pci, prism2_plx_id_table);
static struct pci_driver prism2_plx_drv_id = {
- .name = "prism2_plx",
+ .name = "hostap_plx",
.id_table = prism2_plx_id_table,
.probe = prism2_plx_probe,
.remove = prism2_plx_remove,