diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 215 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 58 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.h | 2 |
4 files changed, 189 insertions, 88 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index c57d39002bfb..7c97761034e7 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -424,6 +424,29 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
424 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, | 424 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, |
425 | !rt2x00_rf(&rt2x00dev->chip, RF5225)); | 425 | !rt2x00_rf(&rt2x00dev->chip, RF5225)); |
426 | 426 | ||
427 | /* | ||
428 | * Configure the TX antenna. | ||
429 | */ | ||
430 | switch (ant->tx) { | ||
431 | case ANTENNA_A: | ||
432 | rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 0); | ||
433 | break; | ||
434 | case ANTENNA_SW_DIVERSITY: | ||
435 | case ANTENNA_HW_DIVERSITY: | ||
436 | /* | ||
437 | * NOTE: We should never come here because rt2x00lib is | ||
438 | * supposed to catch this and send us the correct antenna | ||
439 | * explicitely. However we are nog going to bug about this. | ||
440 | * Instead, just default to antenna B. | ||
441 | */ | ||
442 | case ANTENNA_B: | ||
443 | rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 3); | ||
444 | break; | ||
445 | } | ||
446 | |||
447 | /* | ||
448 | * Configure the RX antenna. | ||
449 | */ | ||
427 | switch (ant->rx) { | 450 | switch (ant->rx) { |
428 | case ANTENNA_HW_DIVERSITY: | 451 | case ANTENNA_HW_DIVERSITY: |
429 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 452 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
@@ -433,11 +456,6 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
433 | case ANTENNA_A: | 456 | case ANTENNA_A: |
434 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 457 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
435 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); | 458 | 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, 0); | ||
439 | else | ||
440 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | ||
441 | break; | 459 | break; |
442 | case ANTENNA_SW_DIVERSITY: | 460 | case ANTENNA_SW_DIVERSITY: |
443 | /* | 461 | /* |
@@ -449,11 +467,6 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
449 | case ANTENNA_B: | 467 | case ANTENNA_B: |
450 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 468 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
451 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); | 469 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); |
452 | |||
453 | if (rt2x00dev->curr_hwmode == HWMODE_A) | ||
454 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | ||
455 | else | ||
456 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); | ||
457 | break; | 470 | break; |
458 | } | 471 | } |
459 | 472 | ||
@@ -478,13 +491,35 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
478 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, | 491 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, |
479 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); | 492 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); |
480 | 493 | ||
494 | /* | ||
495 | * Configure the TX antenna. | ||
496 | */ | ||
497 | switch (ant->tx) { | ||
498 | case ANTENNA_A: | ||
499 | rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 0); | ||
500 | break; | ||
501 | case ANTENNA_SW_DIVERSITY: | ||
502 | case ANTENNA_HW_DIVERSITY: | ||
503 | /* | ||
504 | * NOTE: We should never come here because rt2x00lib is | ||
505 | * supposed to catch this and send us the correct antenna | ||
506 | * explicitely. However we are nog going to bug about this. | ||
507 | * Instead, just default to antenna B. | ||
508 | */ | ||
509 | case ANTENNA_B: | ||
510 | rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 3); | ||
511 | break; | ||
512 | } | ||
513 | |||
514 | /* | ||
515 | * Configure the RX antenna. | ||
516 | */ | ||
481 | switch (ant->rx) { | 517 | switch (ant->rx) { |
482 | case ANTENNA_HW_DIVERSITY: | 518 | case ANTENNA_HW_DIVERSITY: |
483 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 519 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
484 | break; | 520 | break; |
485 | case ANTENNA_A: | 521 | case ANTENNA_A: |
486 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 522 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
487 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | ||
488 | break; | 523 | break; |
489 | case ANTENNA_SW_DIVERSITY: | 524 | case ANTENNA_SW_DIVERSITY: |
490 | /* | 525 | /* |
@@ -495,7 +530,6 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
495 | */ | 530 | */ |
496 | case ANTENNA_B: | 531 | case ANTENNA_B: |
497 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 532 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
498 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); | ||
499 | break; | 533 | break; |
500 | } | 534 | } |
501 | 535 | ||
@@ -530,74 +564,75 @@ static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, | |||
530 | u8 r3; | 564 | u8 r3; |
531 | u8 r4; | 565 | u8 r4; |
532 | u8 r77; | 566 | u8 r77; |
567 | u8 rx_ant; | ||
533 | 568 | ||
534 | rt61pci_bbp_read(rt2x00dev, 3, &r3); | 569 | rt61pci_bbp_read(rt2x00dev, 3, &r3); |
535 | rt61pci_bbp_read(rt2x00dev, 4, &r4); | 570 | rt61pci_bbp_read(rt2x00dev, 4, &r4); |
536 | rt61pci_bbp_read(rt2x00dev, 77, &r77); | 571 | rt61pci_bbp_read(rt2x00dev, 77, &r77); |
572 | |||
537 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); | 573 | rt2x00_eeprom_read(rt2x00dev, EEPROM_NIC, &eeprom); |
574 | rx_ant = !!(rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED) & 2); | ||
538 | 575 | ||
539 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); | 576 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); |
540 | 577 | ||
541 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_ENABLE_DIVERSITY) && | 578 | /* |
542 | rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY)) { | 579 | * Configure the TX antenna. |
543 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 580 | */ |
544 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 1); | 581 | switch (ant->tx) { |
545 | rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 1); | 582 | case ANTENNA_A: |
546 | } else if (rt2x00_get_field16(eeprom, EEPROM_NIC_ENABLE_DIVERSITY)) { | 583 | rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 0); |
547 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED) >= 2) { | 584 | break; |
548 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | 585 | case ANTENNA_SW_DIVERSITY: |
549 | rt61pci_bbp_write(rt2x00dev, 77, r77); | 586 | case ANTENNA_HW_DIVERSITY: |
550 | } | 587 | /* |
551 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 588 | * NOTE: We should never come here because rt2x00lib is |
552 | rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1); | 589 | * supposed to catch this and send us the correct antenna |
553 | } else if (!rt2x00_get_field16(eeprom, EEPROM_NIC_ENABLE_DIVERSITY) && | 590 | * explicitely. However we are nog going to bug about this. |
554 | rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY)) { | 591 | * Instead, just default to antenna B. |
555 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 592 | */ |
556 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); | 593 | case ANTENNA_B: |
594 | rt2x00_set_field8(&r77, BBP_R77_TX_ANTENNA, 3); | ||
595 | break; | ||
596 | } | ||
557 | 597 | ||
558 | switch (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED)) { | 598 | /* |
559 | case 0: | 599 | * Configure the RX antenna. |
560 | rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 1); | 600 | */ |
561 | break; | 601 | switch (ant->rx) { |
562 | case 1: | 602 | case ANTENNA_A: |
563 | rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 0); | 603 | rt61pci_config_antenna_2529_rx(rt2x00dev, 0, rx_ant); |
564 | break; | 604 | break; |
565 | case 2: | 605 | case ANTENNA_SW_DIVERSITY: |
566 | rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0); | 606 | case ANTENNA_HW_DIVERSITY: |
567 | break; | 607 | /* |
568 | case 3: | 608 | * NOTE: We should never come here because rt2x00lib is |
569 | rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1); | 609 | * supposed to catch this and send us the correct antenna |
570 | break; | 610 | * explicitely. However we are nog going to bug about this. |
571 | } | 611 | * Instead, just default to antenna B. |
572 | } else if (!rt2x00_get_field16(eeprom, EEPROM_NIC_ENABLE_DIVERSITY) && | 612 | */ |
573 | !rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY)) { | 613 | case ANTENNA_B: |
614 | rt61pci_config_antenna_2529_rx(rt2x00dev, 1, rx_ant); | ||
615 | break; | ||
616 | } | ||
617 | |||
618 | /* | ||
619 | * FIXME: We are using the default antenna setup to | ||
620 | * determine the remaining settings. This because we | ||
621 | * need to know what the EEPROM indicated. | ||
622 | * It is however unclear if this is required, and overall | ||
623 | * using the default antenna settings here is incorrect | ||
624 | * since mac80211 might have told us to use fixed settings. | ||
625 | */ | ||
626 | if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY) | ||
627 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | ||
628 | else | ||
574 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 629 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
575 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); | ||
576 | 630 | ||
577 | switch (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED)) { | 631 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, |
578 | case 0: | 632 | (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY) && |
579 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); | 633 | (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)); |
580 | rt61pci_bbp_write(rt2x00dev, 77, r77); | ||
581 | rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 1); | ||
582 | break; | ||
583 | case 1: | ||
584 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); | ||
585 | rt61pci_bbp_write(rt2x00dev, 77, r77); | ||
586 | rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 0); | ||
587 | break; | ||
588 | case 2: | ||
589 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | ||
590 | rt61pci_bbp_write(rt2x00dev, 77, r77); | ||
591 | rt61pci_config_antenna_2529_rx(rt2x00dev, 0, 0); | ||
592 | break; | ||
593 | case 3: | ||
594 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | ||
595 | rt61pci_bbp_write(rt2x00dev, 77, r77); | ||
596 | rt61pci_config_antenna_2529_rx(rt2x00dev, 1, 1); | ||
597 | break; | ||
598 | } | ||
599 | } | ||
600 | 634 | ||
635 | rt61pci_bbp_write(rt2x00dev, 77, r77); | ||
601 | rt61pci_bbp_write(rt2x00dev, 3, r3); | 636 | rt61pci_bbp_write(rt2x00dev, 3, r3); |
602 | rt61pci_bbp_write(rt2x00dev, 4, r4); | 637 | rt61pci_bbp_write(rt2x00dev, 4, r4); |
603 | } | 638 | } |
@@ -2031,6 +2066,12 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2031 | } | 2066 | } |
2032 | 2067 | ||
2033 | /* | 2068 | /* |
2069 | * Determine number of antenna's. | ||
2070 | */ | ||
2071 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_NUM) == 2) | ||
2072 | __set_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags); | ||
2073 | |||
2074 | /* | ||
2034 | * Identify default antenna configuration. | 2075 | * Identify default antenna configuration. |
2035 | */ | 2076 | */ |
2036 | rt2x00dev->default_ant.tx = | 2077 | rt2x00dev->default_ant.tx = |
@@ -2045,12 +2086,6 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2045 | __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags); | 2086 | __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags); |
2046 | 2087 | ||
2047 | /* | 2088 | /* |
2048 | * Determine number of antenna's. | ||
2049 | */ | ||
2050 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_NUM) == 2) | ||
2051 | __set_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags); | ||
2052 | |||
2053 | /* | ||
2054 | * Detect if this device has an hardware controlled radio. | 2089 | * Detect if this device has an hardware controlled radio. |
2055 | */ | 2090 | */ |
2056 | #ifdef CONFIG_RT61PCI_RFKILL | 2091 | #ifdef CONFIG_RT61PCI_RFKILL |
@@ -2078,6 +2113,38 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2078 | __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); | 2113 | __set_bit(CONFIG_EXTERNAL_LNA_BG, &rt2x00dev->flags); |
2079 | 2114 | ||
2080 | /* | 2115 | /* |
2116 | * When working with a RF2529 chip without double antenna | ||
2117 | * the antenna settings should be gathered from the NIC | ||
2118 | * eeprom word. | ||
2119 | */ | ||
2120 | if (rt2x00_rf(&rt2x00dev->chip, RF2529) && | ||
2121 | !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) { | ||
2122 | switch (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED)) { | ||
2123 | case 0: | ||
2124 | rt2x00dev->default_ant.tx = ANTENNA_B; | ||
2125 | rt2x00dev->default_ant.rx = ANTENNA_A; | ||
2126 | break; | ||
2127 | case 1: | ||
2128 | rt2x00dev->default_ant.tx = ANTENNA_B; | ||
2129 | rt2x00dev->default_ant.rx = ANTENNA_B; | ||
2130 | break; | ||
2131 | case 2: | ||
2132 | rt2x00dev->default_ant.tx = ANTENNA_A; | ||
2133 | rt2x00dev->default_ant.rx = ANTENNA_A; | ||
2134 | break; | ||
2135 | case 3: | ||
2136 | rt2x00dev->default_ant.tx = ANTENNA_A; | ||
2137 | rt2x00dev->default_ant.rx = ANTENNA_B; | ||
2138 | break; | ||
2139 | } | ||
2140 | |||
2141 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY)) | ||
2142 | rt2x00dev->default_ant.tx = ANTENNA_SW_DIVERSITY; | ||
2143 | if (rt2x00_get_field16(eeprom, EEPROM_NIC_ENABLE_DIVERSITY)) | ||
2144 | rt2x00dev->default_ant.rx = ANTENNA_SW_DIVERSITY; | ||
2145 | } | ||
2146 | |||
2147 | /* | ||
2081 | * Store led settings, for correct led behaviour. | 2148 | * Store led settings, for correct led behaviour. |
2082 | * If the eeprom value is invalid, | 2149 | * If the eeprom value is invalid, |
2083 | * switch to default led mode. | 2150 | * switch to default led mode. |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.h b/drivers/net/wireless/rt2x00/rt61pci.h index 6721d7dd32bc..ba5101649403 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.h +++ b/drivers/net/wireless/rt2x00/rt61pci.h | |||
@@ -1083,7 +1083,7 @@ struct hw_pairwise_ta_entry { | |||
1083 | /* | 1083 | /* |
1084 | * R77 | 1084 | * R77 |
1085 | */ | 1085 | */ |
1086 | #define BBP_R77_PAIR FIELD8(0x03) | 1086 | #define BBP_R77_TX_ANTENNA FIELD8(0x03) |
1087 | 1087 | ||
1088 | /* | 1088 | /* |
1089 | * RF registers | 1089 | * RF registers |
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 | ||
diff --git a/drivers/net/wireless/rt2x00/rt73usb.h b/drivers/net/wireless/rt2x00/rt73usb.h index f0951519f74b..13f479c7da0d 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.h +++ b/drivers/net/wireless/rt2x00/rt73usb.h | |||
@@ -719,7 +719,7 @@ struct hw_pairwise_ta_entry { | |||
719 | /* | 719 | /* |
720 | * R77 | 720 | * R77 |
721 | */ | 721 | */ |
722 | #define BBP_R77_PAIR FIELD8(0x03) | 722 | #define BBP_R77_TX_ANTENNA FIELD8(0x03) |
723 | 723 | ||
724 | /* | 724 | /* |
725 | * RF registers | 725 | * RF registers |