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/rt2400pci.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/rt2400pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 25 |
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 | ||
399 | static void rt2400pci_config_antenna(struct rt2x00_dev *rt2x00dev, | 399 | static 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 = |