aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-03-09 17:45:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-03-13 16:02:36 -0400
commita4fe07d913096f4573512c9369f8ca824fbc2d8f (patch)
tree9d47ba6a24083e84527075e12a41263a3f77ec74 /drivers/net/wireless/rt2x00/rt61pci.c
parenta7f3a06cbb63a16ad7a1720506591d8d12a03029 (diff)
rt2x00: Start bugging when rt2x00lib doesn't filter SW diversity
rt2x00lib should filter SW diversity out before sending any configuration changes to the driver. When rt2x00lib fails to do this, it is important that such events are reported because it _must_ be fixed. So upgrading the error level to a BUG_ON() which will make sure this bug gets noticed whenever it happens. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c36
1 files changed, 13 insertions, 23 deletions
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);