diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt61pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 86e7a50374b9..87012f88461f 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2514,10 +2514,11 @@ static const struct rf_channel rf_vals_seq[] = { | |||
2514 | { 46, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000c0a23 }, | 2514 | { 46, 0x00002ccc, 0x000049a6, 0x0009be55, 0x000c0a23 }, |
2515 | }; | 2515 | }; |
2516 | 2516 | ||
2517 | static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | 2517 | static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) |
2518 | { | 2518 | { |
2519 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 2519 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
2520 | u8 *txpower; | 2520 | struct channel_info *info; |
2521 | char *tx_power; | ||
2521 | unsigned int i; | 2522 | unsigned int i; |
2522 | 2523 | ||
2523 | /* | 2524 | /* |
@@ -2534,20 +2535,10 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2534 | EEPROM_MAC_ADDR_0)); | 2535 | EEPROM_MAC_ADDR_0)); |
2535 | 2536 | ||
2536 | /* | 2537 | /* |
2537 | * Convert tx_power array in eeprom. | ||
2538 | */ | ||
2539 | txpower = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); | ||
2540 | for (i = 0; i < 14; i++) | ||
2541 | txpower[i] = TXPOWER_FROM_DEV(txpower[i]); | ||
2542 | |||
2543 | /* | ||
2544 | * Initialize hw_mode information. | 2538 | * Initialize hw_mode information. |
2545 | */ | 2539 | */ |
2546 | spec->supported_bands = SUPPORT_BAND_2GHZ; | 2540 | spec->supported_bands = SUPPORT_BAND_2GHZ; |
2547 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; | 2541 | spec->supported_rates = SUPPORT_RATE_CCK | SUPPORT_RATE_OFDM; |
2548 | spec->tx_power_a = NULL; | ||
2549 | spec->tx_power_bg = txpower; | ||
2550 | spec->tx_power_default = DEFAULT_TXPOWER; | ||
2551 | 2542 | ||
2552 | if (!test_bit(CONFIG_RF_SEQUENCE, &rt2x00dev->flags)) { | 2543 | if (!test_bit(CONFIG_RF_SEQUENCE, &rt2x00dev->flags)) { |
2553 | spec->num_channels = 14; | 2544 | spec->num_channels = 14; |
@@ -2561,13 +2552,28 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) | |||
2561 | rt2x00_rf(&rt2x00dev->chip, RF5325)) { | 2552 | rt2x00_rf(&rt2x00dev->chip, RF5325)) { |
2562 | spec->supported_bands |= SUPPORT_BAND_5GHZ; | 2553 | spec->supported_bands |= SUPPORT_BAND_5GHZ; |
2563 | spec->num_channels = ARRAY_SIZE(rf_vals_seq); | 2554 | spec->num_channels = ARRAY_SIZE(rf_vals_seq); |
2555 | } | ||
2556 | |||
2557 | /* | ||
2558 | * Create channel information array | ||
2559 | */ | ||
2560 | info = kzalloc(spec->num_channels * sizeof(*info), GFP_KERNEL); | ||
2561 | if (!info) | ||
2562 | return -ENOMEM; | ||
2563 | |||
2564 | spec->channels_info = info; | ||
2564 | 2565 | ||
2565 | txpower = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); | 2566 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_G_START); |
2566 | for (i = 0; i < 14; i++) | 2567 | for (i = 0; i < 14; i++) |
2567 | txpower[i] = TXPOWER_FROM_DEV(txpower[i]); | 2568 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); |
2568 | 2569 | ||
2569 | spec->tx_power_a = txpower; | 2570 | if (spec->num_channels > 14) { |
2571 | tx_power = rt2x00_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_A_START); | ||
2572 | for (i = 14; i < spec->num_channels; i++) | ||
2573 | info[i].tx_power1 = TXPOWER_FROM_DEV(tx_power[i]); | ||
2570 | } | 2574 | } |
2575 | |||
2576 | return 0; | ||
2571 | } | 2577 | } |
2572 | 2578 | ||
2573 | static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) | 2579 | static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) |
@@ -2588,7 +2594,9 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
2588 | /* | 2594 | /* |
2589 | * Initialize hw specifications. | 2595 | * Initialize hw specifications. |
2590 | */ | 2596 | */ |
2591 | rt61pci_probe_hw_mode(rt2x00dev); | 2597 | retval = rt61pci_probe_hw_mode(rt2x00dev); |
2598 | if (retval) | ||
2599 | return retval; | ||
2592 | 2600 | ||
2593 | /* | 2601 | /* |
2594 | * This device requires firmware and DMA mapped skbs. | 2602 | * This device requires firmware and DMA mapped skbs. |