diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2012-03-14 05:10:46 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-15 13:40:28 -0400 |
commit | caed6579c2f9756d3f5a95e8186fa4c04d64cae2 (patch) | |
tree | 8a31fd1db143bbddce7090b38ec222843086d8f9 /drivers/net/wireless | |
parent | bcf6f96e192d71864685ba7253c94c2002615875 (diff) |
ath9k_hw: Cleanup FastChannelChange
The logic to determine whether to use FCC is a bit convoluted.
Use a small helper function to decide whether FCC is to be
used.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.c | 104 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/hw.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 4 |
3 files changed, 74 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 02cc1ce3dd6..780ecd8aff6 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1521,17 +1521,81 @@ bool ath9k_hw_check_alive(struct ath_hw *ah) | |||
1521 | } | 1521 | } |
1522 | EXPORT_SYMBOL(ath9k_hw_check_alive); | 1522 | EXPORT_SYMBOL(ath9k_hw_check_alive); |
1523 | 1523 | ||
1524 | /* | ||
1525 | * Fast channel change: | ||
1526 | * (Change synthesizer based on channel freq without resetting chip) | ||
1527 | * | ||
1528 | * Don't do FCC when | ||
1529 | * - Flag is not set | ||
1530 | * - Chip is just coming out of full sleep | ||
1531 | * - Channel to be set is same as current channel | ||
1532 | * - Channel flags are different, (eg.,moving from 2GHz to 5GHz channel) | ||
1533 | */ | ||
1534 | static int ath9k_hw_do_fastcc(struct ath_hw *ah, struct ath9k_channel *chan) | ||
1535 | { | ||
1536 | struct ath_common *common = ath9k_hw_common(ah); | ||
1537 | int ret; | ||
1538 | |||
1539 | if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI) | ||
1540 | goto fail; | ||
1541 | |||
1542 | if (ah->chip_fullsleep) | ||
1543 | goto fail; | ||
1544 | |||
1545 | if (!ah->curchan) | ||
1546 | goto fail; | ||
1547 | |||
1548 | if (chan->channel == ah->curchan->channel) | ||
1549 | goto fail; | ||
1550 | |||
1551 | if ((chan->channelFlags & CHANNEL_ALL) != | ||
1552 | (ah->curchan->channelFlags & CHANNEL_ALL)) | ||
1553 | goto fail; | ||
1554 | |||
1555 | if (!ath9k_hw_check_alive(ah)) | ||
1556 | goto fail; | ||
1557 | |||
1558 | /* | ||
1559 | * For AR9462, make sure that calibration data for | ||
1560 | * re-using are present. | ||
1561 | */ | ||
1562 | if (AR_SREV_9462(ah) && (!ah->caldata || | ||
1563 | !ah->caldata->done_txiqcal_once || | ||
1564 | !ah->caldata->done_txclcal_once || | ||
1565 | !ah->caldata->rtt_hist.num_readings)) | ||
1566 | goto fail; | ||
1567 | |||
1568 | ath_dbg(common, RESET, "FastChannelChange for %d -> %d\n", | ||
1569 | ah->curchan->channel, chan->channel); | ||
1570 | |||
1571 | ret = ath9k_hw_channel_change(ah, chan); | ||
1572 | if (!ret) | ||
1573 | goto fail; | ||
1574 | |||
1575 | ath9k_hw_loadnf(ah, ah->curchan); | ||
1576 | ath9k_hw_start_nfcal(ah, true); | ||
1577 | |||
1578 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_MCI) && ar9003_mci_is_ready(ah)) | ||
1579 | ar9003_mci_2g5g_switch(ah, true); | ||
1580 | |||
1581 | if (AR_SREV_9271(ah)) | ||
1582 | ar9002_hw_load_ani_reg(ah, chan); | ||
1583 | |||
1584 | return 0; | ||
1585 | fail: | ||
1586 | return -EINVAL; | ||
1587 | } | ||
1588 | |||
1524 | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | 1589 | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, |
1525 | struct ath9k_hw_cal_data *caldata, bool bChannelChange) | 1590 | struct ath9k_hw_cal_data *caldata, bool fastcc) |
1526 | { | 1591 | { |
1527 | struct ath_common *common = ath9k_hw_common(ah); | 1592 | struct ath_common *common = ath9k_hw_common(ah); |
1528 | u32 saveLedState; | 1593 | u32 saveLedState; |
1529 | struct ath9k_channel *curchan = ah->curchan; | ||
1530 | u32 saveDefAntenna; | 1594 | u32 saveDefAntenna; |
1531 | u32 macStaId1; | 1595 | u32 macStaId1; |
1532 | u64 tsf = 0; | 1596 | u64 tsf = 0; |
1533 | int i, r; | 1597 | int i, r; |
1534 | bool allow_fbs = false, start_mci_reset = false; | 1598 | bool start_mci_reset = false; |
1535 | bool mci = !!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI); | 1599 | bool mci = !!(ah->caps.hw_caps & ATH9K_HW_CAP_MCI); |
1536 | bool save_fullsleep = ah->chip_fullsleep; | 1600 | bool save_fullsleep = ah->chip_fullsleep; |
1537 | 1601 | ||
@@ -1544,8 +1608,8 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1544 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) | 1608 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) |
1545 | return -EIO; | 1609 | return -EIO; |
1546 | 1610 | ||
1547 | if (curchan && !ah->chip_fullsleep) | 1611 | if (ah->curchan && !ah->chip_fullsleep) |
1548 | ath9k_hw_getnf(ah, curchan); | 1612 | ath9k_hw_getnf(ah, ah->curchan); |
1549 | 1613 | ||
1550 | ah->caldata = caldata; | 1614 | ah->caldata = caldata; |
1551 | if (caldata && | 1615 | if (caldata && |
@@ -1558,32 +1622,10 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | |||
1558 | } | 1622 | } |
1559 | ah->noise = ath9k_hw_getchan_noise(ah, chan); | 1623 | ah->noise = ath9k_hw_getchan_noise(ah, chan); |
1560 | 1624 | ||
1561 | if (AR_SREV_9280(ah) && common->bus_ops->ath_bus_type == ATH_PCI) | 1625 | if (fastcc) { |
1562 | bChannelChange = false; | 1626 | r = ath9k_hw_do_fastcc(ah, chan); |
1563 | 1627 | if (!r) | |
1564 | if (caldata && | 1628 | return r; |
1565 | caldata->done_txiqcal_once && | ||
1566 | caldata->done_txclcal_once && | ||
1567 | caldata->rtt_hist.num_readings) | ||
1568 | allow_fbs = true; | ||
1569 | |||
1570 | if (bChannelChange && | ||
1571 | (ah->chip_fullsleep != true) && | ||
1572 | (ah->curchan != NULL) && | ||
1573 | (chan->channel != ah->curchan->channel) && | ||
1574 | (allow_fbs || | ||
1575 | ((chan->channelFlags & CHANNEL_ALL) == | ||
1576 | (ah->curchan->channelFlags & CHANNEL_ALL)))) { | ||
1577 | if (ath9k_hw_channel_change(ah, chan)) { | ||
1578 | ath9k_hw_loadnf(ah, ah->curchan); | ||
1579 | ath9k_hw_start_nfcal(ah, true); | ||
1580 | if (mci && ar9003_mci_is_ready(ah)) | ||
1581 | ar9003_mci_2g5g_switch(ah, true); | ||
1582 | |||
1583 | if (AR_SREV_9271(ah)) | ||
1584 | ar9002_hw_load_ani_reg(ah, chan); | ||
1585 | return 0; | ||
1586 | } | ||
1587 | } | 1629 | } |
1588 | 1630 | ||
1589 | if (mci) | 1631 | if (mci) |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 1707137e0a3..23c8dfae29f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -924,7 +924,7 @@ const char *ath9k_hw_probe(u16 vendorid, u16 devid); | |||
924 | void ath9k_hw_deinit(struct ath_hw *ah); | 924 | void ath9k_hw_deinit(struct ath_hw *ah); |
925 | int ath9k_hw_init(struct ath_hw *ah); | 925 | int ath9k_hw_init(struct ath_hw *ah); |
926 | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, | 926 | int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, |
927 | struct ath9k_hw_cal_data *caldata, bool bChannelChange); | 927 | struct ath9k_hw_cal_data *caldata, bool fastcc); |
928 | int ath9k_hw_fill_cap_info(struct ath_hw *ah); | 928 | int ath9k_hw_fill_cap_info(struct ath_hw *ah); |
929 | u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); | 929 | u32 ath9k_regd_get_ctl(struct ath_regulatory *reg, struct ath9k_channel *chan); |
930 | 930 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 77c61bcd34e..a07565c730b 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -334,10 +334,6 @@ static int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan, | |||
334 | hchan = ah->curchan; | 334 | hchan = ah->curchan; |
335 | } | 335 | } |
336 | 336 | ||
337 | if (fastcc && (ah->chip_fullsleep || | ||
338 | !ath9k_hw_check_alive(ah))) | ||
339 | fastcc = false; | ||
340 | |||
341 | if (!ath_prepare_reset(sc, retry_tx, flush)) | 337 | if (!ath_prepare_reset(sc, retry_tx, flush)) |
342 | fastcc = false; | 338 | fastcc = false; |
343 | 339 | ||