diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 15:25:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-06 15:25:06 -0400 |
commit | 1685e633b396b0f3dabbc9fa5d65dfefe6435250 (patch) | |
tree | ee83e26e2468ca1518a1b065c690159e12c8def9 /drivers/net/wireless | |
parent | 1cfd2bda8c486ae0e7a8005354758ebb68172bca (diff) | |
parent | 127c03cdbad9bd5af5d7f33bd31a1015a90cb77f (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
pcmcia: avoid buffer overflow in pcmcia_setup_isa_irq
pcmcia: do not request windows if you don't need to
pcmcia: insert PCMCIA device resources into resource tree
pcmcia: export resource information to sysfs
pcmcia: use struct resource for PCMCIA devices, part 2
pcmcia: remove memreq_t
pcmcia: move local definitions out of include/pcmcia/cs.h
pcmcia: do not use io_req_t when calling pcmcia_request_io()
pcmcia: do not use io_req_t after call to pcmcia_request_io()
pcmcia: use struct resource for PCMCIA devices
pcmcia: clean up cs.h
pcmcia: use pcmica_{read,write}_config_byte
pcmcia: remove cs_types.h
pcmcia: remove unused flag, simplify headers
pcmcia: remove obsolete CS_EVENT_ definitions
pcmcia: split up central event handler
pcmcia: simplify event callback
pcmcia: remove obsolete ioctl
Conflicts in:
- drivers/staging/comedi/drivers/*
- drivers/staging/wlags49_h2/wl_cs.c
due to dev_info_t and whitespace changes
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 74 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pcmcia.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 136 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_cs.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/orinoco_cs.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco/spectrum_cs.c | 62 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 24 |
9 files changed, 130 insertions, 277 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 33bdc6a84e81..9a121a5b787c 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/timer.h> | 32 | #include <linux/timer.h> |
33 | #include <linux/netdevice.h> | 33 | #include <linux/netdevice.h> |
34 | 34 | ||
35 | #include <pcmcia/cs_types.h> | ||
36 | #include <pcmcia/cs.h> | 35 | #include <pcmcia/cs.h> |
37 | #include <pcmcia/cistpl.h> | 36 | #include <pcmcia/cistpl.h> |
38 | #include <pcmcia/cisreg.h> | 37 | #include <pcmcia/cisreg.h> |
@@ -155,8 +154,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
155 | unsigned int vcc, | 154 | unsigned int vcc, |
156 | void *priv_data) | 155 | void *priv_data) |
157 | { | 156 | { |
158 | win_req_t *req = priv_data; | ||
159 | |||
160 | if (cfg->index == 0) | 157 | if (cfg->index == 0) |
161 | return -ENODEV; | 158 | return -ENODEV; |
162 | 159 | ||
@@ -176,52 +173,25 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
176 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 173 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
177 | 174 | ||
178 | /* IO window settings */ | 175 | /* IO window settings */ |
179 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 176 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
180 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 177 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
181 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 178 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
182 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 179 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
183 | if (!(io->flags & CISTPL_IO_8BIT)) | 180 | p_dev->resource[0]->flags |= |
184 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 181 | pcmcia_io_cfg_data_width(io->flags); |
185 | if (!(io->flags & CISTPL_IO_16BIT)) | 182 | p_dev->resource[0]->start = io->win[0].base; |
186 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 183 | p_dev->resource[0]->end = io->win[0].len; |
187 | p_dev->io.BasePort1 = io->win[0].base; | ||
188 | p_dev->io.NumPorts1 = io->win[0].len; | ||
189 | if (io->nwin > 1) { | 184 | if (io->nwin > 1) { |
190 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 185 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
191 | p_dev->io.BasePort2 = io->win[1].base; | 186 | p_dev->resource[1]->start = io->win[1].base; |
192 | p_dev->io.NumPorts2 = io->win[1].len; | 187 | p_dev->resource[1]->end = io->win[1].len; |
193 | } | 188 | } |
194 | } | 189 | } |
195 | 190 | ||
196 | /* This reserves IO space but doesn't actually enable it */ | 191 | /* This reserves IO space but doesn't actually enable it */ |
197 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 192 | if (pcmcia_request_io(p_dev) != 0) |
198 | return -ENODEV; | 193 | return -ENODEV; |
199 | 194 | ||
200 | /* | ||
201 | Now set up a common memory window, if needed. There is room | ||
202 | in the struct pcmcia_device structure for one memory window handle, | ||
203 | but if the base addresses need to be saved, or if multiple | ||
204 | windows are needed, the info should go in the private data | ||
205 | structure for this device. | ||
206 | |||
207 | Note that the memory window base is a physical address, and | ||
208 | needs to be mapped to virtual space with ioremap() before it | ||
209 | is used. | ||
210 | */ | ||
211 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | ||
212 | cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | ||
213 | memreq_t map; | ||
214 | req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | ||
215 | req->Base = mem->win[0].host_addr; | ||
216 | req->Size = mem->win[0].len; | ||
217 | req->AccessSpeed = 0; | ||
218 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) | ||
219 | return -ENODEV; | ||
220 | map.Page = 0; | ||
221 | map.CardOffset = mem->win[0].card_addr; | ||
222 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) | ||
223 | return -ENODEV; | ||
224 | } | ||
225 | /* If we got this far, we're cool! */ | 195 | /* If we got this far, we're cool! */ |
226 | return 0; | 196 | return 0; |
227 | } | 197 | } |
@@ -230,17 +200,12 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
230 | static int airo_config(struct pcmcia_device *link) | 200 | static int airo_config(struct pcmcia_device *link) |
231 | { | 201 | { |
232 | local_info_t *dev; | 202 | local_info_t *dev; |
233 | win_req_t *req; | ||
234 | int ret; | 203 | int ret; |
235 | 204 | ||
236 | dev = link->priv; | 205 | dev = link->priv; |
237 | 206 | ||
238 | dev_dbg(&link->dev, "airo_config\n"); | 207 | dev_dbg(&link->dev, "airo_config\n"); |
239 | 208 | ||
240 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | ||
241 | if (!req) | ||
242 | return -ENOMEM; | ||
243 | |||
244 | /* | 209 | /* |
245 | * In this loop, we scan the CIS for configuration table | 210 | * In this loop, we scan the CIS for configuration table |
246 | * entries, each of which describes a valid card | 211 | * entries, each of which describes a valid card |
@@ -255,7 +220,7 @@ static int airo_config(struct pcmcia_device *link) | |||
255 | * and most client drivers will only use the CIS to fill in | 220 | * and most client drivers will only use the CIS to fill in |
256 | * implementation-defined details. | 221 | * implementation-defined details. |
257 | */ | 222 | */ |
258 | ret = pcmcia_loop_config(link, airo_cs_config_check, req); | 223 | ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); |
259 | if (ret) | 224 | if (ret) |
260 | goto failed; | 225 | goto failed; |
261 | 226 | ||
@@ -272,7 +237,7 @@ static int airo_config(struct pcmcia_device *link) | |||
272 | goto failed; | 237 | goto failed; |
273 | ((local_info_t *)link->priv)->eth_dev = | 238 | ((local_info_t *)link->priv)->eth_dev = |
274 | init_airo_card(link->irq, | 239 | init_airo_card(link->irq, |
275 | link->io.BasePort1, 1, &link->dev); | 240 | link->resource[0]->start, 1, &link->dev); |
276 | if (!((local_info_t *)link->priv)->eth_dev) | 241 | if (!((local_info_t *)link->priv)->eth_dev) |
277 | goto failed; | 242 | goto failed; |
278 | 243 | ||
@@ -282,22 +247,15 @@ static int airo_config(struct pcmcia_device *link) | |||
282 | if (link->conf.Vpp) | 247 | if (link->conf.Vpp) |
283 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); | 248 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); |
284 | printk(", irq %d", link->irq); | 249 | printk(", irq %d", link->irq); |
285 | if (link->io.NumPorts1) | 250 | if (link->resource[0]) |
286 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 251 | printk(" & %pR", link->resource[0]); |
287 | link->io.BasePort1+link->io.NumPorts1-1); | 252 | if (link->resource[1]) |
288 | if (link->io.NumPorts2) | 253 | printk(" & %pR", link->resource[1]); |
289 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
290 | link->io.BasePort2+link->io.NumPorts2-1); | ||
291 | if (link->win) | ||
292 | printk(", mem 0x%06lx-0x%06lx", req->Base, | ||
293 | req->Base+req->Size-1); | ||
294 | printk("\n"); | 254 | printk("\n"); |
295 | kfree(req); | ||
296 | return 0; | 255 | return 0; |
297 | 256 | ||
298 | failed: | 257 | failed: |
299 | airo_release(link); | 258 | airo_release(link); |
300 | kfree(req); | ||
301 | return -ENODEV; | 259 | return -ENODEV; |
302 | } /* airo_config */ | 260 | } /* airo_config */ |
303 | 261 | ||
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index c2746fc7f2be..3b632161c106 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/moduleparam.h> | 42 | #include <linux/moduleparam.h> |
43 | #include <linux/device.h> | 43 | #include <linux/device.h> |
44 | 44 | ||
45 | #include <pcmcia/cs_types.h> | ||
46 | #include <pcmcia/cs.h> | 45 | #include <pcmcia/cs.h> |
47 | #include <pcmcia/cistpl.h> | 46 | #include <pcmcia/cistpl.h> |
48 | #include <pcmcia/cisreg.h> | 47 | #include <pcmcia/cisreg.h> |
@@ -191,25 +190,23 @@ static int atmel_config_check(struct pcmcia_device *p_dev, | |||
191 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 190 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
192 | 191 | ||
193 | /* IO window settings */ | 192 | /* IO window settings */ |
194 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 193 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
195 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 194 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
196 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 195 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
197 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 196 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
198 | if (!(io->flags & CISTPL_IO_8BIT)) | 197 | p_dev->resource[0]->flags |= |
199 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 198 | pcmcia_io_cfg_data_width(io->flags); |
200 | if (!(io->flags & CISTPL_IO_16BIT)) | 199 | p_dev->resource[0]->start = io->win[0].base; |
201 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 200 | p_dev->resource[0]->end = io->win[0].len; |
202 | p_dev->io.BasePort1 = io->win[0].base; | ||
203 | p_dev->io.NumPorts1 = io->win[0].len; | ||
204 | if (io->nwin > 1) { | 201 | if (io->nwin > 1) { |
205 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 202 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
206 | p_dev->io.BasePort2 = io->win[1].base; | 203 | p_dev->resource[1]->start = io->win[1].base; |
207 | p_dev->io.NumPorts2 = io->win[1].len; | 204 | p_dev->resource[1]->end = io->win[1].len; |
208 | } | 205 | } |
209 | } | 206 | } |
210 | 207 | ||
211 | /* This reserves IO space but doesn't actually enable it */ | 208 | /* This reserves IO space but doesn't actually enable it */ |
212 | return pcmcia_request_io(p_dev, &p_dev->io); | 209 | return pcmcia_request_io(p_dev); |
213 | } | 210 | } |
214 | 211 | ||
215 | static int atmel_config(struct pcmcia_device *link) | 212 | static int atmel_config(struct pcmcia_device *link) |
@@ -254,7 +251,7 @@ static int atmel_config(struct pcmcia_device *link) | |||
254 | 251 | ||
255 | ((local_info_t*)link->priv)->eth_dev = | 252 | ((local_info_t*)link->priv)->eth_dev = |
256 | init_atmel_card(link->irq, | 253 | init_atmel_card(link->irq, |
257 | link->io.BasePort1, | 254 | link->resource[0]->start, |
258 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, | 255 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
259 | &link->dev, | 256 | &link->dev, |
260 | card_present, | 257 | card_present, |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 0e99b634267c..dfbc41d431ff 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/ssb/ssb.h> | 26 | #include <linux/ssb/ssb.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | #include <pcmcia/cs_types.h> | ||
30 | #include <pcmcia/cs.h> | 29 | #include <pcmcia/cs.h> |
31 | #include <pcmcia/cistpl.h> | 30 | #include <pcmcia/cistpl.h> |
32 | #include <pcmcia/ciscode.h> | 31 | #include <pcmcia/ciscode.h> |
@@ -65,7 +64,6 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
65 | { | 64 | { |
66 | struct ssb_bus *ssb; | 65 | struct ssb_bus *ssb; |
67 | win_req_t win; | 66 | win_req_t win; |
68 | memreq_t mem; | ||
69 | int err = -ENOMEM; | 67 | int err = -ENOMEM; |
70 | int res = 0; | 68 | int res = 0; |
71 | 69 | ||
@@ -78,12 +76,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
78 | dev->conf.Attributes = CONF_ENABLE_IRQ; | 76 | dev->conf.Attributes = CONF_ENABLE_IRQ; |
79 | dev->conf.IntType = INT_MEMORY_AND_IO; | 77 | dev->conf.IntType = INT_MEMORY_AND_IO; |
80 | 78 | ||
81 | dev->io.BasePort2 = 0; | 79 | win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | |
82 | dev->io.NumPorts2 = 0; | ||
83 | dev->io.Attributes2 = 0; | ||
84 | |||
85 | win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM | | ||
86 | WIN_ENABLE | WIN_DATA_WIDTH_16 | | ||
87 | WIN_USE_WAIT; | 80 | WIN_USE_WAIT; |
88 | win.Base = 0; | 81 | win.Base = 0; |
89 | win.Size = SSB_CORE_SIZE; | 82 | win.Size = SSB_CORE_SIZE; |
@@ -92,9 +85,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
92 | if (res != 0) | 85 | if (res != 0) |
93 | goto err_kfree_ssb; | 86 | goto err_kfree_ssb; |
94 | 87 | ||
95 | mem.CardOffset = 0; | 88 | res = pcmcia_map_mem_page(dev, dev->win, 0); |
96 | mem.Page = 0; | ||
97 | res = pcmcia_map_mem_page(dev, dev->win, &mem); | ||
98 | if (res != 0) | 89 | if (res != 0) |
99 | goto err_disable; | 90 | goto err_disable; |
100 | 91 | ||
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 29b31a694b59..ba54d1b04d22 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/wireless.h> | 12 | #include <linux/wireless.h> |
13 | #include <net/iw_handler.h> | 13 | #include <net/iw_handler.h> |
14 | 14 | ||
15 | #include <pcmcia/cs_types.h> | ||
16 | #include <pcmcia/cs.h> | 15 | #include <pcmcia/cs.h> |
17 | #include <pcmcia/cistpl.h> | 16 | #include <pcmcia/cistpl.h> |
18 | #include <pcmcia/cisreg.h> | 17 | #include <pcmcia/cisreg.h> |
@@ -23,7 +22,7 @@ | |||
23 | #include "hostap_wlan.h" | 22 | #include "hostap_wlan.h" |
24 | 23 | ||
25 | 24 | ||
26 | static dev_info_t dev_info = "hostap_cs"; | 25 | static char *dev_info = "hostap_cs"; |
27 | 26 | ||
28 | MODULE_AUTHOR("Jouni Malinen"); | 27 | MODULE_AUTHOR("Jouni Malinen"); |
29 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " | 28 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " |
@@ -225,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local) | |||
225 | static void sandisk_set_iobase(local_info_t *local) | 224 | static void sandisk_set_iobase(local_info_t *local) |
226 | { | 225 | { |
227 | int res; | 226 | int res; |
228 | conf_reg_t reg; | ||
229 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 227 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
230 | 228 | ||
231 | reg.Function = 0; | 229 | res = pcmcia_write_config_byte(hw_priv->link, 0x10, |
232 | reg.Action = CS_WRITE; | 230 | hw_priv->link->resource[0]->start & 0x00ff); |
233 | reg.Offset = 0x10; /* 0x3f0 IO base 1 */ | ||
234 | reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; | ||
235 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
236 | ®); | ||
237 | if (res != 0) { | 231 | if (res != 0) { |
238 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" | 232 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" |
239 | " res=%d\n", res); | 233 | " res=%d\n", res); |
240 | } | 234 | } |
241 | udelay(10); | 235 | udelay(10); |
242 | 236 | ||
243 | reg.Function = 0; | 237 | res = pcmcia_write_config_byte(hw_priv->link, 0x12, |
244 | reg.Action = CS_WRITE; | 238 | (hw_priv->link->resource[0]->start >> 8) & 0x00ff); |
245 | reg.Offset = 0x12; /* 0x3f2 IO base 2 */ | ||
246 | reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; | ||
247 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
248 | ®); | ||
249 | if (res != 0) { | 239 | if (res != 0) { |
250 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" | 240 | printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" |
251 | " res=%d\n", res); | 241 | " res=%d\n", res); |
@@ -271,12 +261,11 @@ static void sandisk_write_hcr(local_info_t *local, int hcr) | |||
271 | static int sandisk_enable_wireless(struct net_device *dev) | 261 | static int sandisk_enable_wireless(struct net_device *dev) |
272 | { | 262 | { |
273 | int res, ret = 0; | 263 | int res, ret = 0; |
274 | conf_reg_t reg; | ||
275 | struct hostap_interface *iface = netdev_priv(dev); | 264 | struct hostap_interface *iface = netdev_priv(dev); |
276 | local_info_t *local = iface->local; | 265 | local_info_t *local = iface->local; |
277 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 266 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
278 | 267 | ||
279 | if (hw_priv->link->io.NumPorts1 < 0x42) { | 268 | if (resource_size(hw_priv->link->resource[0]) < 0x42) { |
280 | /* Not enough ports to be SanDisk multi-function card */ | 269 | /* Not enough ports to be SanDisk multi-function card */ |
281 | ret = -ENODEV; | 270 | ret = -ENODEV; |
282 | goto done; | 271 | goto done; |
@@ -298,12 +287,8 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
298 | " - using vendor-specific initialization\n", dev->name); | 287 | " - using vendor-specific initialization\n", dev->name); |
299 | hw_priv->sandisk_connectplus = 1; | 288 | hw_priv->sandisk_connectplus = 1; |
300 | 289 | ||
301 | reg.Function = 0; | 290 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
302 | reg.Action = CS_WRITE; | 291 | COR_SOFT_RESET); |
303 | reg.Offset = CISREG_COR; | ||
304 | reg.Value = COR_SOFT_RESET; | ||
305 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
306 | ®); | ||
307 | if (res != 0) { | 292 | if (res != 0) { |
308 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", | 293 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", |
309 | dev->name, res); | 294 | dev->name, res); |
@@ -311,16 +296,13 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
311 | } | 296 | } |
312 | mdelay(5); | 297 | mdelay(5); |
313 | 298 | ||
314 | reg.Function = 0; | ||
315 | reg.Action = CS_WRITE; | ||
316 | reg.Offset = CISREG_COR; | ||
317 | /* | 299 | /* |
318 | * Do not enable interrupts here to avoid some bogus events. Interrupts | 300 | * Do not enable interrupts here to avoid some bogus events. Interrupts |
319 | * will be enabled during the first cor_sreset call. | 301 | * will be enabled during the first cor_sreset call. |
320 | */ | 302 | */ |
321 | reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; | 303 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
322 | res = pcmcia_access_configuration_register(hw_priv->link, | 304 | (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | |
323 | ®); | 305 | COR_FUNC_ENA)); |
324 | if (res != 0) { | 306 | if (res != 0) { |
325 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", | 307 | printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", |
326 | dev->name, res); | 308 | dev->name, res); |
@@ -343,30 +325,23 @@ done: | |||
343 | static void prism2_pccard_cor_sreset(local_info_t *local) | 325 | static void prism2_pccard_cor_sreset(local_info_t *local) |
344 | { | 326 | { |
345 | int res; | 327 | int res; |
346 | conf_reg_t reg; | 328 | u8 val; |
347 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 329 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
348 | 330 | ||
349 | if (!prism2_pccard_card_present(local)) | 331 | if (!prism2_pccard_card_present(local)) |
350 | return; | 332 | return; |
351 | 333 | ||
352 | reg.Function = 0; | 334 | res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val); |
353 | reg.Action = CS_READ; | ||
354 | reg.Offset = CISREG_COR; | ||
355 | reg.Value = 0; | ||
356 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
357 | ®); | ||
358 | if (res != 0) { | 335 | if (res != 0) { |
359 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", | 336 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", |
360 | res); | 337 | res); |
361 | return; | 338 | return; |
362 | } | 339 | } |
363 | printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", | 340 | printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", |
364 | reg.Value); | 341 | val); |
365 | 342 | ||
366 | reg.Action = CS_WRITE; | 343 | val |= COR_SOFT_RESET; |
367 | reg.Value |= COR_SOFT_RESET; | 344 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); |
368 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
369 | ®); | ||
370 | if (res != 0) { | 345 | if (res != 0) { |
371 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", | 346 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", |
372 | res); | 347 | res); |
@@ -375,11 +350,10 @@ static void prism2_pccard_cor_sreset(local_info_t *local) | |||
375 | 350 | ||
376 | mdelay(hw_priv->sandisk_connectplus ? 5 : 2); | 351 | mdelay(hw_priv->sandisk_connectplus ? 5 : 2); |
377 | 352 | ||
378 | reg.Value &= ~COR_SOFT_RESET; | 353 | val &= ~COR_SOFT_RESET; |
379 | if (hw_priv->sandisk_connectplus) | 354 | if (hw_priv->sandisk_connectplus) |
380 | reg.Value |= COR_IREQ_ENA; | 355 | val |= COR_IREQ_ENA; |
381 | res = pcmcia_access_configuration_register(hw_priv->link, | 356 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val); |
382 | ®); | ||
383 | if (res != 0) { | 357 | if (res != 0) { |
384 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", | 358 | printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", |
385 | res); | 359 | res); |
@@ -396,8 +370,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local) | |||
396 | static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | 370 | static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) |
397 | { | 371 | { |
398 | int res; | 372 | int res; |
399 | conf_reg_t reg; | 373 | u8 old_cor; |
400 | int old_cor; | ||
401 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 374 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
402 | 375 | ||
403 | if (!prism2_pccard_card_present(local)) | 376 | if (!prism2_pccard_card_present(local)) |
@@ -408,25 +381,17 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
408 | return; | 381 | return; |
409 | } | 382 | } |
410 | 383 | ||
411 | reg.Function = 0; | 384 | res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor); |
412 | reg.Action = CS_READ; | ||
413 | reg.Offset = CISREG_COR; | ||
414 | reg.Value = 0; | ||
415 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
416 | ®); | ||
417 | if (res != 0) { | 385 | if (res != 0) { |
418 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " | 386 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " |
419 | "(%d)\n", res); | 387 | "(%d)\n", res); |
420 | return; | 388 | return; |
421 | } | 389 | } |
422 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", | 390 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", |
423 | reg.Value); | 391 | old_cor); |
424 | old_cor = reg.Value; | ||
425 | 392 | ||
426 | reg.Action = CS_WRITE; | 393 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
427 | reg.Value |= COR_SOFT_RESET; | 394 | old_cor | COR_SOFT_RESET); |
428 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
429 | ®); | ||
430 | if (res != 0) { | 395 | if (res != 0) { |
431 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " | 396 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " |
432 | "(%d)\n", res); | 397 | "(%d)\n", res); |
@@ -436,11 +401,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
436 | mdelay(10); | 401 | mdelay(10); |
437 | 402 | ||
438 | /* Setup Genesis mode */ | 403 | /* Setup Genesis mode */ |
439 | reg.Action = CS_WRITE; | 404 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr); |
440 | reg.Value = hcr; | ||
441 | reg.Offset = CISREG_CCSR; | ||
442 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
443 | ®); | ||
444 | if (res != 0) { | 405 | if (res != 0) { |
445 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " | 406 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " |
446 | "(%d)\n", res); | 407 | "(%d)\n", res); |
@@ -448,11 +409,8 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | |||
448 | } | 409 | } |
449 | mdelay(10); | 410 | mdelay(10); |
450 | 411 | ||
451 | reg.Action = CS_WRITE; | 412 | res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, |
452 | reg.Offset = CISREG_COR; | 413 | old_cor & ~COR_SOFT_RESET); |
453 | reg.Value = old_cor & ~COR_SOFT_RESET; | ||
454 | res = pcmcia_access_configuration_register(hw_priv->link, | ||
455 | ®); | ||
456 | if (res != 0) { | 414 | if (res != 0) { |
457 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " | 415 | printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " |
458 | "(%d)\n", res); | 416 | "(%d)\n", res); |
@@ -561,30 +519,24 @@ static int prism2_config_check(struct pcmcia_device *p_dev, | |||
561 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " | 519 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " |
562 | "dflt->io.nwin=%d\n", | 520 | "dflt->io.nwin=%d\n", |
563 | cfg->io.nwin, dflt->io.nwin); | 521 | cfg->io.nwin, dflt->io.nwin); |
564 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 522 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
565 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 523 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
566 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 524 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
567 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 525 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
568 | PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " | 526 | p_dev->resource[0]->flags |= |
569 | "io.base=0x%04x, len=%d\n", io->flags, | 527 | pcmcia_io_cfg_data_width(io->flags); |
570 | io->win[0].base, io->win[0].len); | 528 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
571 | if (!(io->flags & CISTPL_IO_8BIT)) | 529 | p_dev->resource[0]->start = io->win[0].base; |
572 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 530 | p_dev->resource[0]->end = io->win[0].len; |
573 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
574 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
575 | p_dev->io.IOAddrLines = io->flags & | ||
576 | CISTPL_IO_LINES_MASK; | ||
577 | p_dev->io.BasePort1 = io->win[0].base; | ||
578 | p_dev->io.NumPorts1 = io->win[0].len; | ||
579 | if (io->nwin > 1) { | 531 | if (io->nwin > 1) { |
580 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 532 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
581 | p_dev->io.BasePort2 = io->win[1].base; | 533 | p_dev->resource[1]->start = io->win[1].base; |
582 | p_dev->io.NumPorts2 = io->win[1].len; | 534 | p_dev->resource[1]->end = io->win[1].len; |
583 | } | 535 | } |
584 | } | 536 | } |
585 | 537 | ||
586 | /* This reserves IO space but doesn't actually enable it */ | 538 | /* This reserves IO space but doesn't actually enable it */ |
587 | return pcmcia_request_io(p_dev, &p_dev->io); | 539 | return pcmcia_request_io(p_dev); |
588 | } | 540 | } |
589 | 541 | ||
590 | static int prism2_config(struct pcmcia_device *link) | 542 | static int prism2_config(struct pcmcia_device *link) |
@@ -646,7 +598,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
646 | goto failed_unlock; | 598 | goto failed_unlock; |
647 | 599 | ||
648 | dev->irq = link->irq; | 600 | dev->irq = link->irq; |
649 | dev->base_addr = link->io.BasePort1; | 601 | dev->base_addr = link->resource[0]->start; |
650 | 602 | ||
651 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 603 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
652 | 604 | ||
@@ -658,12 +610,10 @@ static int prism2_config(struct pcmcia_device *link) | |||
658 | link->conf.Vpp % 10); | 610 | link->conf.Vpp % 10); |
659 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 611 | if (link->conf.Attributes & CONF_ENABLE_IRQ) |
660 | printk(", irq %d", link->irq); | 612 | printk(", irq %d", link->irq); |
661 | if (link->io.NumPorts1) | 613 | if (link->resource[0]) |
662 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | 614 | printk(" & %pR", link->resource[0]); |
663 | link->io.BasePort1+link->io.NumPorts1-1); | 615 | if (link->resource[1]) |
664 | if (link->io.NumPorts2) | 616 | printk(" & %pR", link->resource[1]); |
665 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
666 | link->io.BasePort2+link->io.NumPorts2-1); | ||
667 | printk("\n"); | 617 | printk("\n"); |
668 | 618 | ||
669 | local->shutdown = 0; | 619 | local->shutdown = 0; |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 08e4e3908003..9c298396be50 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
29 | #include <linux/netdevice.h> | 29 | #include <linux/netdevice.h> |
30 | 30 | ||
31 | #include <pcmcia/cs_types.h> | ||
32 | #include <pcmcia/cs.h> | 31 | #include <pcmcia/cs.h> |
33 | #include <pcmcia/cistpl.h> | 32 | #include <pcmcia/cistpl.h> |
34 | #include <pcmcia/ds.h> | 33 | #include <pcmcia/ds.h> |
@@ -802,9 +801,9 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, | |||
802 | unsigned int vcc, | 801 | unsigned int vcc, |
803 | void *priv_data) | 802 | void *priv_data) |
804 | { | 803 | { |
805 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 804 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
806 | p_dev->io.BasePort1 = cfg->io.win[0].base; | 805 | p_dev->resource[0]->start = cfg->io.win[0].base; |
807 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | 806 | p_dev->resource[0]->end = cfg->io.win[0].len; |
808 | 807 | ||
809 | /* Do we need to allocate an interrupt? */ | 808 | /* Do we need to allocate an interrupt? */ |
810 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 809 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
@@ -816,7 +815,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev, | |||
816 | } | 815 | } |
817 | 816 | ||
818 | /* This reserves IO space but doesn't actually enable it */ | 817 | /* This reserves IO space but doesn't actually enable it */ |
819 | return pcmcia_request_io(p_dev, &p_dev->io); | 818 | return pcmcia_request_io(p_dev); |
820 | } | 819 | } |
821 | 820 | ||
822 | static int if_cs_probe(struct pcmcia_device *p_dev) | 821 | static int if_cs_probe(struct pcmcia_device *p_dev) |
@@ -854,7 +853,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
854 | goto out1; | 853 | goto out1; |
855 | 854 | ||
856 | /* Initialize io access */ | 855 | /* Initialize io access */ |
857 | card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1); | 856 | card->iobase = ioport_map(p_dev->resource[0]->start, |
857 | resource_size(p_dev->resource[0])); | ||
858 | if (!card->iobase) { | 858 | if (!card->iobase) { |
859 | lbs_pr_err("error in ioport_map\n"); | 859 | lbs_pr_err("error in ioport_map\n"); |
860 | ret = -EIO; | 860 | ret = -EIO; |
@@ -873,9 +873,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
873 | } | 873 | } |
874 | 874 | ||
875 | /* Finally, report what we've done */ | 875 | /* Finally, report what we've done */ |
876 | lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", | 876 | lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); |
877 | p_dev->irq, p_dev->io.BasePort1, | ||
878 | p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1); | ||
879 | 877 | ||
880 | /* | 878 | /* |
881 | * Most of the libertas cards can do unaligned register access, but some | 879 | * Most of the libertas cards can do unaligned register access, but some |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index b16d5db52a4d..ef46a2d88539 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <pcmcia/cs_types.h> | ||
21 | #include <pcmcia/cs.h> | 20 | #include <pcmcia/cs.h> |
22 | #include <pcmcia/cistpl.h> | 21 | #include <pcmcia/cistpl.h> |
23 | #include <pcmcia/cisreg.h> | 22 | #include <pcmcia/cisreg.h> |
@@ -192,25 +191,23 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | |||
192 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 191 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
193 | 192 | ||
194 | /* IO window settings */ | 193 | /* IO window settings */ |
195 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 194 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
196 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 195 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
197 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 196 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
198 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 197 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
199 | if (!(io->flags & CISTPL_IO_8BIT)) | 198 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
200 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 199 | p_dev->resource[0]->flags |= |
201 | if (!(io->flags & CISTPL_IO_16BIT)) | 200 | pcmcia_io_cfg_data_width(io->flags); |
202 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 201 | p_dev->resource[0]->start = io->win[0].base; |
203 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 202 | p_dev->resource[0]->end = io->win[0].len; |
204 | p_dev->io.BasePort1 = io->win[0].base; | ||
205 | p_dev->io.NumPorts1 = io->win[0].len; | ||
206 | if (io->nwin > 1) { | 203 | if (io->nwin > 1) { |
207 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 204 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
208 | p_dev->io.BasePort2 = io->win[1].base; | 205 | p_dev->resource[1]->start = io->win[1].base; |
209 | p_dev->io.NumPorts2 = io->win[1].len; | 206 | p_dev->resource[1]->end = io->win[1].len; |
210 | } | 207 | } |
211 | 208 | ||
212 | /* This reserves IO space but doesn't actually enable it */ | 209 | /* This reserves IO space but doesn't actually enable it */ |
213 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 210 | if (pcmcia_request_io(p_dev) != 0) |
214 | goto next_entry; | 211 | goto next_entry; |
215 | } | 212 | } |
216 | return 0; | 213 | return 0; |
@@ -258,7 +255,8 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
258 | /* We initialize the hermes structure before completing PCMCIA | 255 | /* We initialize the hermes structure before completing PCMCIA |
259 | * configuration just in case the interrupt handler gets | 256 | * configuration just in case the interrupt handler gets |
260 | * called. */ | 257 | * called. */ |
261 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 258 | mem = ioport_map(link->resource[0]->start, |
259 | resource_size(link->resource[0])); | ||
262 | if (!mem) | 260 | if (!mem) |
263 | goto failed; | 261 | goto failed; |
264 | 262 | ||
@@ -280,7 +278,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
280 | } | 278 | } |
281 | 279 | ||
282 | /* Register an interface with the stack */ | 280 | /* Register an interface with the stack */ |
283 | if (orinoco_if_add(priv, link->io.BasePort1, | 281 | if (orinoco_if_add(priv, link->resource[0]->start, |
284 | link->irq, NULL) != 0) { | 282 | link->irq, NULL) != 0) { |
285 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 283 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
286 | goto failed; | 284 | goto failed; |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index b51a9adc80f6..873877e17e1b 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <pcmcia/cs_types.h> | ||
29 | #include <pcmcia/cs.h> | 28 | #include <pcmcia/cs.h> |
30 | #include <pcmcia/cistpl.h> | 29 | #include <pcmcia/cistpl.h> |
31 | #include <pcmcia/cisreg.h> | 30 | #include <pcmcia/cisreg.h> |
@@ -80,35 +79,27 @@ static int | |||
80 | spectrum_reset(struct pcmcia_device *link, int idle) | 79 | spectrum_reset(struct pcmcia_device *link, int idle) |
81 | { | 80 | { |
82 | int ret; | 81 | int ret; |
83 | conf_reg_t reg; | 82 | u8 save_cor; |
84 | u_int save_cor; | 83 | u8 ccsr; |
85 | 84 | ||
86 | /* Doing it if hardware is gone is guaranteed crash */ | 85 | /* Doing it if hardware is gone is guaranteed crash */ |
87 | if (!pcmcia_dev_present(link)) | 86 | if (!pcmcia_dev_present(link)) |
88 | return -ENODEV; | 87 | return -ENODEV; |
89 | 88 | ||
90 | /* Save original COR value */ | 89 | /* Save original COR value */ |
91 | reg.Function = 0; | 90 | ret = pcmcia_read_config_byte(link, CISREG_COR, &save_cor); |
92 | reg.Action = CS_READ; | ||
93 | reg.Offset = CISREG_COR; | ||
94 | ret = pcmcia_access_configuration_register(link, ®); | ||
95 | if (ret) | 91 | if (ret) |
96 | goto failed; | 92 | goto failed; |
97 | save_cor = reg.Value; | ||
98 | 93 | ||
99 | /* Soft-Reset card */ | 94 | /* Soft-Reset card */ |
100 | reg.Action = CS_WRITE; | 95 | ret = pcmcia_write_config_byte(link, CISREG_COR, |
101 | reg.Offset = CISREG_COR; | 96 | (save_cor | COR_SOFT_RESET)); |
102 | reg.Value = (save_cor | COR_SOFT_RESET); | ||
103 | ret = pcmcia_access_configuration_register(link, ®); | ||
104 | if (ret) | 97 | if (ret) |
105 | goto failed; | 98 | goto failed; |
106 | udelay(1000); | 99 | udelay(1000); |
107 | 100 | ||
108 | /* Read CCSR */ | 101 | /* Read CCSR */ |
109 | reg.Action = CS_READ; | 102 | ret = pcmcia_read_config_byte(link, CISREG_CCSR, &ccsr); |
110 | reg.Offset = CISREG_CCSR; | ||
111 | ret = pcmcia_access_configuration_register(link, ®); | ||
112 | if (ret) | 103 | if (ret) |
113 | goto failed; | 104 | goto failed; |
114 | 105 | ||
@@ -116,19 +107,15 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
116 | * Start or stop the firmware. Memory width bit should be | 107 | * Start or stop the firmware. Memory width bit should be |
117 | * preserved from the value we've just read. | 108 | * preserved from the value we've just read. |
118 | */ | 109 | */ |
119 | reg.Action = CS_WRITE; | 110 | ccsr = (idle ? HCR_IDLE : HCR_RUN) | (ccsr & HCR_MEM16); |
120 | reg.Offset = CISREG_CCSR; | 111 | ret = pcmcia_write_config_byte(link, CISREG_CCSR, ccsr); |
121 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); | ||
122 | ret = pcmcia_access_configuration_register(link, ®); | ||
123 | if (ret) | 112 | if (ret) |
124 | goto failed; | 113 | goto failed; |
125 | udelay(1000); | 114 | udelay(1000); |
126 | 115 | ||
127 | /* Restore original COR configuration index */ | 116 | /* Restore original COR configuration index */ |
128 | reg.Action = CS_WRITE; | 117 | ret = pcmcia_write_config_byte(link, CISREG_COR, |
129 | reg.Offset = CISREG_COR; | 118 | (save_cor & ~COR_SOFT_RESET)); |
130 | reg.Value = (save_cor & ~COR_SOFT_RESET); | ||
131 | ret = pcmcia_access_configuration_register(link, ®); | ||
132 | if (ret) | 119 | if (ret) |
133 | goto failed; | 120 | goto failed; |
134 | udelay(1000); | 121 | udelay(1000); |
@@ -266,25 +253,23 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, | |||
266 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | 253 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; |
267 | 254 | ||
268 | /* IO window settings */ | 255 | /* IO window settings */ |
269 | p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; | 256 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; |
270 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 257 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { |
271 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 258 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; |
272 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 259 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; |
273 | if (!(io->flags & CISTPL_IO_8BIT)) | 260 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
274 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 261 | p_dev->resource[0]->flags |= |
275 | if (!(io->flags & CISTPL_IO_16BIT)) | 262 | pcmcia_io_cfg_data_width(io->flags); |
276 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 263 | p_dev->resource[0]->start = io->win[0].base; |
277 | p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; | 264 | p_dev->resource[0]->end = io->win[0].len; |
278 | p_dev->io.BasePort1 = io->win[0].base; | ||
279 | p_dev->io.NumPorts1 = io->win[0].len; | ||
280 | if (io->nwin > 1) { | 265 | if (io->nwin > 1) { |
281 | p_dev->io.Attributes2 = p_dev->io.Attributes1; | 266 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; |
282 | p_dev->io.BasePort2 = io->win[1].base; | 267 | p_dev->resource[1]->start = io->win[1].base; |
283 | p_dev->io.NumPorts2 = io->win[1].len; | 268 | p_dev->resource[1]->end = io->win[1].len; |
284 | } | 269 | } |
285 | 270 | ||
286 | /* This reserves IO space but doesn't actually enable it */ | 271 | /* This reserves IO space but doesn't actually enable it */ |
287 | if (pcmcia_request_io(p_dev, &p_dev->io) != 0) | 272 | if (pcmcia_request_io(p_dev) != 0) |
288 | goto next_entry; | 273 | goto next_entry; |
289 | } | 274 | } |
290 | return 0; | 275 | return 0; |
@@ -332,7 +317,8 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
332 | /* We initialize the hermes structure before completing PCMCIA | 317 | /* We initialize the hermes structure before completing PCMCIA |
333 | * configuration just in case the interrupt handler gets | 318 | * configuration just in case the interrupt handler gets |
334 | * called. */ | 319 | * called. */ |
335 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 320 | mem = ioport_map(link->resource[0]->start, |
321 | resource_size(link->resource[0])); | ||
336 | if (!mem) | 322 | if (!mem) |
337 | goto failed; | 323 | goto failed; |
338 | 324 | ||
@@ -359,7 +345,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
359 | } | 345 | } |
360 | 346 | ||
361 | /* Register an interface with the stack */ | 347 | /* Register an interface with the stack */ |
362 | if (orinoco_if_add(priv, link->io.BasePort1, | 348 | if (orinoco_if_add(priv, link->resource[0]->start, |
363 | link->irq, NULL) != 0) { | 349 | link->irq, NULL) != 0) { |
364 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); | 350 | printk(KERN_ERR PFX "orinoco_if_add() failed\n"); |
365 | goto failed; | 351 | goto failed; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 9c38fc331dca..88560d0ae50a 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/ethtool.h> | 46 | #include <linux/ethtool.h> |
47 | #include <linux/ieee80211.h> | 47 | #include <linux/ieee80211.h> |
48 | 48 | ||
49 | #include <pcmcia/cs_types.h> | ||
50 | #include <pcmcia/cs.h> | 49 | #include <pcmcia/cs.h> |
51 | #include <pcmcia/cistpl.h> | 50 | #include <pcmcia/cistpl.h> |
52 | #include <pcmcia/cisreg.h> | 51 | #include <pcmcia/cisreg.h> |
@@ -315,9 +314,8 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
315 | local->finder = p_dev; | 314 | local->finder = p_dev; |
316 | 315 | ||
317 | /* The io structure describes IO port mapping. None used here */ | 316 | /* The io structure describes IO port mapping. None used here */ |
318 | p_dev->io.NumPorts1 = 0; | 317 | p_dev->resource[0]->end = 0; |
319 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 318 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
320 | p_dev->io.IOAddrLines = 5; | ||
321 | 319 | ||
322 | /* General socket configuration */ | 320 | /* General socket configuration */ |
323 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 321 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -394,7 +392,6 @@ static int ray_config(struct pcmcia_device *link) | |||
394 | int ret = 0; | 392 | int ret = 0; |
395 | int i; | 393 | int i; |
396 | win_req_t req; | 394 | win_req_t req; |
397 | memreq_t mem; | ||
398 | struct net_device *dev = (struct net_device *)link->priv; | 395 | struct net_device *dev = (struct net_device *)link->priv; |
399 | ray_dev_t *local = netdev_priv(dev); | 396 | ray_dev_t *local = netdev_priv(dev); |
400 | 397 | ||
@@ -431,9 +428,7 @@ static int ray_config(struct pcmcia_device *link) | |||
431 | ret = pcmcia_request_window(link, &req, &link->win); | 428 | ret = pcmcia_request_window(link, &req, &link->win); |
432 | if (ret) | 429 | if (ret) |
433 | goto failed; | 430 | goto failed; |
434 | mem.CardOffset = 0x0000; | 431 | ret = pcmcia_map_mem_page(link, link->win, 0); |
435 | mem.Page = 0; | ||
436 | ret = pcmcia_map_mem_page(link, link->win, &mem); | ||
437 | if (ret) | 432 | if (ret) |
438 | goto failed; | 433 | goto failed; |
439 | local->sram = ioremap(req.Base, req.Size); | 434 | local->sram = ioremap(req.Base, req.Size); |
@@ -447,9 +442,7 @@ static int ray_config(struct pcmcia_device *link) | |||
447 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); | 442 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); |
448 | if (ret) | 443 | if (ret) |
449 | goto failed; | 444 | goto failed; |
450 | mem.CardOffset = 0x8000; | 445 | ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); |
451 | mem.Page = 0; | ||
452 | ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem); | ||
453 | if (ret) | 446 | if (ret) |
454 | goto failed; | 447 | goto failed; |
455 | local->rmem = ioremap(req.Base, req.Size); | 448 | local->rmem = ioremap(req.Base, req.Size); |
@@ -463,9 +456,7 @@ static int ray_config(struct pcmcia_device *link) | |||
463 | ret = pcmcia_request_window(link, &req, &local->amem_handle); | 456 | ret = pcmcia_request_window(link, &req, &local->amem_handle); |
464 | if (ret) | 457 | if (ret) |
465 | goto failed; | 458 | goto failed; |
466 | mem.CardOffset = 0x0000; | 459 | ret = pcmcia_map_mem_page(link, local->amem_handle, 0); |
467 | mem.Page = 0; | ||
468 | ret = pcmcia_map_mem_page(link, local->amem_handle, &mem); | ||
469 | if (ret) | 460 | if (ret) |
470 | goto failed; | 461 | goto failed; |
471 | local->amem = ioremap(req.Base, req.Size); | 462 | local->amem = ioremap(req.Base, req.Size); |
@@ -793,7 +784,6 @@ static void ray_release(struct pcmcia_device *link) | |||
793 | { | 784 | { |
794 | struct net_device *dev = link->priv; | 785 | struct net_device *dev = link->priv; |
795 | ray_dev_t *local = netdev_priv(dev); | 786 | ray_dev_t *local = netdev_priv(dev); |
796 | int i; | ||
797 | 787 | ||
798 | dev_dbg(&link->dev, "ray_release\n"); | 788 | dev_dbg(&link->dev, "ray_release\n"); |
799 | 789 | ||
@@ -802,13 +792,6 @@ static void ray_release(struct pcmcia_device *link) | |||
802 | iounmap(local->sram); | 792 | iounmap(local->sram); |
803 | iounmap(local->rmem); | 793 | iounmap(local->rmem); |
804 | iounmap(local->amem); | 794 | iounmap(local->amem); |
805 | /* Do bother checking to see if these succeed or not */ | ||
806 | i = pcmcia_release_window(link, local->amem_handle); | ||
807 | if (i != 0) | ||
808 | dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i); | ||
809 | i = pcmcia_release_window(link, local->rmem_handle); | ||
810 | if (i != 0) | ||
811 | dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i); | ||
812 | pcmcia_disable_device(link); | 795 | pcmcia_disable_device(link); |
813 | 796 | ||
814 | dev_dbg(&link->dev, "ray_release ending\n"); | 797 | dev_dbg(&link->dev, "ray_release ending\n"); |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 376c6b964a9c..a1cc2d498a1c 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -48,7 +48,6 @@ | |||
48 | 48 | ||
49 | #include <net/iw_handler.h> | 49 | #include <net/iw_handler.h> |
50 | 50 | ||
51 | #include <pcmcia/cs_types.h> | ||
52 | #include <pcmcia/cs.h> | 51 | #include <pcmcia/cs.h> |
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/cisreg.h> | 53 | #include <pcmcia/cisreg.h> |
@@ -89,13 +88,6 @@ | |||
89 | static int wl3501_config(struct pcmcia_device *link); | 88 | static int wl3501_config(struct pcmcia_device *link); |
90 | static void wl3501_release(struct pcmcia_device *link); | 89 | static void wl3501_release(struct pcmcia_device *link); |
91 | 90 | ||
92 | /* | ||
93 | * The dev_info variable is the "key" that is used to match up this | ||
94 | * device driver with appropriate cards, through the card configuration | ||
95 | * database. | ||
96 | */ | ||
97 | static dev_info_t wl3501_dev_info = "wl3501_cs"; | ||
98 | |||
99 | static const struct { | 91 | static const struct { |
100 | int reg_domain; | 92 | int reg_domain; |
101 | int min, max, deflt; | 93 | int min, max, deflt; |
@@ -1421,7 +1413,7 @@ static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev) | |||
1421 | 1413 | ||
1422 | static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1414 | static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
1423 | { | 1415 | { |
1424 | strlcpy(info->driver, wl3501_dev_info, sizeof(info->driver)); | 1416 | strlcpy(info->driver, "wl3501_cs", sizeof(info->driver)); |
1425 | } | 1417 | } |
1426 | 1418 | ||
1427 | static const struct ethtool_ops ops = { | 1419 | static const struct ethtool_ops ops = { |
@@ -1892,9 +1884,8 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
1892 | struct wl3501_card *this; | 1884 | struct wl3501_card *this; |
1893 | 1885 | ||
1894 | /* The io structure describes IO port mapping */ | 1886 | /* The io structure describes IO port mapping */ |
1895 | p_dev->io.NumPorts1 = 16; | 1887 | p_dev->resource[0]->end = 16; |
1896 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 1888 | p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; |
1897 | p_dev->io.IOAddrLines = 5; | ||
1898 | 1889 | ||
1899 | /* General socket configuration */ | 1890 | /* General socket configuration */ |
1900 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 1891 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -1940,13 +1931,14 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1940 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1931 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
1941 | * want, you can also read the card's config table to pick addresses -- | 1932 | * want, you can also read the card's config table to pick addresses -- |
1942 | * see the serial driver for an example. */ | 1933 | * see the serial driver for an example. */ |
1934 | link->io_lines = 5; | ||
1943 | 1935 | ||
1944 | for (j = 0x280; j < 0x400; j += 0x20) { | 1936 | for (j = 0x280; j < 0x400; j += 0x20) { |
1945 | /* The '^0x300' is so that we probe 0x300-0x3ff first, then | 1937 | /* The '^0x300' is so that we probe 0x300-0x3ff first, then |
1946 | * 0x200-0x2ff, and so on, because this seems safer */ | 1938 | * 0x200-0x2ff, and so on, because this seems safer */ |
1947 | link->io.BasePort1 = j; | 1939 | link->resource[0]->start = j; |
1948 | link->io.BasePort2 = link->io.BasePort1 + 0x10; | 1940 | link->resource[1]->start = link->resource[0]->start + 0x10; |
1949 | i = pcmcia_request_io(link, &link->io); | 1941 | i = pcmcia_request_io(link); |
1950 | if (i == 0) | 1942 | if (i == 0) |
1951 | break; | 1943 | break; |
1952 | } | 1944 | } |
@@ -1968,7 +1960,7 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1968 | goto failed; | 1960 | goto failed; |
1969 | 1961 | ||
1970 | dev->irq = link->irq; | 1962 | dev->irq = link->irq; |
1971 | dev->base_addr = link->io.BasePort1; | 1963 | dev->base_addr = link->resource[0]->start; |
1972 | SET_NETDEV_DEV(dev, &link->dev); | 1964 | SET_NETDEV_DEV(dev, &link->dev); |
1973 | if (register_netdev(dev)) { | 1965 | if (register_netdev(dev)) { |
1974 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); | 1966 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |