aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2400pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2400pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 31bbb44611e5..2284cb308971 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -397,7 +397,7 @@ static void rt2400pci_config_txpower(struct rt2x00_dev *rt2x00dev, int txpower)
397} 397}
398 398
399static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, 399static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
400 int antenna_tx, int antenna_rx) 400 struct antenna_setup *ant)
401{ 401{
402 u8 r1; 402 u8 r1;
403 u8 r4; 403 u8 r4;
@@ -408,7 +408,7 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
408 /* 408 /*
409 * Configure the TX antenna. 409 * Configure the TX antenna.
410 */ 410 */
411 switch (antenna_tx) { 411 switch (ant->tx) {
412 case ANTENNA_SW_DIVERSITY: 412 case ANTENNA_SW_DIVERSITY:
413 case ANTENNA_HW_DIVERSITY: 413 case ANTENNA_HW_DIVERSITY:
414 rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1); 414 rt2x00_set_field8(&r1, BBP_R1_TX_ANTENNA, 1);
@@ -424,7 +424,7 @@ static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev,
424 /* 424 /*
425 * Configure the RX antenna. 425 * Configure the RX antenna.
426 */ 426 */
427 switch (antenna_rx) { 427 switch (ant->rx) {
428 case ANTENNA_SW_DIVERSITY: 428 case ANTENNA_SW_DIVERSITY:
429 case ANTENNA_HW_DIVERSITY: 429 case ANTENNA_HW_DIVERSITY:
430 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1); 430 rt2x00_set_field8(&r4, BBP_R4_RX_ANTENNA, 1);
@@ -485,9 +485,7 @@ static void rt2400pci_config(struct rt2x00_dev *rt2x00dev,
485 rt2400pci_config_txpower(rt2x00dev, 485 rt2400pci_config_txpower(rt2x00dev,
486 libconf->conf->power_level); 486 libconf->conf->power_level);
487 if (flags & CONFIG_UPDATE_ANTENNA) 487 if (flags & CONFIG_UPDATE_ANTENNA)
488 rt2400pci_config_antenna(rt2x00dev, 488 rt2400pci_config_antenna(rt2x00dev, &libconf->ant);
489 libconf->conf->antenna_sel_tx,
490 libconf->conf->antenna_sel_rx);
491 if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT)) 489 if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT))
492 rt2400pci_config_duration(rt2x00dev, libconf); 490 rt2400pci_config_duration(rt2x00dev, libconf);
493} 491}
@@ -1316,12 +1314,23 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
1316 /* 1314 /*
1317 * Identify default antenna configuration. 1315 * Identify default antenna configuration.
1318 */ 1316 */
1319 rt2x00dev->hw->conf.antenna_sel_tx = 1317 rt2x00dev->default_ant.tx =
1320 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); 1318 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT);
1321 rt2x00dev->hw->conf.antenna_sel_rx = 1319 rt2x00dev->default_ant.rx =
1322 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); 1320 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT);
1323 1321
1324 /* 1322 /*
1323 * When the eeprom indicates SW_DIVERSITY use HW_DIVERSITY instead.
1324 * I am not 100% sure about this, but the legacy drivers do not
1325 * indicate antenna swapping in software is required when
1326 * diversity is enabled.
1327 */
1328 if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
1329 rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY;
1330 if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
1331 rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY;
1332
1333 /*
1325 * Store led mode, for correct led behaviour. 1334 * Store led mode, for correct led behaviour.
1326 */ 1335 */
1327 rt2x00dev->led_mode = 1336 rt2x00dev->led_mode =