diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2007-10-13 10:26:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:02:51 -0500 |
commit | addc81bd428f9eb29ed2ab64ad4039c6aed55aea (patch) | |
tree | 949871f2ba2d4f215df8bd323b1dec6d7906e104 /drivers/net/wireless/rt2x00/rt73usb.c | |
parent | 362f3b6bfbb18b4b8bd8a8ef391fb95efb43c632 (diff) |
[PATCH] rt2x00: Correctly translate mac80211 antenna setup to rt2x00
mac80211 has 3 values for the antenna setup:
0 - default
1 - use antenna 1
2 - use antenna 2
This means that rt2x00 should store the default value
from the EEPROM somwhere and use that when mac80211 indicates
that the antenna setup is 0.
This also implies that rt2x00 should no longer write the
hw->config.antenna_sel_* values based on the EEPROM input.
This also adds the basis in rt2x00lib for correct software
diversity handling. By default rt2x00lib will now configure
antenna B instead of hardware diversity.
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.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 96d85aaf4250..92c78968a0b9 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -396,8 +396,7 @@ static void rt73usb_config_txpower(struct rt2x00_dev *rt2x00dev, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | 398 | static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, |
399 | const int antenna_tx, | 399 | struct antenna_setup *ant) |
400 | const int antenna_rx) | ||
401 | { | 400 | { |
402 | u8 r3; | 401 | u8 r3; |
403 | u8 r4; | 402 | u8 r4; |
@@ -409,7 +408,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
409 | 408 | ||
410 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); | 409 | rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 0); |
411 | 410 | ||
412 | switch (antenna_rx) { | 411 | switch (ant->rx) { |
413 | case ANTENNA_SW_DIVERSITY: | 412 | case ANTENNA_SW_DIVERSITY: |
414 | case ANTENNA_HW_DIVERSITY: | 413 | case ANTENNA_HW_DIVERSITY: |
415 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 414 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
@@ -442,8 +441,7 @@ static void rt73usb_config_antenna_5x(struct rt2x00_dev *rt2x00dev, | |||
442 | } | 441 | } |
443 | 442 | ||
444 | static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | 443 | static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, |
445 | const int antenna_tx, | 444 | struct antenna_setup *ant) |
446 | const int antenna_rx) | ||
447 | { | 445 | { |
448 | u8 r3; | 446 | u8 r3; |
449 | u8 r4; | 447 | u8 r4; |
@@ -457,7 +455,7 @@ static void rt73usb_config_antenna_2x(struct rt2x00_dev *rt2x00dev, | |||
457 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, | 455 | rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, |
458 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); | 456 | !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); |
459 | 457 | ||
460 | switch (antenna_rx) { | 458 | switch (ant->rx) { |
461 | case ANTENNA_SW_DIVERSITY: | 459 | case ANTENNA_SW_DIVERSITY: |
462 | case ANTENNA_HW_DIVERSITY: | 460 | case ANTENNA_HW_DIVERSITY: |
463 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); | 461 | rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); |
@@ -509,7 +507,7 @@ static const struct antenna_sel antenna_sel_bg[] = { | |||
509 | }; | 507 | }; |
510 | 508 | ||
511 | static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev, | 509 | static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev, |
512 | const int antenna_tx, const int antenna_rx) | 510 | struct antenna_setup *ant) |
513 | { | 511 | { |
514 | const struct antenna_sel *sel; | 512 | const struct antenna_sel *sel; |
515 | unsigned int lna; | 513 | unsigned int lna; |
@@ -539,10 +537,10 @@ static void rt73usb_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
539 | 537 | ||
540 | if (rt2x00_rf(&rt2x00dev->chip, RF5226) || | 538 | if (rt2x00_rf(&rt2x00dev->chip, RF5226) || |
541 | rt2x00_rf(&rt2x00dev->chip, RF5225)) | 539 | rt2x00_rf(&rt2x00dev->chip, RF5225)) |
542 | rt73usb_config_antenna_5x(rt2x00dev, antenna_tx, antenna_rx); | 540 | rt73usb_config_antenna_5x(rt2x00dev, ant); |
543 | else if (rt2x00_rf(&rt2x00dev->chip, RF2528) || | 541 | else if (rt2x00_rf(&rt2x00dev->chip, RF2528) || |
544 | rt2x00_rf(&rt2x00dev->chip, RF2527)) | 542 | rt2x00_rf(&rt2x00dev->chip, RF2527)) |
545 | rt73usb_config_antenna_2x(rt2x00dev, antenna_tx, antenna_rx); | 543 | rt73usb_config_antenna_2x(rt2x00dev, ant); |
546 | } | 544 | } |
547 | 545 | ||
548 | static void rt73usb_config_duration(struct rt2x00_dev *rt2x00dev, | 546 | static void rt73usb_config_duration(struct rt2x00_dev *rt2x00dev, |
@@ -586,8 +584,7 @@ static void rt73usb_config(struct rt2x00_dev *rt2x00dev, | |||
586 | if ((flags & CONFIG_UPDATE_TXPOWER) && !(flags & CONFIG_UPDATE_CHANNEL)) | 584 | if ((flags & CONFIG_UPDATE_TXPOWER) && !(flags & CONFIG_UPDATE_CHANNEL)) |
587 | rt73usb_config_txpower(rt2x00dev, libconf->conf->power_level); | 585 | rt73usb_config_txpower(rt2x00dev, libconf->conf->power_level); |
588 | if (flags & CONFIG_UPDATE_ANTENNA) | 586 | if (flags & CONFIG_UPDATE_ANTENNA) |
589 | rt73usb_config_antenna(rt2x00dev, libconf->conf->antenna_sel_tx, | 587 | rt73usb_config_antenna(rt2x00dev, &libconf->ant); |
590 | libconf->conf->antenna_sel_rx); | ||
591 | if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT)) | 588 | if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT)) |
592 | rt73usb_config_duration(rt2x00dev, libconf); | 589 | rt73usb_config_duration(rt2x00dev, libconf); |
593 | } | 590 | } |
@@ -1503,9 +1500,9 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1503 | /* | 1500 | /* |
1504 | * Identify default antenna configuration. | 1501 | * Identify default antenna configuration. |
1505 | */ | 1502 | */ |
1506 | rt2x00dev->hw->conf.antenna_sel_tx = | 1503 | rt2x00dev->default_ant.tx = |
1507 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); | 1504 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); |
1508 | rt2x00dev->hw->conf.antenna_sel_rx = | 1505 | rt2x00dev->default_ant.rx = |
1509 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); | 1506 | rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); |
1510 | 1507 | ||
1511 | /* | 1508 | /* |