diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2007-10-13 10:26:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:02:52 -0500 |
commit | 39e75857d08fe35ffad4dd9004580acf0d725b75 (patch) | |
tree | da50bf796ebbabb31d1fa889a396138e8c3ae8ea | |
parent | addc81bd428f9eb29ed2ab64ad4039c6aed55aea (diff) |
[PATCH] rt2x00: SW diversity should default to antenna B
Although ANTENNA_SW_DIVERSITY should never be send
to the driver, we should still handle it to prevent bugs.
But instead of defaulting to ANTENNA_HW_DIVERSITY we
should default to ANTENNA_B instead.
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>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 16 |
5 files changed, 72 insertions, 18 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 2284cb308971..5b3adbae4820 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -409,13 +409,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
409 | * Configure the TX antenna. | 409 | * Configure the TX antenna. |
410 | */ | 410 | */ |
411 | switch (ant->tx) { | 411 | switch (ant->tx) { |
412 | case ANTENNA_SW_DIVERSITY: | ||
413 | case ANTENNA_HW_DIVERSITY: | 412 | case ANTENNA_HW_DIVERSITY: |
414 | rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1); | 413 | rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1); |
415 | break; | 414 | break; |
416 | case ANTENNA_A: | 415 | case ANTENNA_A: |
417 | rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0); | 416 | rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 0); |
418 | break; | 417 | break; |
418 | case ANTENNA_SW_DIVERSITY: | ||
419 | /* | ||
420 | * NOTE: We should never come here because rt2x00lib is | ||
421 | * supposed to catch this and send us the correct antenna | ||
422 | * explicitely. However we are nog going to bug about this. | ||
423 | * Instead, just default to antenna B. | ||
424 | */ | ||
419 | case ANTENNA_B: | 425 | case ANTENNA_B: |
420 | rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2); | 426 | rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 2); |
421 | break; | 427 | break; |
@@ -425,13 +431,19 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
425 | * Configure the RX antenna. | 431 | * Configure the RX antenna. |
426 | */ | 432 | */ |
427 | switch (ant->rx) { | 433 | switch (ant->rx) { |
428 | case ANTENNA_SW_DIVERSITY: | ||
429 | case ANTENNA_HW_DIVERSITY: | 434 | case ANTENNA_HW_DIVERSITY: |
430 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 435 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
431 | break; | 436 | break; |
432 | case ANTENNA_A: | 437 | case ANTENNA_A: |
433 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0); | 438 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 0); |
434 | break; | 439 | break; |
440 | case ANTENNA_SW_DIVERSITY: | ||
441 | /* | ||
442 | * NOTE: We should never come here because rt2x00lib is | ||
443 | * supposed to catch this and send us the correct antenna | ||
444 | * explicitely. However we are nog going to bug about this. | ||
445 | * Instead, just default to antenna B. | ||
446 | */ | ||
435 | case ANTENNA_B: | 447 | case ANTENNA_B: |
436 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 448 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
437 | break; | 449 | break; |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index a9872f95361b..958b148d8f50 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -438,17 +438,19 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
438 | * Configure the TX antenna. | 438 | * Configure the TX antenna. |
439 | */ | 439 | */ |
440 | switch (ant->tx) { | 440 | switch (ant->tx) { |
441 | case ANTENNA_SW_DIVERSITY: | ||
442 | case ANTENNA_HW_DIVERSITY: | ||
443 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); | ||
444 | rt2x00_set_field32(®, BBPCSR1_CCK, 2); | ||
445 | rt2x00_set_field32(®, BBPCSR1_OFDM, 2); | ||
446 | break; | ||
447 | case ANTENNA_A: | 441 | case ANTENNA_A: |
448 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 0); | 442 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 0); |
449 | rt2x00_set_field32(®, BBPCSR1_CCK, 0); | 443 | rt2x00_set_field32(®, BBPCSR1_CCK, 0); |
450 | rt2x00_set_field32(®, BBPCSR1_OFDM, 0); | 444 | rt2x00_set_field32(®, BBPCSR1_OFDM, 0); |
451 | break; | 445 | break; |
446 | case ANTENNA_HW_DIVERSITY: | ||
447 | case ANTENNA_SW_DIVERSITY: | ||
448 | /* | ||
449 | * NOTE: We should never come here because rt2x00lib is | ||
450 | * supposed to catch this and send us the correct antenna | ||
451 | * explicitely. However we are nog going to bug about this. | ||
452 | * Instead, just default to antenna B. | ||
453 | */ | ||
452 | case ANTENNA_B: | 454 | case ANTENNA_B: |
453 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); | 455 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); |
454 | rt2x00_set_field32(®, BBPCSR1_CCK, 2); | 456 | rt2x00_set_field32(®, BBPCSR1_CCK, 2); |
@@ -460,13 +462,17 @@ static void rt2500pci_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
460 | * Configure the RX antenna. | 462 | * Configure the RX antenna. |
461 | */ | 463 | */ |
462 | switch (ant->rx) { | 464 | switch (ant->rx) { |
463 | case ANTENNA_SW_DIVERSITY: | ||
464 | case ANTENNA_HW_DIVERSITY: | ||
465 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); | ||
466 | break; | ||
467 | case ANTENNA_A: | 465 | case ANTENNA_A: |
468 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); | 466 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); |
469 | break; | 467 | break; |
468 | case ANTENNA_HW_DIVERSITY: | ||
469 | case ANTENNA_SW_DIVERSITY: | ||
470 | /* | ||
471 | * NOTE: We should never come here because rt2x00lib is | ||
472 | * supposed to catch this and send us the correct antenna | ||
473 | * explicitely. However we are nog going to bug about this. | ||
474 | * Instead, just default to antenna B. | ||
475 | */ | ||
470 | case ANTENNA_B: | 476 | case ANTENNA_B: |
471 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); | 477 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); |
472 | break; | 478 | break; |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 31531f7cc125..60f729044427 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -401,7 +401,6 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
401 | * Configure the TX antenna. | 401 | * Configure the TX antenna. |
402 | */ | 402 | */ |
403 | switch (ant->tx) { | 403 | switch (ant->tx) { |
404 | case ANTENNA_SW_DIVERSITY: | ||
405 | case ANTENNA_HW_DIVERSITY: | 404 | case ANTENNA_HW_DIVERSITY: |
406 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1); | 405 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1); |
407 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 1); | 406 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 1); |
@@ -412,6 +411,13 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
412 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0); | 411 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 0); |
413 | rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0); | 412 | rt2x00_set_field16(&csr6, PHY_CSR6_OFDM, 0); |
414 | break; | 413 | break; |
414 | case ANTENNA_SW_DIVERSITY: | ||
415 | /* | ||
416 | * NOTE: We should never come here because rt2x00lib is | ||
417 | * supposed to catch this and send us the correct antenna | ||
418 | * explicitely. However we are nog going to bug about this. | ||
419 | * Instead, just default to antenna B. | ||
420 | */ | ||
415 | case ANTENNA_B: | 421 | case ANTENNA_B: |
416 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); | 422 | rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 2); |
417 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2); | 423 | rt2x00_set_field16(&csr5, PHY_CSR5_CCK, 2); |
@@ -423,13 +429,19 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
423 | * Configure the RX antenna. | 429 | * Configure the RX antenna. |
424 | */ | 430 | */ |
425 | switch (ant->rx) { | 431 | switch (ant->rx) { |
426 | case ANTENNA_SW_DIVERSITY: | ||
427 | case ANTENNA_HW_DIVERSITY: | 432 | case ANTENNA_HW_DIVERSITY: |
428 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1); | 433 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1); |
429 | break; | 434 | break; |
430 | case ANTENNA_A: | 435 | case ANTENNA_A: |
431 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); | 436 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 0); |
432 | break; | 437 | break; |
438 | case ANTENNA_SW_DIVERSITY: | ||
439 | /* | ||
440 | * NOTE: We should never come here because rt2x00lib is | ||
441 | * supposed to catch this and send us the correct antenna | ||
442 | * explicitely. However we are nog going to bug about this. | ||
443 | * Instead, just default to antenna B. | ||
444 | */ | ||
433 | case ANTENNA_B: | 445 | case ANTENNA_B: |
434 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); | 446 | rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 2); |
435 | break; | 447 | break; |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index b644a66dcb50..aebc96344cd8 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -425,7 +425,6 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
425 | !rt2x00_rf(&rt2x00dev->chip, RF5225)); | 425 | !rt2x00_rf(&rt2x00dev->chip, RF5225)); |
426 | 426 | ||
427 | switch (ant->rx) { | 427 | switch (ant->rx) { |
428 | case ANTENNA_SW_DIVERSITY: | ||
429 | case ANTENNA_HW_DIVERSITY: | 428 | case ANTENNA_HW_DIVERSITY: |
430 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 429 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
431 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, | 430 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, |
@@ -440,6 +439,13 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
440 | else | 439 | else |
441 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | 440 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); |
442 | break; | 441 | break; |
442 | case ANTENNA_SW_DIVERSITY: | ||
443 | /* | ||
444 | * NOTE: We should never come here because rt2x00lib is | ||
445 | * supposed to catch this and send us the correct antenna | ||
446 | * explicitely. However we are nog going to bug about this. | ||
447 | * Instead, just default to antenna B. | ||
448 | */ | ||
443 | case ANTENNA_B: | 449 | case ANTENNA_B: |
444 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 450 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
445 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); | 451 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); |
@@ -473,7 +479,6 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
473 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); | 479 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); |
474 | 480 | ||
475 | switch (ant->rx) { | 481 | switch (ant->rx) { |
476 | case ANTENNA_SW_DIVERSITY: | ||
477 | case ANTENNA_HW_DIVERSITY: | 482 | case ANTENNA_HW_DIVERSITY: |
478 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 483 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
479 | break; | 484 | break; |
@@ -481,6 +486,13 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
481 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 486 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
482 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | 487 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); |
483 | break; | 488 | break; |
489 | case ANTENNA_SW_DIVERSITY: | ||
490 | /* | ||
491 | * NOTE: We should never come here because rt2x00lib is | ||
492 | * supposed to catch this and send us the correct antenna | ||
493 | * explicitely. However we are nog going to bug about this. | ||
494 | * Instead, just default to antenna B. | ||
495 | */ | ||
484 | case ANTENNA_B: | 496 | case ANTENNA_B: |
485 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 497 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
486 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); | 498 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 92c78968a0b9..18324210c13a 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -409,7 +409,6 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
409 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); | 409 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); |
410 | 410 | ||
411 | switch (ant->rx) { | 411 | switch (ant->rx) { |
412 | case ANTENNA_SW_DIVERSITY: | ||
413 | case ANTENNA_HW_DIVERSITY: | 412 | case ANTENNA_HW_DIVERSITY: |
414 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 413 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
415 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, | 414 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, |
@@ -424,6 +423,13 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
424 | else | 423 | else |
425 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | 424 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); |
426 | break; | 425 | break; |
426 | case ANTENNA_SW_DIVERSITY: | ||
427 | /* | ||
428 | * NOTE: We should never come here because rt2x00lib is | ||
429 | * supposed to catch this and send us the correct antenna | ||
430 | * explicitely. However we are nog going to bug about this. | ||
431 | * Instead, just default to antenna B. | ||
432 | */ | ||
427 | case ANTENNA_B: | 433 | case ANTENNA_B: |
428 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 434 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
429 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); | 435 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 0); |
@@ -456,7 +462,6 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
456 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); | 462 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); |
457 | 463 | ||
458 | switch (ant->rx) { | 464 | switch (ant->rx) { |
459 | case ANTENNA_SW_DIVERSITY: | ||
460 | case ANTENNA_HW_DIVERSITY: | 465 | case ANTENNA_HW_DIVERSITY: |
461 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 466 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
462 | break; | 467 | break; |
@@ -464,6 +469,13 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
464 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 469 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
465 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); | 470 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 3); |
466 | break; | 471 | break; |
472 | case ANTENNA_SW_DIVERSITY: | ||
473 | /* | ||
474 | * NOTE: We should never come here because rt2x00lib is | ||
475 | * supposed to catch this and send us the correct antenna | ||
476 | * explicitely. However we are nog going to bug about this. | ||
477 | * Instead, just default to antenna B. | ||
478 | */ | ||
467 | case ANTENNA_B: | 479 | case ANTENNA_B: |
468 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); | 480 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); |
469 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); | 481 | rt2x00_set_field8(&r77, BBP_R77_PAIR, 0); |