7 #include <linux/module.h>
11 #include <linux/netdevice.h>
12 #include <linux/slab.h>
14 #include <linux/wireless.h>
18 #include <linux/pci.h>
24 static char *
dev_info =
"hostap_pci";
54 #ifdef PRISM2_IO_DEBUG
58 struct hostap_interface *iface;
63 iface = netdev_priv(dev);
65 hw_priv = local->hw_priv;
68 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
70 spin_unlock_irqrestore(&local->lock, flags);
75 struct hostap_interface *iface;
81 iface = netdev_priv(dev);
83 hw_priv = local->hw_priv;
87 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
88 spin_unlock_irqrestore(&local->lock, flags);
94 struct hostap_interface *iface;
99 iface = netdev_priv(dev);
100 local = iface->local;
101 hw_priv = local->hw_priv;
104 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
106 spin_unlock_irqrestore(&local->lock, flags);
111 struct hostap_interface *iface;
117 iface = netdev_priv(dev);
118 local = iface->local;
119 hw_priv = local->hw_priv;
123 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
124 spin_unlock_irqrestore(&local->lock, flags);
128 #define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
129 #define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
130 #define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
131 #define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
132 #define HFA384X_OUTW_DATA(v,a) hfa384x_outw_debug(dev, (a), le16_to_cpu((v)))
133 #define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw_debug(dev, (a)))
139 struct hostap_interface *iface;
141 iface = netdev_priv(dev);
142 hw_priv = iface->local->hw_priv;
148 struct hostap_interface *iface;
150 iface = netdev_priv(dev);
151 hw_priv = iface->local->hw_priv;
157 struct hostap_interface *iface;
159 iface = netdev_priv(dev);
160 hw_priv = iface->local->hw_priv;
166 struct hostap_interface *iface;
168 iface = netdev_priv(dev);
169 hw_priv = iface->local->hw_priv;
173 #define HFA384X_OUTB(v,a) hfa384x_outb(dev, (a), (v))
174 #define HFA384X_INB(a) hfa384x_inb(dev, (a))
175 #define HFA384X_OUTW(v,a) hfa384x_outw(dev, (a), (v))
176 #define HFA384X_INW(a) hfa384x_inw(dev, (a))
177 #define HFA384X_OUTW_DATA(v,a) hfa384x_outw(dev, (a), le16_to_cpu((v)))
178 #define HFA384X_INW_DATA(a) cpu_to_le16(hfa384x_inw(dev, (a)))
189 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
192 for ( ; len > 1; len -= 2)
207 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
210 for ( ; len > 1; len -= 2)
239 #ifdef PRISM2_PCI_USE_LONG_DELAYS
262 if (
HFA384X_INW(HFA384X_CMD_OFF) & HFA384X_CMD_BUSY) {
268 static void prism2_pci_genesis_reset(
local_info_t *local,
int hcr)
281 static struct prism2_helper_functions prism2_pci_funcs =
283 .card_present =
NULL,
284 .cor_sreset = prism2_pci_cor_sreset,
285 .genesis_reset = prism2_pci_genesis_reset,
286 .hw_type = HOSTAP_HW_PCI,
290 static int prism2_pci_probe(
struct pci_dev *pdev,
293 unsigned long phymem;
297 static int cards_found ;
298 int irq_registered = 0;
299 struct hostap_interface *iface;
302 hw_priv = kzalloc(
sizeof(*hw_priv),
GFP_KERNEL);
313 goto err_out_disable;
322 dev = prism2_init_local_data(&prism2_pci_funcs, cards_found,
326 iface = netdev_priv(dev);
327 local = iface->local;
328 local->hw_priv = hw_priv;
335 prism2_pci_cor_sreset(local);
337 pci_set_drvdata(pdev, dev);
346 if (!local->pri_only && prism2_hw_config(dev, 1)) {
353 "mem=0x%lx, irq=%d\n", dev->
name, phymem, dev->
irq);
355 return hostap_hw_ready(dev);
358 if (irq_registered && dev)
368 prism2_free_local_data(dev);
377 static void prism2_pci_remove(
struct pci_dev *pdev)
380 struct hostap_interface *iface;
384 dev = pci_get_drvdata(pdev);
385 iface = netdev_priv(dev);
386 hw_priv = iface->local->hw_priv;
389 prism2_pci_cor_sreset(iface->local);
390 hfa384x_disable_interrupts(dev);
396 prism2_free_local_data(dev);
410 struct net_device *dev = pci_get_drvdata(pdev);
412 if (netif_running(dev)) {
413 netif_stop_queue(dev);
424 static int prism2_pci_resume(
struct pci_dev *pdev)
426 struct net_device *dev = pci_get_drvdata(pdev);
436 prism2_hw_config(dev, 0);
437 if (netif_running(dev)) {
439 netif_start_queue(dev);
449 static struct pci_driver prism2_pci_driver = {
450 .name =
"hostap_pci",
451 .id_table = prism2_pci_id_table,
452 .probe = prism2_pci_probe,
453 .remove = prism2_pci_remove,
455 .suspend = prism2_pci_suspend,
456 .resume = prism2_pci_resume,