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