aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt61pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-13 10:26:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:51 -0500
commitaddc81bd428f9eb29ed2ab64ad4039c6aed55aea (patch)
tree949871f2ba2d4f215df8bd323b1dec6d7906e104 /drivers/net/wireless/rt2x00/rt61pci.c
parent362f3b6bfbb18b4b8bd8a8ef391fb95efb43c632 (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/rt61pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 83b95a675f08..b644a66dcb50 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -411,8 +411,7 @@ static void rt61pci_config_txpower(struct rt2x00_dev *rt2x00dev,
411} 411}
412 412
413static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev, 413static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
414 const int antenna_tx, 414 struct antenna_setup *ant)
415 const int antenna_rx)
416{ 415{
417 u8 r3; 416 u8 r3;
418 u8 r4; 417 u8 r4;
@@ -425,7 +424,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
425 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE, 424 rt2x00_set_field8(&r3, BBP_R3_SMART_MODE,
426 !rt2x00_rf(&rt2x00dev->chip, RF5225)); 425 !rt2x00_rf(&rt2x00dev->chip, RF5225));
427 426
428 switch (antenna_rx) { 427 switch (ant->rx) {
429 case ANTENNA_SW_DIVERSITY: 428 case ANTENNA_SW_DIVERSITY:
430 case ANTENNA_HW_DIVERSITY: 429 case ANTENNA_HW_DIVERSITY:
431 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 430 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
@@ -458,8 +457,7 @@ static void rt61pci_config_antenna_5x(struct rt2x00_dev *rt2x00dev,
458} 457}
459 458
460static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev, 459static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
461 const int antenna_tx, 460 struct antenna_setup *ant)
462 const int antenna_rx)
463{ 461{
464 u8 r3; 462 u8 r3;
465 u8 r4; 463 u8 r4;
@@ -474,7 +472,7 @@ static void rt61pci_config_antenna_2x(struct rt2x00_dev *rt2x00dev,
474 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END, 472 rt2x00_set_field8(&r4, BBP_R4_RX_FRAME_END,
475 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags)); 473 !test_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags));
476 474
477 switch (antenna_rx) { 475 switch (ant->rx) {
478 case ANTENNA_SW_DIVERSITY: 476 case ANTENNA_SW_DIVERSITY:
479 case ANTENNA_HW_DIVERSITY: 477 case ANTENNA_HW_DIVERSITY:
480 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2); 478 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 2);
@@ -514,8 +512,7 @@ static void rt61pci_config_antenna_2529_rx(struct rt2x00_dev *rt2x00dev,
514} 512}
515 513
516static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev, 514static void rt61pci_config_antenna_2529(struct rt2x00_dev *rt2x00dev,
517 const int antenna_tx, 515 struct antenna_setup *ant)
518 const int antenna_rx)
519{ 516{
520 u16 eeprom; 517 u16 eeprom;
521 u8 r3; 518 u8 r3;
@@ -625,7 +622,7 @@ static const struct antenna_sel antenna_sel_bg[] = {
625}; 622};
626 623
627static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev, 624static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev,
628 const int antenna_tx, const int antenna_rx) 625 struct antenna_setup *ant)
629{ 626{
630 const struct antenna_sel *sel; 627 const struct antenna_sel *sel;
631 unsigned int lna; 628 unsigned int lna;
@@ -655,16 +652,14 @@ static void rt61pci_config_antenna(struct rt2x00_dev *rt2x00dev,
655 652
656 if (rt2x00_rf(&rt2x00dev->chip, RF5225) || 653 if (rt2x00_rf(&rt2x00dev->chip, RF5225) ||
657 rt2x00_rf(&rt2x00dev->chip, RF5325)) 654 rt2x00_rf(&rt2x00dev->chip, RF5325))
658 rt61pci_config_antenna_5x(rt2x00dev, antenna_tx, antenna_rx); 655 rt61pci_config_antenna_5x(rt2x00dev, ant);
659 else if (rt2x00_rf(&rt2x00dev->chip, RF2527)) 656 else if (rt2x00_rf(&rt2x00dev->chip, RF2527))
660 rt61pci_config_antenna_2x(rt2x00dev, antenna_tx, antenna_rx); 657 rt61pci_config_antenna_2x(rt2x00dev, ant);
661 else if (rt2x00_rf(&rt2x00dev->chip, RF2529)) { 658 else if (rt2x00_rf(&rt2x00dev->chip, RF2529)) {
662 if (test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) 659 if (test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags))
663 rt61pci_config_antenna_2x(rt2x00dev, antenna_tx, 660 rt61pci_config_antenna_2x(rt2x00dev, ant);
664 antenna_rx);
665 else 661 else
666 rt61pci_config_antenna_2529(rt2x00dev, antenna_tx, 662 rt61pci_config_antenna_2529(rt2x00dev, ant);
667 antenna_rx);
668 } 663 }
669} 664}
670 665
@@ -709,8 +704,7 @@ static void rt61pci_config(struct rt2x00_dev *rt2x00dev,
709 if ((flags & CONFIG_UPDATE_TXPOWER) && !(flags & CONFIG_UPDATE_CHANNEL)) 704 if ((flags & CONFIG_UPDATE_TXPOWER) && !(flags & CONFIG_UPDATE_CHANNEL))
710 rt61pci_config_txpower(rt2x00dev, libconf->conf->power_level); 705 rt61pci_config_txpower(rt2x00dev, libconf->conf->power_level);
711 if (flags & CONFIG_UPDATE_ANTENNA) 706 if (flags & CONFIG_UPDATE_ANTENNA)
712 rt61pci_config_antenna(rt2x00dev, libconf->conf->antenna_sel_tx, 707 rt61pci_config_antenna(rt2x00dev, &libconf->ant);
713 libconf->conf->antenna_sel_rx);
714 if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT)) 708 if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT))
715 rt61pci_config_duration(rt2x00dev, libconf); 709 rt61pci_config_duration(rt2x00dev, libconf);
716} 710}
@@ -2029,9 +2023,9 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
2029 /* 2023 /*
2030 * Identify default antenna configuration. 2024 * Identify default antenna configuration.
2031 */ 2025 */
2032 rt2x00dev->hw->conf.antenna_sel_tx = 2026 rt2x00dev->default_ant.tx =
2033 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); 2027 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT);
2034 rt2x00dev->hw->conf.antenna_sel_rx = 2028 rt2x00dev->default_ant.rx =
2035 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); 2029 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT);
2036 2030
2037 /* 2031 /*