aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia/ipwireless/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/pcmcia/ipwireless/main.c')
-rw-r--r--drivers/char/pcmcia/ipwireless/main.c86
1 files changed, 48 insertions, 38 deletions
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c
index cc7dcea2d28..5eca7a99afe 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/char/pcmcia/ipwireless/main.c
@@ -49,7 +49,7 @@ static void ipwireless_detach(struct pcmcia_device *link);
49/* Debug mode: more verbose, print sent/recv bytes */ 49/* Debug mode: more verbose, print sent/recv bytes */
50int ipwireless_debug; 50int ipwireless_debug;
51int ipwireless_loopback; 51int ipwireless_loopback;
52int ipwireless_out_queue = 1; 52int ipwireless_out_queue = 10;
53 53
54module_param_named(debug, ipwireless_debug, int, 0); 54module_param_named(debug, ipwireless_debug, int, 0);
55module_param_named(loopback, ipwireless_loopback, int, 0); 55module_param_named(loopback, ipwireless_loopback, int, 0);
@@ -57,7 +57,7 @@ module_param_named(out_queue, ipwireless_out_queue, int, 0);
57MODULE_PARM_DESC(debug, "switch on debug messages [0]"); 57MODULE_PARM_DESC(debug, "switch on debug messages [0]");
58MODULE_PARM_DESC(loopback, 58MODULE_PARM_DESC(loopback,
59 "debug: enable ras_raw channel [0]"); 59 "debug: enable ras_raw channel [0]");
60MODULE_PARM_DESC(out_queue, "debug: set size of outgoing queue [1]"); 60MODULE_PARM_DESC(out_queue, "debug: set size of outgoing PPP queue [10]");
61 61
62/* Executes in process context. */ 62/* Executes in process context. */
63static void signalled_reboot_work(struct work_struct *work_reboot) 63static void signalled_reboot_work(struct work_struct *work_reboot)
@@ -88,8 +88,6 @@ static int config_ipwireless(struct ipw_dev *ipw)
88 unsigned short buf[64]; 88 unsigned short buf[64];
89 cisparse_t parse; 89 cisparse_t parse;
90 unsigned short cor_value; 90 unsigned short cor_value;
91 win_req_t request_attr_memory;
92 win_req_t request_common_memory;
93 memreq_t memreq_attr_memory; 91 memreq_t memreq_attr_memory;
94 memreq_t memreq_common_memory; 92 memreq_t memreq_common_memory;
95 93
@@ -188,6 +186,9 @@ static int config_ipwireless(struct ipw_dev *ipw)
188 goto exit0; 186 goto exit0;
189 } 187 }
190 188
189 request_region(link->io.BasePort1, link->io.NumPorts1,
190 IPWIRELESS_PCCARD_NAME);
191
191 /* memory settings */ 192 /* memory settings */
192 193
193 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 194 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
@@ -214,16 +215,16 @@ static int config_ipwireless(struct ipw_dev *ipw)
214 } 215 }
215 216
216 if (parse.cftable_entry.mem.nwin > 0) { 217 if (parse.cftable_entry.mem.nwin > 0) {
217 request_common_memory.Attributes = 218 ipw->request_common_memory.Attributes =
218 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 219 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE;
219 request_common_memory.Base = 220 ipw->request_common_memory.Base =
220 parse.cftable_entry.mem.win[0].host_addr; 221 parse.cftable_entry.mem.win[0].host_addr;
221 request_common_memory.Size = parse.cftable_entry.mem.win[0].len; 222 ipw->request_common_memory.Size = parse.cftable_entry.mem.win[0].len;
222 if (request_common_memory.Size < 0x1000) 223 if (ipw->request_common_memory.Size < 0x1000)
223 request_common_memory.Size = 0x1000; 224 ipw->request_common_memory.Size = 0x1000;
224 request_common_memory.AccessSpeed = 0; 225 ipw->request_common_memory.AccessSpeed = 0;
225 226
226 ret = pcmcia_request_window(&link, &request_common_memory, 227 ret = pcmcia_request_window(&link, &ipw->request_common_memory,
227 &ipw->handle_common_memory); 228 &ipw->handle_common_memory);
228 229
229 if (ret != CS_SUCCESS) { 230 if (ret != CS_SUCCESS) {
@@ -246,16 +247,18 @@ static int config_ipwireless(struct ipw_dev *ipw)
246 ipw->is_v2_card = 247 ipw->is_v2_card =
247 parse.cftable_entry.mem.win[0].len == 0x100; 248 parse.cftable_entry.mem.win[0].len == 0x100;
248 249
249 ipw->common_memory = ioremap(request_common_memory.Base, 250 ipw->common_memory = ioremap(ipw->request_common_memory.Base,
250 request_common_memory.Size); 251 ipw->request_common_memory.Size);
252 request_mem_region(ipw->request_common_memory.Base,
253 ipw->request_common_memory.Size, IPWIRELESS_PCCARD_NAME);
251 254
252 request_attr_memory.Attributes = 255 ipw->request_attr_memory.Attributes =
253 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; 256 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE;
254 request_attr_memory.Base = 0; 257 ipw->request_attr_memory.Base = 0;
255 request_attr_memory.Size = 0; /* this used to be 0x1000 */ 258 ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */
256 request_attr_memory.AccessSpeed = 0; 259 ipw->request_attr_memory.AccessSpeed = 0;
257 260
258 ret = pcmcia_request_window(&link, &request_attr_memory, 261 ret = pcmcia_request_window(&link, &ipw->request_attr_memory,
259 &ipw->handle_attr_memory); 262 &ipw->handle_attr_memory);
260 263
261 if (ret != CS_SUCCESS) { 264 if (ret != CS_SUCCESS) {
@@ -274,8 +277,10 @@ static int config_ipwireless(struct ipw_dev *ipw)
274 goto exit2; 277 goto exit2;
275 } 278 }
276 279
277 ipw->attr_memory = ioremap(request_attr_memory.Base, 280 ipw->attr_memory = ioremap(ipw->request_attr_memory.Base,
278 request_attr_memory.Size); 281 ipw->request_attr_memory.Size);
282 request_mem_region(ipw->request_attr_memory.Base, ipw->request_attr_memory.Size,
283 IPWIRELESS_PCCARD_NAME);
279 } 284 }
280 285
281 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); 286 INIT_WORK(&ipw->work_reboot, signalled_reboot_work);
@@ -311,14 +316,13 @@ static int config_ipwireless(struct ipw_dev *ipw)
311 (unsigned int) link->irq.AssignedIRQ); 316 (unsigned int) link->irq.AssignedIRQ);
312 if (ipw->attr_memory && ipw->common_memory) 317 if (ipw->attr_memory && ipw->common_memory)
313 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 318 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
314 ": attr memory 0x%08lx-0x%08lx, " 319 ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n",
315 "common memory 0x%08lx-0x%08lx\n", 320 ipw->request_attr_memory.Base,
316 request_attr_memory.Base, 321 ipw->request_attr_memory.Base
317 request_attr_memory.Base 322 + ipw->request_attr_memory.Size - 1,
318 + request_attr_memory.Size - 1, 323 ipw->request_common_memory.Base,
319 request_common_memory.Base, 324 ipw->request_common_memory.Base
320 request_common_memory.Base 325 + ipw->request_common_memory.Size - 1);
321 + request_common_memory.Size - 1);
322 326
323 ipw->network = ipwireless_network_create(ipw->hardware); 327 ipw->network = ipwireless_network_create(ipw->hardware);
324 if (!ipw->network) 328 if (!ipw->network)
@@ -350,12 +354,16 @@ exit4:
350 pcmcia_disable_device(link); 354 pcmcia_disable_device(link);
351exit3: 355exit3:
352 if (ipw->attr_memory) { 356 if (ipw->attr_memory) {
357 release_mem_region(ipw->request_attr_memory.Base,
358 ipw->request_attr_memory.Size);
353 iounmap(ipw->attr_memory); 359 iounmap(ipw->attr_memory);
354 pcmcia_release_window(ipw->handle_attr_memory); 360 pcmcia_release_window(ipw->handle_attr_memory);
355 pcmcia_disable_device(link); 361 pcmcia_disable_device(link);
356 } 362 }
357exit2: 363exit2:
358 if (ipw->common_memory) { 364 if (ipw->common_memory) {
365 release_mem_region(ipw->request_common_memory.Base,
366 ipw->request_common_memory.Size);
359 iounmap(ipw->common_memory); 367 iounmap(ipw->common_memory);
360 pcmcia_release_window(ipw->handle_common_memory); 368 pcmcia_release_window(ipw->handle_common_memory);
361 } 369 }
@@ -367,19 +375,25 @@ exit0:
367 375
368static void release_ipwireless(struct ipw_dev *ipw) 376static void release_ipwireless(struct ipw_dev *ipw)
369{ 377{
370 struct pcmcia_device *link = ipw->link; 378 pcmcia_disable_device(ipw->link);
371
372 pcmcia_disable_device(link);
373 379
374 if (ipw->common_memory) 380 if (ipw->common_memory) {
381 release_mem_region(ipw->request_common_memory.Base,
382 ipw->request_common_memory.Size);
375 iounmap(ipw->common_memory); 383 iounmap(ipw->common_memory);
376 if (ipw->attr_memory) 384 }
385 if (ipw->attr_memory) {
386 release_mem_region(ipw->request_attr_memory.Base,
387 ipw->request_attr_memory.Size);
377 iounmap(ipw->attr_memory); 388 iounmap(ipw->attr_memory);
389 }
378 if (ipw->common_memory) 390 if (ipw->common_memory)
379 pcmcia_release_window(ipw->handle_common_memory); 391 pcmcia_release_window(ipw->handle_common_memory);
380 if (ipw->attr_memory) 392 if (ipw->attr_memory)
381 pcmcia_release_window(ipw->handle_attr_memory); 393 pcmcia_release_window(ipw->handle_attr_memory);
382 pcmcia_disable_device(link); 394
395 /* Break the link with Card Services */
396 pcmcia_disable_device(ipw->link);
383} 397}
384 398
385/* 399/*
@@ -437,10 +451,6 @@ static void ipwireless_detach(struct pcmcia_device *link)
437 451
438 release_ipwireless(ipw); 452 release_ipwireless(ipw);
439 453
440 /* Break the link with Card Services */
441 if (link)
442 pcmcia_disable_device(link);
443
444 if (ipw->tty != NULL) 454 if (ipw->tty != NULL)
445 ipwireless_tty_free(ipw->tty); 455 ipwireless_tty_free(ipw->tty);
446 if (ipw->network != NULL) 456 if (ipw->network != NULL)