[go: nahoru, domu]

1ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define PRISM2_PCCARD
2ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/module.h>
4ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/if.h>
55a0e3ad6af8660be21ca98a971cd00f331318c05Tejun Heo#include <linux/slab.h>
6ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/wait.h>
7ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/timer.h>
8ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/skbuff.h>
9ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/netdevice.h>
10ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/workqueue.h>
11ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <linux/wireless.h>
12ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <net/iw_handler.h>
13ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
14ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <pcmcia/cistpl.h>
15ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <pcmcia/cisreg.h>
16ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <pcmcia/ds.h>
17ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
18ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include <asm/io.h>
19ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
20ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include "hostap_wlan.h"
21ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
22ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
23ac8b422838046ffc26be4874a3cbae0d313f4209Dominik Brodowskistatic char *dev_info = "hostap_cs";
24ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
25ff1d2767d5a43c85f944e86a45284b721f66196cJouni MalinenMODULE_AUTHOR("Jouni Malinen");
26ff1d2767d5a43c85f944e86a45284b721f66196cJouni MalinenMODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
27ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		   "cards (PC Card).");
28ff1d2767d5a43c85f944e86a45284b721f66196cJouni MalinenMODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)");
29ff1d2767d5a43c85f944e86a45284b721f66196cJouni MalinenMODULE_LICENSE("GPL");
30ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
31ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
32ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic int ignore_cis_vcc;
33ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenmodule_param(ignore_cis_vcc, int, 0444);
34ff1d2767d5a43c85f944e86a45284b721f66196cJouni MalinenMODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
35ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
36ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3767e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen/* struct local_info::hw_priv */
3867e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinenstruct hostap_cs_priv {
39fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowski	struct pcmcia_device *link;
4067e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	int sandisk_connectplus;
4167e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen};
4267e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen
4367e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen
44ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#ifdef PRISM2_IO_DEBUG
45ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
46ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
47ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
48ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
49ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
50ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	unsigned long flags;
51ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
52ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	iface = netdev_priv(dev);
53ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local = iface->local;
54ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_lock_irqsave(&local->lock, flags);
55ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
56ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	outb(v, dev->base_addr + a);
57ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_unlock_irqrestore(&local->lock, flags);
58ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
59ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
60ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
61ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
62ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
63ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
64ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	unsigned long flags;
65ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	u8 v;
66ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
67ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	iface = netdev_priv(dev);
68ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local = iface->local;
69ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_lock_irqsave(&local->lock, flags);
70ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	v = inb(dev->base_addr + a);
71ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
72ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_unlock_irqrestore(&local->lock, flags);
73ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return v;
74ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
75ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
76ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
77ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
78ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
79ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
80ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	unsigned long flags;
81ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
82ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	iface = netdev_priv(dev);
83ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local = iface->local;
84ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_lock_irqsave(&local->lock, flags);
85ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
86ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	outw(v, dev->base_addr + a);
87ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_unlock_irqrestore(&local->lock, flags);
88ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
89ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
90ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
91ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
92ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
93ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
94ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	unsigned long flags;
95ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	u16 v;
96ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
97ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	iface = netdev_priv(dev);
98ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local = iface->local;
99ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_lock_irqsave(&local->lock, flags);
100ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	v = inw(dev->base_addr + a);
101ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
102ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_unlock_irqrestore(&local->lock, flags);
103ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return v;
104ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
105ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
106ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic inline void hfa384x_outsw_debug(struct net_device *dev, int a,
107ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen				       u8 *buf, int wc)
108ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
109ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
110ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
111ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	unsigned long flags;
112ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
113ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	iface = netdev_priv(dev);
114ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local = iface->local;
115ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_lock_irqsave(&local->lock, flags);
116ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTSW, a, wc);
117ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	outsw(dev->base_addr + a, buf, wc);
118ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_unlock_irqrestore(&local->lock, flags);
119ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
120ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
121ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic inline void hfa384x_insw_debug(struct net_device *dev, int a,
122ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen				      u8 *buf, int wc)
123ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
124ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
125ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
126ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	unsigned long flags;
127ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
128ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	iface = netdev_priv(dev);
129ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local = iface->local;
130ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_lock_irqsave(&local->lock, flags);
131ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INSW, a, wc);
132ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	insw(dev->base_addr + a, buf, wc);
133ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	spin_unlock_irqrestore(&local->lock, flags);
134ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
135ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
136ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
137ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
138ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
139ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
140ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc))
141ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc))
142ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
143ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#else /* PRISM2_IO_DEBUG */
144ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
145ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a))
146ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_INB(a) inb(dev->base_addr + (a))
147ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a))
148ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_INW(a) inw(dev->base_addr + (a))
149ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc)
150ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc)
151ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
152ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#endif /* PRISM2_IO_DEBUG */
153ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
154ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
155ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
156ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen			    int len)
157ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
158ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	u16 d_off;
159ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	u16 *pos;
160ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
161ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
162ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	pos = (u16 *) buf;
163ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
164ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (len / 2)
165ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		HFA384X_INSW(d_off, buf, len / 2);
166ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	pos += len / 2;
167ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
168ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (len & 1)
169ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		*((char *) pos) = HFA384X_INB(d_off);
170ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
171ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return 0;
172ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
173ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
174ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
175ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
176ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
177ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	u16 d_off;
178ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	u16 *pos;
179ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
180ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
181ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	pos = (u16 *) buf;
182ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
183ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (len / 2)
184ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		HFA384X_OUTSW(d_off, buf, len / 2);
185ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	pos += len / 2;
186ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
187ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (len & 1)
188ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		HFA384X_OUTB(*((char *) pos), d_off);
189ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
190ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return 0;
191ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
192ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
193ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
194ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen/* FIX: This might change at some point.. */
195ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#include "hostap_hw.c"
196ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
197ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
198ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
199cc3b4866bee996c922e875b8c8efe9f0d8803aaeDominik Brodowskistatic void prism2_detach(struct pcmcia_device *p_dev);
200ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic void prism2_release(u_long arg);
201fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowskistatic int prism2_config(struct pcmcia_device *link);
202ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
203ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
204ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic int prism2_pccard_card_present(local_info_t *local)
205ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
20667e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	struct hostap_cs_priv *hw_priv = local->hw_priv;
2079940ec3617fec1db13e589bbc3f37e37878c7683Dominik Brodowski	if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link))
208ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return 1;
209ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return 0;
210ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
211ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
212ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
213ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen/*
214ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0
215ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen * Document No. 20-10-00058, January 2004
216ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf
217ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen */
218ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define SANDISK_WLAN_ACTIVATION_OFF 0x40
219ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen#define SANDISK_HCR_OFF 0x42
220ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
221ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
222ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic void sandisk_set_iobase(local_info_t *local)
223ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
224ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	int res;
22567e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	struct hostap_cs_priv *hw_priv = local->hw_priv;
226ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
2271d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, 0x10,
2289a017a910346afd88ec2e065989903bf211a7d37Dominik Brodowski				hw_priv->link->resource[0]->start & 0x00ff);
2294c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
230ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
231ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       " res=%d\n", res);
232ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
233ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	udelay(10);
234ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
2351d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, 0x12,
2369a017a910346afd88ec2e065989903bf211a7d37Dominik Brodowski				(hw_priv->link->resource[0]->start >> 8) & 0x00ff);
2374c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
238ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
239ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       " res=%d\n", res);
240ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
241ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
242ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
243ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
244ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic void sandisk_write_hcr(local_info_t *local, int hcr)
245ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
246ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct net_device *dev = local->dev;
247ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	int i;
248ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
249ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF);
250ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	udelay(50);
251ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	for (i = 0; i < 10; i++) {
252ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		HFA384X_OUTB(hcr, SANDISK_HCR_OFF);
253ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
254ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	udelay(55);
255ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF);
256ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
257ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
258ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
259ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic int sandisk_enable_wireless(struct net_device *dev)
260ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
261ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	int res, ret = 0;
2626dbc9c89fb242873bd3e83890e59da3d6e462025Yoann Padioleau	struct hostap_interface *iface = netdev_priv(dev);
263ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local = iface->local;
26467e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	struct hostap_cs_priv *hw_priv = local->hw_priv;
265ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
2669a017a910346afd88ec2e065989903bf211a7d37Dominik Brodowski	if (resource_size(hw_priv->link->resource[0]) < 0x42) {
267ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		/* Not enough ports to be SanDisk multi-function card */
268ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		ret = -ENODEV;
269ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto done;
270ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
271ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
272efd50585e2ff9bd60e044fda7764d323010a7fe4Dominik Brodowski	if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
273ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		/* No SanDisk manfid found */
274ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		ret = -ENODEV;
275ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto done;
276ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
277ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
2787d2e8d00b47b973c92db4df7444d5e6d3bb945f9Dominik Brodowski	if (hw_priv->link->socket->functions < 2) {
279ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		/* No multi-function links found */
280ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		ret = -ENODEV;
281ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto done;
282ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
283ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
284ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected"
285ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	       " - using vendor-specific initialization\n", dev->name);
28667e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	hw_priv->sandisk_connectplus = 1;
287ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
2881d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
2891d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski				COR_SOFT_RESET);
2904c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
291ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
292ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       dev->name, res);
293ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto done;
294ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
295ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	mdelay(5);
296ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
297ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	/*
298ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	 * Do not enable interrupts here to avoid some bogus events. Interrupts
299ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	 * will be enabled during the first cor_sreset call.
300ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	 */
3011d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
3021d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski				(COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE |
3031d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski					COR_FUNC_ENA));
3044c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
305ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
306ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       dev->name, res);
307ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto done;
308ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
309ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	mdelay(5);
310ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
311ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	sandisk_set_iobase(local);
312ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
313ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF);
314ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	udelay(10);
315ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF);
316ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	udelay(10);
317ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
318ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinendone:
319ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return ret;
320ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
321ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
322ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
323ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic void prism2_pccard_cor_sreset(local_info_t *local)
324ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
325ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	int res;
3261d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	u8 val;
32767e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	struct hostap_cs_priv *hw_priv = local->hw_priv;
328ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
329ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (!prism2_pccard_card_present(local))
330ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	       return;
331ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3321d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val);
3334c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
334ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
335ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       res);
336ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
337ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
338ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
3391d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski		val);
340ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3411d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	val |= COR_SOFT_RESET;
3421d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
3434c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
344ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
345ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       res);
346ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
347ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
348ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
34967e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
350ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3511d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	val &= ~COR_SOFT_RESET;
35267e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	if (hw_priv->sandisk_connectplus)
3531d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski		val |= COR_IREQ_ENA;
3541d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
3554c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
356ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
357ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       res);
358ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
359ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
360ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
36167e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
362ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
36367e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	if (hw_priv->sandisk_connectplus)
364ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		sandisk_set_iobase(local);
365ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
366ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
367ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
368ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
369ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
370ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	int res;
3711d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	u8 old_cor;
37267e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	struct hostap_cs_priv *hw_priv = local->hw_priv;
373ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
374ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (!prism2_pccard_card_present(local))
375ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	       return;
376ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
37767e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	if (hw_priv->sandisk_connectplus) {
378ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		sandisk_write_hcr(local, hcr);
379ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
380ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
381ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3821d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
3834c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
384ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
385ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       "(%d)\n", res);
386ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
387ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
388ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
3891d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski		old_cor);
390ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
3911d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
3921d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski				old_cor | COR_SOFT_RESET);
3934c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
394ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
395ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       "(%d)\n", res);
396ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
397ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
398ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
399ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	mdelay(10);
400ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
401ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	/* Setup Genesis mode */
4021d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
4034c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
404ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
405ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       "(%d)\n", res);
406ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
407ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
408ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	mdelay(10);
409ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
4101d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski	res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
4111d5cc192d431bce2ebe9fde64054ce903200e179Dominik Brodowski				old_cor & ~COR_SOFT_RESET);
4124c89e88bfde6a3c179790e21004f24e09a058290Dominik Brodowski	if (res != 0) {
413ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
414ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		       "(%d)\n", res);
415ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		return;
416ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
417ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
418ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	mdelay(10);
419ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
420ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
421ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
422ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic struct prism2_helper_functions prism2_pccard_funcs =
423ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
424ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	.card_present	= prism2_pccard_card_present,
425ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	.cor_sreset	= prism2_pccard_cor_sreset,
426ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	.genesis_reset	= prism2_pccard_genesis_reset,
427ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	.hw_type	= HOSTAP_HW_PCCARD,
428ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen};
429ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
430ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
431ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen/* allocate local data and register with CardServices
432ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen * initialize dev_link structure, but do not configure the card yet */
43315b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowskistatic int hostap_cs_probe(struct pcmcia_device *p_dev)
434ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
43515b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski	int ret;
43615b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski
437ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
438f8cfa618dccbdc6dab5297f75779566a388a98fdDominik Brodowski
43915b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski	ret = prism2_config(p_dev);
44015b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski	if (ret) {
441f8cfa618dccbdc6dab5297f75779566a388a98fdDominik Brodowski		PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
44215b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski	}
443f8cfa618dccbdc6dab5297f75779566a388a98fdDominik Brodowski
44415b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski	return ret;
445ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
446ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
447ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
448fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowskistatic void prism2_detach(struct pcmcia_device *link)
449ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
450ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	PDEBUG(DEBUG_FLOW, "prism2_detach\n");
451ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
452e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	prism2_release((u_long)link);
453ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
454ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	/* release net devices */
455ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (link->priv) {
456c355184cd3cd58c9ffc78f2a17e0ac3563312ea7Jouni Malinen		struct hostap_cs_priv *hw_priv;
45767e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen		struct net_device *dev;
45867e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen		struct hostap_interface *iface;
45967e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen		dev = link->priv;
46067e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen		iface = netdev_priv(dev);
461c355184cd3cd58c9ffc78f2a17e0ac3563312ea7Jouni Malinen		hw_priv = iface->local->hw_priv;
46267e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen		prism2_free_local_data(dev);
463c355184cd3cd58c9ffc78f2a17e0ac3563312ea7Jouni Malinen		kfree(hw_priv);
464ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
465ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
466ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
467ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
46800990e7ce0b0e596fe41d9c64d6933ea70084003Dominik Brodowskistatic int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data)
469b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski{
47000990e7ce0b0e596fe41d9c64d6933ea70084003Dominik Brodowski	if (p_dev->config_index == 0)
47100990e7ce0b0e596fe41d9c64d6933ea70084003Dominik Brodowski		return -EINVAL;
472b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski
47390abdc3b973229bae98dd96649d9f7106cc177a4Dominik Brodowski	return pcmcia_request_io(p_dev);
474b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski}
475b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski
476fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowskistatic int prism2_config(struct pcmcia_device *link)
477ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
478ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct net_device *dev;
479ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct hostap_interface *iface;
480ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local_info_t *local;
481ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	int ret = 1;
48267e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	struct hostap_cs_priv *hw_priv;
483d6a574ff6bfb842bdb98065da053881ff527be46Tim Gardner	unsigned long flags;
484ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
485ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	PDEBUG(DEBUG_FLOW, "prism2_config()\n");
486ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
487b0471bb7b779f5deea109e5bfdfe8c18d4a06241Yan Burman	hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
488b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski	if (hw_priv == NULL) {
489ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		ret = -ENOMEM;
490ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto failed;
491ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
492ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
493ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	/* Look for an appropriate configuration table entry in the CIS */
494440eed43e2a95bb842488755683716814da10f2bDominik Brodowski	link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO |
49500990e7ce0b0e596fe41d9c64d6933ea70084003Dominik Brodowski		CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
496440eed43e2a95bb842488755683716814da10f2bDominik Brodowski	if (ignore_cis_vcc)
497440eed43e2a95bb842488755683716814da10f2bDominik Brodowski		link->config_flags &= ~CONF_AUTO_CHECK_VCC;
4982caff14713d53abba273e6095495788e2720f756Dominik Brodowski	ret = pcmcia_loop_config(link, prism2_config_check, NULL);
4992caff14713d53abba273e6095495788e2720f756Dominik Brodowski	if (ret) {
500b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski		if (!ignore_cis_vcc)
501b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski			printk(KERN_ERR "GetNextTuple(): No matching "
502b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski			       "CIS configuration.  Maybe you need the "
503b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski			       "ignore_cis_vcc=1 parameter.\n");
504b54bf94bf91e4ca2a489eb02bca0424ddb55242aDominik Brodowski		goto failed;
505ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
506ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
507ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	/* Need to allocate net_device before requesting IRQ handler */
5080cd545d6ba0e0138782eb0ec287d0eb3db529b69Dave Hansen	dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
509dd2e5a156525f11754d9b1e0583f6bb49c253d62Dominik Brodowski				     &link->dev);
510ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (dev == NULL)
511ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		goto failed;
512ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	link->priv = dev;
513ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
514fbff868db3a4cc6a89d51da9a6d49b26c29d04fbJouni Malinen	iface = netdev_priv(dev);
515fbff868db3a4cc6a89d51da9a6d49b26c29d04fbJouni Malinen	local = iface->local;
516fbff868db3a4cc6a89d51da9a6d49b26c29d04fbJouni Malinen	local->hw_priv = hw_priv;
517fbff868db3a4cc6a89d51da9a6d49b26c29d04fbJouni Malinen	hw_priv->link = link;
518fbff868db3a4cc6a89d51da9a6d49b26c29d04fbJouni Malinen
519d6a574ff6bfb842bdb98065da053881ff527be46Tim Gardner	/*
5204e5518ca53be29c1ec3c00089c97bef36bfed515Stanislaw Gruszka	 * We enable IRQ here, but IRQ handler will not proceed
5214e5518ca53be29c1ec3c00089c97bef36bfed515Stanislaw Gruszka	 * until dev->base_addr is set below. This protect us from
5224e5518ca53be29c1ec3c00089c97bef36bfed515Stanislaw Gruszka	 * receive interrupts when driver is not initialized.
523d6a574ff6bfb842bdb98065da053881ff527be46Tim Gardner	 */
524eb14120f743d29744d9475bffec56ff4ad43a749Dominik Brodowski	ret = pcmcia_request_irq(link, prism2_interrupt);
525eb14120f743d29744d9475bffec56ff4ad43a749Dominik Brodowski	if (ret)
5264e5518ca53be29c1ec3c00089c97bef36bfed515Stanislaw Gruszka		goto failed;
527ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
5281ac71e5a35eebee60cdcf15b3980bd94498f037bDominik Brodowski	ret = pcmcia_enable_device(link);
5292caff14713d53abba273e6095495788e2720f756Dominik Brodowski	if (ret)
5304e5518ca53be29c1ec3c00089c97bef36bfed515Stanislaw Gruszka		goto failed;
531ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
5324e5518ca53be29c1ec3c00089c97bef36bfed515Stanislaw Gruszka	spin_lock_irqsave(&local->irq_init_lock, flags);
533eb14120f743d29744d9475bffec56ff4ad43a749Dominik Brodowski	dev->irq = link->irq;
5349a017a910346afd88ec2e065989903bf211a7d37Dominik Brodowski	dev->base_addr = link->resource[0]->start;
535d6a574ff6bfb842bdb98065da053881ff527be46Tim Gardner	spin_unlock_irqrestore(&local->irq_init_lock, flags);
536d6a574ff6bfb842bdb98065da053881ff527be46Tim Gardner
537ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	local->shutdown = 0;
538ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
539ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	sandisk_enable_wireless(dev);
540ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
541ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	ret = prism2_hw_config(dev, 1);
542317b6d63000b3cc48c43d582d76063500e531a6cDominik Brodowski	if (!ret)
543ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		ret = hostap_hw_ready(dev);
544317b6d63000b3cc48c43d582d76063500e531a6cDominik Brodowski
545ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return ret;
546ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
547ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen failed:
54867e0e473fb54e7657f6604236e42ef07fd7a2768Jouni Malinen	kfree(hw_priv);
549ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	prism2_release((u_long)link);
550ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	return ret;
551ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
552ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
553ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
554ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic void prism2_release(u_long arg)
555ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
556fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowski	struct pcmcia_device *link = (struct pcmcia_device *)arg;
557ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
558ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	PDEBUG(DEBUG_FLOW, "prism2_release\n");
559ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
560ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	if (link->priv) {
561ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		struct net_device *dev = link->priv;
562ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		struct hostap_interface *iface;
563ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
564ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		iface = netdev_priv(dev);
565e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		prism2_hw_shutdown(dev, 0);
566ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen		iface->local->shutdown = 1;
567ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	}
568ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
569fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowski	pcmcia_disable_device(link);
570ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	PDEBUG(DEBUG_FLOW, "release - done\n");
571ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen}
572ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
573fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowskistatic int hostap_cs_suspend(struct pcmcia_device *link)
57498e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski{
57598e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	struct net_device *dev = (struct net_device *) link->priv;
57698e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	int dev_open = 0;
577e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	struct hostap_interface *iface = NULL;
578ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
579fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville	if (!dev)
580fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville		return -ENODEV;
581fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville
582fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville	iface = netdev_priv(dev);
58398e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski
584e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
585e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	if (iface && iface->local)
586e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		dev_open = iface->local->num_dev_open > 0;
587e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	if (dev_open) {
588e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		netif_stop_queue(dev);
589e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		netif_device_detach(dev);
59098e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	}
591e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	prism2_suspend(dev);
59298e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski
59398e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	return 0;
59498e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski}
59598e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski
596fba395eee7d3f342ca739c20f5b3ee635d0420a0Dominik Brodowskistatic int hostap_cs_resume(struct pcmcia_device *link)
597ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen{
598ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	struct net_device *dev = (struct net_device *) link->priv;
599bab76198b3111bd0328be3c1fa208237eb12f86eJouni Malinen	int dev_open = 0;
600e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	struct hostap_interface *iface = NULL;
601e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski
602fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville	if (!dev)
603fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville		return -ENODEV;
604fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville
605fcee7a01ad7516eeb8dfdd0a17ef04cd2ee30757John W. Linville	iface = netdev_priv(dev);
606bab76198b3111bd0328be3c1fa208237eb12f86eJouni Malinen
60798e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
60898e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski
609e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	if (iface && iface->local)
610e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		dev_open = iface->local->num_dev_open > 0;
61198e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski
612e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	prism2_hw_shutdown(dev, 1);
613e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	prism2_hw_config(dev, dev_open ? 0 : 1);
614e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski	if (dev_open) {
615e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		netif_device_attach(dev);
616e2d4096365e06b9a3799afbadc28b4519c0b3526Dominik Brodowski		netif_start_queue(dev);
617bab76198b3111bd0328be3c1fa208237eb12f86eJouni Malinen	}
618ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen
61998e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	return 0;
62098e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski}
62198e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski
62225f8f54f6e178acfd503a95441b0ea05c525f751Joe Perchesstatic const struct pcmcia_device_id hostap_cs_ids[] = {
623093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
624093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
625093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
626093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
627093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
62846232d29f4088d87cdc2ee94cc911aadbdf00d32Stefan Lippers-Hollmann	PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3301),
629093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
6301e4adbdb3f0348dcf4fce92f1acc7c8386982c17Richard Purdie	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
631093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
632093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
633093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
634093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
635093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
636093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
637093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
638fd99ddd0701385344eadaf2daa6abbc5fb086750Komuro/*	PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),    conflict with pcnet_cs */
639449fecca0b74502b571f4199d46bcd6a11a5e2c2Pavel Roskin	PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
640093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
641093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
642093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
643884d3a2bad7293e56fe99d9322a1090bfdfd7c4eChristian Steineck	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002),
64425ac6c2627acd68bd50307e61a3b581b2f82552eMarcin Juszkiewicz	PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0xd601, 0x0005, "ADLINK 345 CF",
64525ac6c2627acd68bd50307e61a3b581b2f82552eMarcin Juszkiewicz					 0x2d858104),
64640e3cad61197fce63853e778db020f7637d988f2Pavel Roskin	PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
64740e3cad61197fce63853e778db020f7637d988f2Pavel Roskin					 0x74c5e40d),
64840e3cad61197fce63853e778db020f7637d988f2Pavel Roskin	PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
64940e3cad61197fce63853e778db020f7637d988f2Pavel Roskin					 0x4b801a17),
6500a1013c76b52d8f8327f32498ea977d4b6662d45Pavel Roskin	PCMCIA_DEVICE_MANF_CARD_PROD_ID3(0x0156, 0x0002, "Version 01.02",
6510a1013c76b52d8f8327f32498ea977d4b6662d45Pavel Roskin					 0x4b74baa0),
652093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
653093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen				    0x7a954bd9, 0x74be00c6),
65417f65f814fc6144e61b5d19f8e0627cd781486c2Pavel Roskin	PCMCIA_DEVICE_PROD_ID123(
655093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		"Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
656093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		0xe6ec52ce, 0x08649af2, 0x4b74baa0),
657093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID123(
658090891fb2c68eecf95c18c8ba117fc850d21abf8Veli-Pekka Peltola		"Canon", "Wireless LAN CF Card K30225", "Version 01.00",
659090891fb2c68eecf95c18c8ba117fc850d21abf8Veli-Pekka Peltola		0x96ef6fe2, 0x263fcbab, 0xa57adb8c),
660090891fb2c68eecf95c18c8ba117fc850d21abf8Veli-Pekka Peltola	PCMCIA_DEVICE_PROD_ID123(
661093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		"D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
662093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
663093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID123(
664093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		"Instant Wireless ", " Network PC CARD", "Version 01.02",
665093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		0x11d901af, 0x6e9bd926, 0x4b74baa0),
666093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID123(
667093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		"SMC", "SMC2632W", "Version 01.02",
668093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
6691e4adbdb3f0348dcf4fce92f1acc7c8386982c17Richard Purdie	PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
6706c5b90d2c84d557baed56e71729504b467ff3e5bJouni Malinen				0x2decece3, 0x82067c18),
671093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
672093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen				0x54f7c49c, 0x15a75e5b),
673093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
674093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen				0x74c5e40d, 0xdb472a18),
675093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
676093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen				0x0733cc81, 0x0c52f395),
677093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_PROD_ID12(
678093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		"ZoomAir 11Mbps High", "Rate wireless Networking",
679093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen		0x273fe3db, 0x32a1eaee),
6800867c8874ef0f32aa0ef4f7d7aef0a0109d939a5Cédric Le Goater	PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401 Wireless PC", "Card",
6810867c8874ef0f32aa0ef4f7d7aef0a0109d939a5Cédric Le Goater		0xa37434e9, 0x9762e8f1),
682df8ccb9bf1ca360581a94c2245efb9fa613fbb29Marcin Juszkiewicz	PCMCIA_DEVICE_PROD_ID123(
683df8ccb9bf1ca360581a94c2245efb9fa613fbb29Marcin Juszkiewicz		"Pretec", "CompactWLAN Card 802.11b", "2.5",
684df8ccb9bf1ca360581a94c2245efb9fa613fbb29Marcin Juszkiewicz		0x1cadd3e5, 0xe697636c, 0x7a5bfcf1),
685df8ccb9bf1ca360581a94c2245efb9fa613fbb29Marcin Juszkiewicz	PCMCIA_DEVICE_PROD_ID123(
686df8ccb9bf1ca360581a94c2245efb9fa613fbb29Marcin Juszkiewicz		"U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
687df8ccb9bf1ca360581a94c2245efb9fa613fbb29Marcin Juszkiewicz		0xc7b8df9d, 0x1700d087, 0x4b74baa0),
68801918d16c837485ceba92d48fb734cf520e61144Dominik Brodowski	PCMCIA_DEVICE_PROD_ID123(
68901918d16c837485ceba92d48fb734cf520e61144Dominik Brodowski		"Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
69001918d16c837485ceba92d48fb734cf520e61144Dominik Brodowski		"Ver. 1.00",
69101918d16c837485ceba92d48fb734cf520e61144Dominik Brodowski		0x5cd01705, 0x4271660f, 0x9d08ee12),
69201918d16c837485ceba92d48fb734cf520e61144Dominik Brodowski	PCMCIA_DEVICE_PROD_ID123(
6935d635ead203f4432eb287ac565eba057e5c4dfe6Marcin Juszkiewicz		"Wireless LAN" , "11Mbps PC Card", "Version 01.02",
6945d635ead203f4432eb287ac565eba057e5c4dfe6Marcin Juszkiewicz		0x4b8870ff, 0x70e946d1, 0x4b74baa0),
695fbc87d67af5ccd733f894273b215564c67e3a749Pavel Roskin	PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092),
696fbc87d67af5ccd733f894273b215564c67e3a749Pavel Roskin	PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2),
697fbc87d67af5ccd733f894273b215564c67e3a749Pavel Roskin	PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b),
698fbc87d67af5ccd733f894273b215564c67e3a749Pavel Roskin	PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39),
699093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	PCMCIA_DEVICE_NULL
700093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen};
701093853c395df33104ee12c3df4398820d665d107Henrik Brix AndersenMODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
702093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen
703093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen
704ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinenstatic struct pcmcia_driver hostap_driver = {
7052e9b981a7c63ee8278df6823f8389d69dad1a499Dominik Brodowski	.name		= "hostap_cs",
70615b99ac1729503db9e6dc642a50b9b6cb3bf51f9Dominik Brodowski	.probe		= hostap_cs_probe,
707cc3b4866bee996c922e875b8c8efe9f0d8803aaeDominik Brodowski	.remove		= prism2_detach,
708ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen	.owner		= THIS_MODULE,
709093853c395df33104ee12c3df4398820d665d107Henrik Brix Andersen	.id_table	= hostap_cs_ids,
71098e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	.suspend	= hostap_cs_suspend,
71198e4c28b7ec390c2dad6a4c69d69629c0f7e8b10Dominik Brodowski	.resume		= hostap_cs_resume,
712ff1d2767d5a43c85f944e86a45284b721f66196cJouni Malinen};
713fdd3f29eddd1b7c26b3b42e3633afcb22a28fcb3H Hartley Sweetenmodule_pcmcia_driver(hostap_driver);
714