aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel_cs.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-11 08:14:56 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-11 08:14:56 -0500
commit2ecc26b87a2b3e8650d3c7fe3fc85a8c73d5560d (patch)
tree0453e556241830d675d2063b74ac3b769326b379 /drivers/net/wireless/atmel_cs.c
parent6af37fa9928a0d50cda1bad14b2eda8c1a4d1a0e (diff)
parentb16a228d05a95b27d77d07a91688382f68ece8a7 (diff)
Merge branch 'atmel'
Diffstat (limited to 'drivers/net/wireless/atmel_cs.c')
-rw-r--r--drivers/net/wireless/atmel_cs.c176
1 files changed, 47 insertions, 129 deletions
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 1bd13146c644..17d1fd90f832 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -63,6 +63,7 @@
63 be present but disabled -- but it can then be enabled for specific 63 be present but disabled -- but it can then be enabled for specific
64 modules at load time with a 'pc_debug=#' option to insmod. 64 modules at load time with a 'pc_debug=#' option to insmod.
65*/ 65*/
66
66#ifdef PCMCIA_DEBUG 67#ifdef PCMCIA_DEBUG
67static int pc_debug = PCMCIA_DEBUG; 68static int pc_debug = PCMCIA_DEBUG;
68module_param(pc_debug, int, 0); 69module_param(pc_debug, int, 0);
@@ -285,41 +286,6 @@ static int card_present(void *arg)
285 return 0; 286 return 0;
286} 287}
287 288
288/* list of cards we know about and their firmware requirements.
289 Go either by Manfid or version strings.
290 Cards not in this list will need a firmware parameter to the module
291 in all probability. Note that the SMC 2632 V2 and V3 have the same
292 manfids, so we ignore those and use the version1 strings. */
293
294static struct {
295 int manf, card;
296 char *ver1;
297 AtmelFWType firmware;
298 char *name;
299} card_table[] = {
300 { 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" },
301 { 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" },
302 { 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" },
303 { 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" },
304 { 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" },
305 { 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" },
306 { 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" },
307 { MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" },
308 { MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" },
309 { 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" },
310 { 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" },
311 { 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" },
312 { 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" },
313 { 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" },
314 { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" },
315 { 0, 0, "IEEE 802.11b/Wireless LAN Card S", ATMEL_FW_TYPE_504_2958, "Siemens Gigaset PC Card II" },
316 { 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" },
317 { 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" },
318 { 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" },
319 { 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" },
320 { 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" },
321};
322
323static void atmel_config(dev_link_t *link) 289static void atmel_config(dev_link_t *link)
324{ 290{
325 client_handle_t handle; 291 client_handle_t handle;
@@ -328,10 +294,11 @@ static void atmel_config(dev_link_t *link)
328 local_info_t *dev; 294 local_info_t *dev;
329 int last_fn, last_ret; 295 int last_fn, last_ret;
330 u_char buf[64]; 296 u_char buf[64];
331 int card_index = -1, done = 0; 297 struct pcmcia_device_id *did;
332 298
333 handle = link->handle; 299 handle = link->handle;
334 dev = link->priv; 300 dev = link->priv;
301 did = handle_to_dev(handle).driver_data;
335 302
336 DEBUG(0, "atmel_config(0x%p)\n", link); 303 DEBUG(0, "atmel_config(0x%p)\n", link);
337 304
@@ -340,59 +307,6 @@ static void atmel_config(dev_link_t *link)
340 tuple.TupleDataMax = sizeof(buf); 307 tuple.TupleDataMax = sizeof(buf);
341 tuple.TupleOffset = 0; 308 tuple.TupleOffset = 0;
342 309
343 tuple.DesiredTuple = CISTPL_MANFID;
344 if (pcmcia_get_first_tuple(handle, &tuple) == 0) {
345 int i;
346 cistpl_manfid_t *manfid;
347 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
348 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
349 manfid = &(parse.manfid);
350 for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) {
351 if (!card_table[i].ver1 &&
352 manfid->manf == card_table[i].manf &&
353 manfid->card == card_table[i].card) {
354 card_index = i;
355 done = 1;
356 }
357 }
358 }
359
360 tuple.DesiredTuple = CISTPL_VERS_1;
361 if (!done && (pcmcia_get_first_tuple(handle, &tuple) == 0)) {
362 int i, j, k;
363 cistpl_vers_1_t *ver1;
364 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
365 CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
366 ver1 = &(parse.version_1);
367
368 for (i = 0; i < sizeof(card_table)/sizeof(card_table[0]); i++) {
369 for (j = 0; j < ver1->ns; j++) {
370 char *p = card_table[i].ver1;
371 char *q = &ver1->str[ver1->ofs[j]];
372 if (!p)
373 goto mismatch;
374 for (k = 0; k < j; k++) {
375 while ((*p != '\0') && (*p != '/')) p++;
376 if (*p == '\0') {
377 if (*q != '\0')
378 goto mismatch;
379 } else {
380 p++;
381 }
382 }
383 while((*q != '\0') && (*p != '\0') &&
384 (*p != '/') && (*p == *q)) p++, q++;
385 if (((*p != '\0') && *p != '/') || *q != '\0')
386 goto mismatch;
387 }
388 card_index = i;
389 break; /* done */
390
391 mismatch:
392 j = 0; /* dummy stmt to shut up compiler */
393 }
394 }
395
396 /* 310 /*
397 This reads the card's CONFIG tuple to find its configuration 311 This reads the card's CONFIG tuple to find its configuration
398 registers. 312 registers.
@@ -509,12 +423,13 @@ static void atmel_config(dev_link_t *link)
509 ((local_info_t*)link->priv)->eth_dev = 423 ((local_info_t*)link->priv)->eth_dev =
510 init_atmel_card(link->irq.AssignedIRQ, 424 init_atmel_card(link->irq.AssignedIRQ,
511 link->io.BasePort1, 425 link->io.BasePort1,
512 card_index == -1 ? ATMEL_FW_TYPE_NONE : card_table[card_index].firmware, 426 did ? did->driver_info : ATMEL_FW_TYPE_NONE,
513 &handle_to_dev(handle), 427 &handle_to_dev(handle),
514 card_present, 428 card_present,
515 link); 429 link);
516 if (!((local_info_t*)link->priv)->eth_dev) 430 if (!((local_info_t*)link->priv)->eth_dev)
517 goto cs_failed; 431 goto cs_failed;
432
518 433
519 /* 434 /*
520 At this point, the dev_node_t structure(s) need to be 435 At this point, the dev_node_t structure(s) need to be
@@ -523,26 +438,7 @@ static void atmel_config(dev_link_t *link)
523 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name ); 438 strcpy(dev->node.dev_name, ((local_info_t*)link->priv)->eth_dev->name );
524 dev->node.major = dev->node.minor = 0; 439 dev->node.major = dev->node.minor = 0;
525 link->dev = &dev->node; 440 link->dev = &dev->node;
526 441
527 /* Finally, report what we've done */
528 printk(KERN_INFO "%s: %s%sindex 0x%02x: Vcc %d.%d",
529 dev->node.dev_name,
530 card_index == -1 ? "" : card_table[card_index].name,
531 card_index == -1 ? "" : " ",
532 link->conf.ConfigIndex,
533 link->conf.Vcc/10, link->conf.Vcc%10);
534 if (link->conf.Vpp1)
535 printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10);
536 if (link->conf.Attributes & CONF_ENABLE_IRQ)
537 printk(", irq %d", link->irq.AssignedIRQ);
538 if (link->io.NumPorts1)
539 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
540 link->io.BasePort1+link->io.NumPorts1-1);
541 if (link->io.NumPorts2)
542 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
543 link->io.BasePort2+link->io.NumPorts2-1);
544 printk("\n");
545
546 link->state &= ~DEV_CONFIG_PENDING; 442 link->state &= ~DEV_CONFIG_PENDING;
547 return; 443 return;
548 444
@@ -569,7 +465,7 @@ static void atmel_release(dev_link_t *link)
569 link->dev = NULL; 465 link->dev = NULL;
570 466
571 if (dev) 467 if (dev)
572 stop_atmel_card(dev, 0); 468 stop_atmel_card(dev);
573 ((local_info_t*)link->priv)->eth_dev = NULL; 469 ((local_info_t*)link->priv)->eth_dev = NULL;
574 470
575 /* Don't bother checking to see if these succeed or not */ 471 /* Don't bother checking to see if these succeed or not */
@@ -637,25 +533,47 @@ static int atmel_event(event_t event, int priority,
637} /* atmel_event */ 533} /* atmel_event */
638 534
639/*====================================================================*/ 535/*====================================================================*/
536/* We use the driver_info field to store the correct firmware type for a card. */
537
538#define PCMCIA_DEVICE_MANF_CARD_INFO(manf, card, info) { \
539 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
540 PCMCIA_DEV_ID_MATCH_CARD_ID, \
541 .manf_id = (manf), \
542 .card_id = (card), \
543 .driver_info = (kernel_ulong_t)(info), }
544
545#define PCMCIA_DEVICE_PROD_ID12_INFO(v1, v2, vh1, vh2, info) { \
546 .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \
547 PCMCIA_DEV_ID_MATCH_PROD_ID2, \
548 .prod_id = { (v1), (v2), NULL, NULL }, \
549 .prod_id_hash = { (vh1), (vh2), 0, 0 }, \
550 .driver_info = (kernel_ulong_t)(info), }
551
640static struct pcmcia_device_id atmel_ids[] = { 552static struct pcmcia_device_id atmel_ids[] = {
641 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), 553 PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0620, ATMEL_FW_TYPE_502_3COM),
642 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), 554 PCMCIA_DEVICE_MANF_CARD_INFO(0x0101, 0x0696, ATMEL_FW_TYPE_502_3COM),
643 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), 555 PCMCIA_DEVICE_MANF_CARD_INFO(0x01bf, 0x3302, ATMEL_FW_TYPE_502E),
644 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), 556 PCMCIA_DEVICE_MANF_CARD_INFO(0xd601, 0x0007, ATMEL_FW_TYPE_502),
645 PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), 557 PCMCIA_DEVICE_PROD_ID12_INFO("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9, ATMEL_FW_TYPE_502E),
646 PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), 558 PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f, ATMEL_FW_TYPE_502),
647 PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), 559 PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_D", 0xabda4164, 0x3675d704, ATMEL_FW_TYPE_502D),
648 PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), 560 PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C502AR_E", 0xabda4164, 0x4172e792, ATMEL_FW_TYPE_502E),
649 PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), 561 PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504_R", 0xabda4164, 0x917f3d72, ATMEL_FW_TYPE_504_2958),
650 PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), 562 PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504", 0xabda4164, 0x5040670a, ATMEL_FW_TYPE_504),
651 PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), 563 PCMCIA_DEVICE_PROD_ID12_INFO("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f, ATMEL_FW_TYPE_504A_2958),
652 PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), 564 PCMCIA_DEVICE_PROD_ID12_INFO("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5, ATMEL_FW_TYPE_502),
653 PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), 565 PCMCIA_DEVICE_PROD_ID12_INFO("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b, ATMEL_FW_TYPE_502E),
654 PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), 566 PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6, ATMEL_FW_TYPE_502),
655 PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), 567 PCMCIA_DEVICE_PROD_ID12_INFO("IEEE 802.11b", "Wireless LAN Card S", 0x5b878724, 0x5fba533a, ATMEL_FW_TYPE_504_2958),
656 PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), 568 PCMCIA_DEVICE_PROD_ID12_INFO("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68, ATMEL_FW_TYPE_502),
569 PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W", 0xc4f8b18b, 0x30f38774, ATMEL_FW_TYPE_502D),
570 PCMCIA_DEVICE_PROD_ID12_INFO("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377, ATMEL_FW_TYPE_502),
571 PCMCIA_DEVICE_PROD_ID12_INFO("Wireless", "PC_CARD", 0xa407ecdd, 0x119f6314, ATMEL_FW_TYPE_502D),
572 PCMCIA_DEVICE_PROD_ID12_INFO("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4, ATMEL_FW_TYPE_502D),
573 PCMCIA_DEVICE_PROD_ID12_INFO("LG", "LW2100N", 0xb474d43a, 0x6b1fec94, ATMEL_FW_TYPE_502E),
657 PCMCIA_DEVICE_NULL 574 PCMCIA_DEVICE_NULL
658}; 575};
576
659MODULE_DEVICE_TABLE(pcmcia, atmel_ids); 577MODULE_DEVICE_TABLE(pcmcia, atmel_ids);
660 578
661static struct pcmcia_driver atmel_driver = { 579static struct pcmcia_driver atmel_driver = {