diff options
Diffstat (limited to 'drivers/net/wireless/ath5k')
| -rw-r--r-- | drivers/net/wireless/ath5k/base.c | 22 | ||||
| -rw-r--r-- | drivers/net/wireless/ath5k/phy.c | 49 | ||||
| -rw-r--r-- | drivers/net/wireless/ath5k/reset.c | 8 |
3 files changed, 45 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index a08bc8a4fb69..32df27a9c7a2 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c | |||
| @@ -214,7 +214,7 @@ static struct pci_driver ath5k_pci_driver = { | |||
| 214 | * Prototypes - MAC 802.11 stack related functions | 214 | * Prototypes - MAC 802.11 stack related functions |
| 215 | */ | 215 | */ |
| 216 | static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | 216 | static int ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb); |
| 217 | static int ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel); | 217 | static int ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan); |
| 218 | static int ath5k_reset_wake(struct ath5k_softc *sc); | 218 | static int ath5k_reset_wake(struct ath5k_softc *sc); |
| 219 | static int ath5k_start(struct ieee80211_hw *hw); | 219 | static int ath5k_start(struct ieee80211_hw *hw); |
| 220 | static void ath5k_stop(struct ieee80211_hw *hw); | 220 | static void ath5k_stop(struct ieee80211_hw *hw); |
| @@ -1038,16 +1038,13 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan) | |||
| 1038 | if (chan->center_freq != sc->curchan->center_freq || | 1038 | if (chan->center_freq != sc->curchan->center_freq || |
| 1039 | chan->hw_value != sc->curchan->hw_value) { | 1039 | chan->hw_value != sc->curchan->hw_value) { |
| 1040 | 1040 | ||
| 1041 | sc->curchan = chan; | ||
| 1042 | sc->curband = &sc->sbands[chan->band]; | ||
| 1043 | |||
| 1044 | /* | 1041 | /* |
| 1045 | * To switch channels clear any pending DMA operations; | 1042 | * To switch channels clear any pending DMA operations; |
| 1046 | * wait long enough for the RX fifo to drain, reset the | 1043 | * wait long enough for the RX fifo to drain, reset the |
| 1047 | * hardware at the new frequency, and then re-enable | 1044 | * hardware at the new frequency, and then re-enable |
| 1048 | * the relevant bits of the h/w. | 1045 | * the relevant bits of the h/w. |
| 1049 | */ | 1046 | */ |
| 1050 | return ath5k_reset(sc, true, true); | 1047 | return ath5k_reset(sc, chan); |
| 1051 | } | 1048 | } |
| 1052 | 1049 | ||
| 1053 | return 0; | 1050 | return 0; |
| @@ -2314,7 +2311,7 @@ ath5k_init(struct ath5k_softc *sc) | |||
| 2314 | sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL | | 2311 | sc->imask = AR5K_INT_RXOK | AR5K_INT_RXERR | AR5K_INT_RXEOL | |
| 2315 | AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL | | 2312 | AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL | |
| 2316 | AR5K_INT_FATAL | AR5K_INT_GLOBAL; | 2313 | AR5K_INT_FATAL | AR5K_INT_GLOBAL; |
| 2317 | ret = ath5k_reset(sc, false, false); | 2314 | ret = ath5k_reset(sc, NULL); |
| 2318 | if (ret) | 2315 | if (ret) |
| 2319 | goto done; | 2316 | goto done; |
| 2320 | 2317 | ||
| @@ -2599,18 +2596,25 @@ drop_packet: | |||
| 2599 | return NETDEV_TX_OK; | 2596 | return NETDEV_TX_OK; |
| 2600 | } | 2597 | } |
| 2601 | 2598 | ||
| 2599 | /* | ||
| 2600 | * Reset the hardware. If chan is not NULL, then also pause rx/tx | ||
| 2601 | * and change to the given channel. | ||
| 2602 | */ | ||
| 2602 | static int | 2603 | static int |
| 2603 | ath5k_reset(struct ath5k_softc *sc, bool stop, bool change_channel) | 2604 | ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan) |
| 2604 | { | 2605 | { |
| 2605 | struct ath5k_hw *ah = sc->ah; | 2606 | struct ath5k_hw *ah = sc->ah; |
| 2606 | int ret; | 2607 | int ret; |
| 2607 | 2608 | ||
| 2608 | ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); | 2609 | ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "resetting\n"); |
| 2609 | 2610 | ||
| 2610 | if (stop) { | 2611 | if (chan) { |
| 2611 | ath5k_hw_set_imr(ah, 0); | 2612 | ath5k_hw_set_imr(ah, 0); |
| 2612 | ath5k_txq_cleanup(sc); | 2613 | ath5k_txq_cleanup(sc); |
| 2613 | ath5k_rx_stop(sc); | 2614 | ath5k_rx_stop(sc); |
| 2615 | |||
| 2616 | sc->curchan = chan; | ||
| 2617 | sc->curband = &sc->sbands[chan->band]; | ||
| 2614 | } | 2618 | } |
| 2615 | ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, true); | 2619 | ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, true); |
| 2616 | if (ret) { | 2620 | if (ret) { |
| @@ -2648,7 +2652,7 @@ ath5k_reset_wake(struct ath5k_softc *sc) | |||
| 2648 | { | 2652 | { |
| 2649 | int ret; | 2653 | int ret; |
| 2650 | 2654 | ||
| 2651 | ret = ath5k_reset(sc, true, true); | 2655 | ret = ath5k_reset(sc, sc->curchan); |
| 2652 | if (!ret) | 2656 | if (!ret) |
| 2653 | ieee80211_wake_queues(sc->hw); | 2657 | ieee80211_wake_queues(sc->hw); |
| 2654 | 2658 | ||
diff --git a/drivers/net/wireless/ath5k/phy.c b/drivers/net/wireless/ath5k/phy.c index 9e2faae5ae94..b48b29dca3d2 100644 --- a/drivers/net/wireless/ath5k/phy.c +++ b/drivers/net/wireless/ath5k/phy.c | |||
| @@ -1487,28 +1487,35 @@ ath5k_get_linear_pcdac_min(const u8 *stepL, const u8 *stepR, | |||
| 1487 | { | 1487 | { |
| 1488 | s8 tmp; | 1488 | s8 tmp; |
| 1489 | s16 min_pwrL, min_pwrR; | 1489 | s16 min_pwrL, min_pwrR; |
| 1490 | s16 pwr_i = pwrL[0]; | 1490 | s16 pwr_i; |
| 1491 | 1491 | ||
| 1492 | do { | 1492 | if (pwrL[0] == pwrL[1]) |
| 1493 | pwr_i--; | 1493 | min_pwrL = pwrL[0]; |
| 1494 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, | 1494 | else { |
| 1495 | pwrL[0], pwrL[1], | 1495 | pwr_i = pwrL[0]; |
| 1496 | stepL[0], stepL[1]); | 1496 | do { |
| 1497 | 1497 | pwr_i--; | |
| 1498 | } while (tmp > 1); | 1498 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, |
| 1499 | 1499 | pwrL[0], pwrL[1], | |
| 1500 | min_pwrL = pwr_i; | 1500 | stepL[0], stepL[1]); |
| 1501 | 1501 | } while (tmp > 1); | |
| 1502 | pwr_i = pwrR[0]; | 1502 | |
| 1503 | do { | 1503 | min_pwrL = pwr_i; |
| 1504 | pwr_i--; | 1504 | } |
| 1505 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, | ||
| 1506 | pwrR[0], pwrR[1], | ||
| 1507 | stepR[0], stepR[1]); | ||
| 1508 | |||
| 1509 | } while (tmp > 1); | ||
| 1510 | 1505 | ||
| 1511 | min_pwrR = pwr_i; | 1506 | if (pwrR[0] == pwrR[1]) |
| 1507 | min_pwrR = pwrR[0]; | ||
| 1508 | else { | ||
| 1509 | pwr_i = pwrR[0]; | ||
| 1510 | do { | ||
| 1511 | pwr_i--; | ||
| 1512 | tmp = (s8) ath5k_get_interpolated_value(pwr_i, | ||
| 1513 | pwrR[0], pwrR[1], | ||
| 1514 | stepR[0], stepR[1]); | ||
| 1515 | } while (tmp > 1); | ||
| 1516 | |||
| 1517 | min_pwrR = pwr_i; | ||
| 1518 | } | ||
| 1512 | 1519 | ||
| 1513 | /* Keep the right boundary so that it works for both curves */ | 1520 | /* Keep the right boundary so that it works for both curves */ |
| 1514 | return max(min_pwrL, min_pwrR); | 1521 | return max(min_pwrL, min_pwrR); |
diff --git a/drivers/net/wireless/ath5k/reset.c b/drivers/net/wireless/ath5k/reset.c index 7a17d31b2fd9..5f72c111c2e8 100644 --- a/drivers/net/wireless/ath5k/reset.c +++ b/drivers/net/wireless/ath5k/reset.c | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | \*****************************/ | 26 | \*****************************/ |
| 27 | 27 | ||
| 28 | #include <linux/pci.h> /* To determine if a card is pci-e */ | 28 | #include <linux/pci.h> /* To determine if a card is pci-e */ |
| 29 | #include <linux/bitops.h> /* For get_bitmask_order */ | 29 | #include <linux/log2.h> |
| 30 | #include "ath5k.h" | 30 | #include "ath5k.h" |
| 31 | #include "reg.h" | 31 | #include "reg.h" |
| 32 | #include "base.h" | 32 | #include "base.h" |
| @@ -69,10 +69,10 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah, | |||
| 69 | 69 | ||
| 70 | /* Get exponent | 70 | /* Get exponent |
| 71 | * ALGO: coef_exp = 14 - highest set bit position */ | 71 | * ALGO: coef_exp = 14 - highest set bit position */ |
| 72 | coef_exp = get_bitmask_order(coef_scaled); | 72 | coef_exp = ilog2(coef_scaled); |
| 73 | 73 | ||
| 74 | /* Doesn't make sense if it's zero*/ | 74 | /* Doesn't make sense if it's zero*/ |
| 75 | if (!coef_exp) | 75 | if (!coef_scaled || !coef_exp) |
| 76 | return -EINVAL; | 76 | return -EINVAL; |
| 77 | 77 | ||
| 78 | /* Note: we've shifted coef_scaled by 24 */ | 78 | /* Note: we've shifted coef_scaled by 24 */ |
| @@ -359,7 +359,7 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial) | |||
| 359 | mode |= AR5K_PHY_MODE_FREQ_5GHZ; | 359 | mode |= AR5K_PHY_MODE_FREQ_5GHZ; |
| 360 | 360 | ||
| 361 | if (ah->ah_radio == AR5K_RF5413) | 361 | if (ah->ah_radio == AR5K_RF5413) |
| 362 | clock |= AR5K_PHY_PLL_40MHZ_5413; | 362 | clock = AR5K_PHY_PLL_40MHZ_5413; |
| 363 | else | 363 | else |
| 364 | clock |= AR5K_PHY_PLL_40MHZ; | 364 | clock |= AR5K_PHY_PLL_40MHZ; |
| 365 | 365 | ||
