aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500usb.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/rt2500usb.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/rt2500usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 98edd621c13b..31531f7cc125 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -385,7 +385,7 @@ static void rt2500usb_config_txpower(struct rt2x00_dev *rt2x00dev,
385} 385}
386 386
387static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev, 387static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
388 const int antenna_tx, const int antenna_rx) 388 struct antenna_setup *ant)
389{ 389{
390 u8 r2; 390 u8 r2;
391 u8 r14; 391 u8 r14;
@@ -400,7 +400,7 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
400 /* 400 /*
401 * Configure the TX antenna. 401 * Configure the TX antenna.
402 */ 402 */
403 switch (antenna_tx) { 403 switch (ant->tx) {
404 case ANTENNA_SW_DIVERSITY: 404 case ANTENNA_SW_DIVERSITY:
405 case ANTENNA_HW_DIVERSITY: 405 case ANTENNA_HW_DIVERSITY:
406 rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1); 406 rt2x00_set_field8(&r2, BBP_R2_TX_ANTENNA, 1);
@@ -422,7 +422,7 @@ static void rt2500usb_config_antenna(struct rt2x00_dev *rt2x00dev,
422 /* 422 /*
423 * Configure the RX antenna. 423 * Configure the RX antenna.
424 */ 424 */
425 switch (antenna_rx) { 425 switch (ant->rx) {
426 case ANTENNA_SW_DIVERSITY: 426 case ANTENNA_SW_DIVERSITY:
427 case ANTENNA_HW_DIVERSITY: 427 case ANTENNA_HW_DIVERSITY:
428 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1); 428 rt2x00_set_field8(&r14, BBP_R14_RX_ANTENNA, 1);
@@ -487,9 +487,7 @@ static void rt2500usb_config(struct rt2x00_dev *rt2x00dev,
487 rt2500usb_config_txpower(rt2x00dev, 487 rt2500usb_config_txpower(rt2x00dev,
488 libconf->conf->power_level); 488 libconf->conf->power_level);
489 if (flags & CONFIG_UPDATE_ANTENNA) 489 if (flags & CONFIG_UPDATE_ANTENNA)
490 rt2500usb_config_antenna(rt2x00dev, 490 rt2500usb_config_antenna(rt2x00dev, &libconf->ant);
491 libconf->conf->antenna_sel_tx,
492 libconf->conf->antenna_sel_rx);
493 if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT)) 491 if (flags & (CONFIG_UPDATE_SLOT_TIME | CONFIG_UPDATE_BEACON_INT))
494 rt2500usb_config_duration(rt2x00dev, libconf); 492 rt2500usb_config_duration(rt2x00dev, libconf);
495} 493}
@@ -1278,12 +1276,23 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
1278 /* 1276 /*
1279 * Identify default antenna configuration. 1277 * Identify default antenna configuration.
1280 */ 1278 */
1281 rt2x00dev->hw->conf.antenna_sel_tx = 1279 rt2x00dev->default_ant.tx =
1282 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT); 1280 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_TX_DEFAULT);
1283 rt2x00dev->hw->conf.antenna_sel_rx = 1281 rt2x00dev->default_ant.rx =
1284 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT); 1282 rt2x00_get_field16(eeprom, EEPROM_ANTENNA_RX_DEFAULT);
1285 1283
1286 /* 1284 /*
1285 * When the eeprom indicates SW_DIVERSITY use HW_DIVERSITY instead.
1286 * I am not 100% sure about this, but the legacy drivers do not
1287 * indicate antenna swapping in software is required when
1288 * diversity is enabled.
1289 */
1290 if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
1291 rt2x00dev->default_ant.tx = ANTENNA_HW_DIVERSITY;
1292 if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
1293 rt2x00dev->default_ant.rx = ANTENNA_HW_DIVERSITY;
1294
1295 /*
1287 * Store led mode, for correct led behaviour. 1296 * Store led mode, for correct led behaviour.
1288 */ 1297 */
1289 rt2x00dev->led_mode = 1298 rt2x00dev->led_mode =