aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c25
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c23
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c36
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c23
5 files changed, 49 insertions, 81 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index a1c38a144149..0ac0c6e08732 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -417,6 +417,13 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
417 u8 r1; 417 u8 r1;
418 u8 r4; 418 u8 r4;
419 419
420 /*
421 * We should never come here because rt2x00lib is supposed
422 * to catch this and send us the correct antenna explicitely.
423 */
424 BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
425 ant->tx == ANTENNA_SW_DIVERSITY);
426
420 rt2400pci_bbp_read(rt2x00dev, 4, &r4); 427 rt2400pci_bbp_read(rt2x00dev, 4, &r4);
421 rt2400pci_bbp_read(rt2x00dev, 1, &r1); 428 rt2400pci_bbp_read(rt2x00dev, 1, &r1);
422 429
@@ -430,14 +437,8 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
430 case ANTENNA_A: 437 case ANTENNA_A:
431 rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0); 438 rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0);
432 break; 439 break;
433 case ANTENNA_SW_DIVERSITY:
434 /*
435 * NOTE: We should never come here because rt2x00lib is
436 * supposed to catch this and send us the correct antenna
437 * explicitely. However we are nog going to bug about this.
438 * Instead, just default to antenna B.
439 */
440 case ANTENNA_B: 440 case ANTENNA_B:
441 default:
441 rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2); 442 rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2);
442 break; 443 break;
443 } 444 }
@@ -452,14 +453,8 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
452 case ANTENNA_A: 453 case ANTENNA_A:
453 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0); 454 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0);
454 break; 455 break;
455 case ANTENNA_SW_DIVERSITY:
456 /*
457 * NOTE: We should never come here because rt2x00lib is
458 * supposed to catch this and send us the correct antenna
459 * explicitely. However we are nog going to bug about this.
460 * Instead, just default to antenna B.
461 */
462 case ANTENNA_B: 456 case ANTENNA_B:
457 default:
463 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 458 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
464 break; 459 break;
465 } 460 }
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 096232763055..d85e1a44d5cd 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -444,6 +444,13 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
444 u8 r14; 444 u8 r14;
445 u8 r2; 445 u8 r2;
446 446
447 /*
448 * We should never come here because rt2x00lib is supposed
449 * to catch this and send us the correct antenna explicitely.
450 */
451 BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
452 ant->tx == ANTENNA_SW_DIVERSITY);
453
447 rt2x00pci_register_read(rt2x00dev, BBPCSR1, &reg); 454 rt2x00pci_register_read(rt2x00dev, BBPCSR1, &reg);
448 rt2500pci_bbp_read(rt2x00dev, 14, &r14); 455 rt2500pci_bbp_read(rt2x00dev, 14, &r14);
449 rt2500pci_bbp_read(rt2x00dev, 2, &r2); 456 rt2500pci_bbp_read(rt2x00dev, 2, &r2);
@@ -457,15 +464,8 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
457 rt2x00_set_field32(&reg, BBPCSR1_CCK, 0); 464 rt2x00_set_field32(&reg, BBPCSR1_CCK, 0);
458 rt2x00_set_field32(&reg, BBPCSR1_OFDM, 0); 465 rt2x00_set_field32(&reg, BBPCSR1_OFDM, 0);
459 break; 466 break;
460 case ANTENNA_HW_DIVERSITY:
461 case ANTENNA_SW_DIVERSITY:
462 /*
463 * NOTE: We should never come here because rt2x00lib is
464 * supposed to catch this and send us the correct antenna
465 * explicitely. However we are nog going to bug about this.
466 * Instead, just default to antenna B.
467 */
468 case ANTENNA_B: 467 case ANTENNA_B:
468 default:
469 rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); 469 rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2);
470 rt2x00_set_field32(&reg, BBPCSR1_CCK, 2); 470 rt2x00_set_field32(&reg, BBPCSR1_CCK, 2);
471 rt2x00_set_field32(&reg, BBPCSR1_OFDM, 2); 471 rt2x00_set_field32(&reg, BBPCSR1_OFDM, 2);
@@ -479,15 +479,8 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev,
479 case ANTENNA_A: 479 case ANTENNA_A:
480 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); 480 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0);
481 break; 481 break;
482 case ANTENNA_HW_DIVERSITY:
483 case ANTENNA_SW_DIVERSITY:
484 /*
485 * NOTE: We should never come here because rt2x00lib is
486 * supposed to catch this and send us the correct antenna
487 * explicitely. However we are nog going to bug about this.
488 * Instead, just default to antenna B.
489 */
490 case ANTENNA_B: 482 case ANTENNA_B:
483 default:
491 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); 484 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
492 break; 485 break;
493 } 486 }
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index b9e2f3a4990b..7ea4247442b3 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -437,6 +437,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
437 u16 csr5; 437 u16 csr5;
438 u16 csr6; 438 u16 csr6;
439 439
440 /*
441 * We should never come here because rt2x00lib is supposed
442 * to catch this and send us the correct antenna explicitely.
443 */
444 BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
445 ant->tx == ANTENNA_SW_DIVERSITY);
446
440 rt2500usb_bbp_read(rt2x00dev, 2, &r2); 447 rt2500usb_bbp_read(rt2x00dev, 2, &r2);
441 rt2500usb_bbp_read(rt2x00dev, 14, &r14); 448 rt2500usb_bbp_read(rt2x00dev, 14, &r14);
442 rt2500usb_register_read(rt2x00dev, PHY_CSR5, &csr5); 449 rt2500usb_register_read(rt2x00dev, PHY_CSR5, &csr5);
@@ -456,14 +463,8 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
456 rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0); 463 rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0);
457 rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0); 464 rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0);
458 break; 465 break;
459 case ANTENNA_SW_DIVERSITY:
460 /*
461 * NOTE: We should never come here because rt2x00lib is
462 * supposed to catch this and send us the correct antenna
463 * explicitely. However we are nog going to bug about this.
464 * Instead, just default to antenna B.
465 */
466 case ANTENNA_B: 466 case ANTENNA_B:
467 default:
467 rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); 468 rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2);
468 rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2); 469 rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2);
469 rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 2); 470 rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 2);
@@ -480,14 +481,8 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
480 case ANTENNA_A: 481 case ANTENNA_A:
481 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); 482 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0);
482 break; 483 break;
483 case ANTENNA_SW_DIVERSITY:
484 /*
485 * NOTE: We should never come here because rt2x00lib is
486 * supposed to catch this and send us the correct antenna
487 * explicitely. However we are nog going to bug about this.
488 * Instead, just default to antenna B.
489 */
490 case ANTENNA_B: 484 case ANTENNA_B:
485 default:
491 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); 486 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2);
492 break; 487 break;
493 } 488 }
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 23b3e163b9ba..f912a8515b5c 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -481,14 +481,8 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
481 else 481 else
482 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); 482 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
483 break; 483 break;
484 case ANTENNA_SW_DIVERSITY:
485 /*
486 * NOTE: We should never come here because rt2x00lib is
487 * supposed to catch this and send us the correct antenna
488 * explicitely. However we are nog going to bug about this.
489 * Instead, just default to antenna B.
490 */
491 case ANTENNA_B: 484 case ANTENNA_B:
485 default:
492 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 486 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
493 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); 487 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
494 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) 488 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
@@ -530,14 +524,8 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
530 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 524 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
531 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); 525 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
532 break; 526 break;
533 case ANTENNA_SW_DIVERSITY:
534 /*
535 * NOTE: We should never come here because rt2x00lib is
536 * supposed to catch this and send us the correct antenna
537 * explicitely. However we are nog going to bug about this.
538 * Instead, just default to antenna B.
539 */
540 case ANTENNA_B: 527 case ANTENNA_B:
528 default:
541 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 529 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
542 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); 530 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
543 break; 531 break;
@@ -575,10 +563,6 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev,
575 rt61pci_bbp_read(rt2x00dev, 4, &r4); 563 rt61pci_bbp_read(rt2x00dev, 4, &r4);
576 rt61pci_bbp_read(rt2x00dev, 77, &r77); 564 rt61pci_bbp_read(rt2x00dev, 77, &r77);
577 565
578 /* FIXME: Antenna selection for the rf 2529 is very confusing in the
579 * legacy driver. The code below should be ok for non-diversity setups.
580 */
581
582 /* 566 /*
583 * Configure the RX antenna. 567 * Configure the RX antenna.
584 */ 568 */
@@ -588,15 +572,14 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev,
588 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); 572 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
589 rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0); 573 rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0);
590 break; 574 break;
591 case ANTENNA_SW_DIVERSITY:
592 case ANTENNA_HW_DIVERSITY: 575 case ANTENNA_HW_DIVERSITY:
593 /* 576 /*
594 * NOTE: We should never come here because rt2x00lib is 577 * FIXME: Antenna selection for the rf 2529 is very confusing
595 * supposed to catch this and send us the correct antenna 578 * in the legacy driver. Just default to antenna B until the
596 * explicitely. However we are nog going to bug about this. 579 * legacy code can be properly translated into rt2x00 code.
597 * Instead, just default to antenna B.
598 */ 580 */
599 case ANTENNA_B: 581 case ANTENNA_B:
582 default:
600 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 583 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
601 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); 584 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
602 rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1); 585 rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1);
@@ -647,6 +630,13 @@ static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev,
647 unsigned int i; 630 unsigned int i;
648 u32 reg; 631 u32 reg;
649 632
633 /*
634 * We should never come here because rt2x00lib is supposed
635 * to catch this and send us the correct antenna explicitely.
636 */
637 BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
638 ant->tx == ANTENNA_SW_DIVERSITY);
639
650 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { 640 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
651 sel = antenna_sel_a; 641 sel = antenna_sel_a;
652 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 642 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 72c2827ee57c..d0e97e1dfaf6 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -497,14 +497,8 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
497 else 497 else
498 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); 498 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
499 break; 499 break;
500 case ANTENNA_SW_DIVERSITY:
501 /*
502 * NOTE: We should never come here because rt2x00lib is
503 * supposed to catch this and send us the correct antenna
504 * explicitely. However we are nog going to bug about this.
505 * Instead, just default to antenna B.
506 */
507 case ANTENNA_B: 500 case ANTENNA_B:
501 default:
508 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 502 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
509 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); 503 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
510 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) 504 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ)
@@ -545,14 +539,8 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
545 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3); 539 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 3);
546 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 540 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
547 break; 541 break;
548 case ANTENNA_SW_DIVERSITY:
549 /*
550 * NOTE: We should never come here because rt2x00lib is
551 * supposed to catch this and send us the correct antenna
552 * explicitely. However we are nog going to bug about this.
553 * Instead, just default to antenna B.
554 */
555 case ANTENNA_B: 542 case ANTENNA_B:
543 default:
556 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0); 544 rt2x00_set_field8(&r77, BBP_R77_RX_ANTENNA, 0);
557 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1); 545 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA_CONTROL, 1);
558 break; 546 break;
@@ -602,6 +590,13 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev,
602 unsigned int i; 590 unsigned int i;
603 u32 reg; 591 u32 reg;
604 592
593 /*
594 * We should never come here because rt2x00lib is supposed
595 * to catch this and send us the correct antenna explicitely.
596 */
597 BUG_ON(ant->rx == ANTENNA_SW_DIVERSITY ||
598 ant->tx == ANTENNA_SW_DIVERSITY);
599
605 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) { 600 if (rt2x00dev->curr_band == IEEE80211_BAND_5GHZ) {
606 sel = antenna_sel_a; 601 sel = antenna_sel_a;
607 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags); 602 lna = test_bit(CONFIG_EXTERNAL_LNA_A, &rt2x00dev->flags);