aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt73usb.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-27 07:39:57 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:57 -0500
commite4cd2ff89f91b0556a2e2d928219b2908cafd67f (patch)
tree352574531891b099649b53dc121e40660ec77b93 /drivers/net/wireless/rt2x00/rt73usb.c
parente25c4bb913e54d729631ba7eb50daf1d9aacbef6 (diff)
rt2x00: Split rt61/rt73 antenna selection into RX and TX antenna
Based on investigation of the legacy drivers, I have made the following assumptions of the antenna setup: - R77 is the TX antenna configuration - RF2529 fetches default antenna selection from NIC eeprom word With these assumptions we can change the antenna configuration to correctly read both antenna setup values and correctly configure the antenna. And we can now also configure the antenna for RF2529 without a double antenna. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c58
1 files changed, 46 insertions, 12 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index e3d5e78661ea..b9d5310c386f 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -408,6 +408,29 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
408 408
409 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); 409 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0);
410 410
411 /*
412 * Configure the TX antenna.
413 */
414 switch (ant->tx) {
415 case ANTENNA_A:
416 rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 0);
417 break;
418 case ANTENNA_SW_DIVERSITY:
419 case ANTENNA_HW_DIVERSITY:
420 /*
421 * NOTE: We should never come here because rt2x00lib is
422 * supposed to catch this and send us the correct antenna
423 * explicitely. However we are nog going to bug about this.
424 * Instead, just default to antenna B.
425 */
426 case ANTENNA_B:
427 rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 3);
428 break;
429 }
430
431 /*
432 * Configure the RX antenna.
433 */
411 switch (ant->rx) { 434 switch (ant->rx) {
412 case ANTENNA_HW_DIVERSITY: 435 case ANTENNA_HW_DIVERSITY:
413 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 436 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
@@ -417,11 +440,6 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
417 case ANTENNA_A: 440 case ANTENNA_A:
418 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 441 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
419 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); 442 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
420
421 if (rt2x00dev->curr_hwmode == HWMODE_A)
422 rt2x00_set_field8(&r77, BBP_R77_PAIR, 0);
423 else
424 rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
425 break; 443 break;
426 case ANTENNA_SW_DIVERSITY: 444 case ANTENNA_SW_DIVERSITY:
427 /* 445 /*
@@ -433,11 +451,6 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
433 case ANTENNA_B: 451 case ANTENNA_B:
434 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 452 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
435 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); 453 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0);
436
437 if (rt2x00dev->curr_hwmode == HWMODE_A)
438 rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
439 else
440 rt2x00_set_field8(&r77, BBP_R77_PAIR, 0);
441 break; 454 break;
442 } 455 }
443 456
@@ -461,13 +474,35 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
461 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 474 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
462 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); 475 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
463 476
477 /*
478 * Configure the TX antenna.
479 */
480 switch (ant->tx) {
481 case ANTENNA_A:
482 rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 0);
483 break;
484 case ANTENNA_SW_DIVERSITY:
485 case ANTENNA_HW_DIVERSITY:
486 /*
487 * NOTE: We should never come here because rt2x00lib is
488 * supposed to catch this and send us the correct antenna
489 * explicitely. However we are nog going to bug about this.
490 * Instead, just default to antenna B.
491 */
492 case ANTENNA_B:
493 rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 3);
494 break;
495 }
496
497 /*
498 * Configure the RX antenna.
499 */
464 switch (ant->rx) { 500 switch (ant->rx) {
465 case ANTENNA_HW_DIVERSITY: 501 case ANTENNA_HW_DIVERSITY:
466 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 502 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
467 break; 503 break;
468 case ANTENNA_A: 504 case ANTENNA_A:
469 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 505 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
470 rt2x00_set_field8(&r77, BBP_R77_PAIR, 3);
471 break; 506 break;
472 case ANTENNA_SW_DIVERSITY: 507 case ANTENNA_SW_DIVERSITY:
473 /* 508 /*
@@ -478,7 +513,6 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
478 */ 513 */
479 case ANTENNA_B: 514 case ANTENNA_B:
480 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 515 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
481 rt2x00_set_field8(&r77, BBP_R77_PAIR, 0);
482 break; 516 break;
483 } 517 }
484 518