diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-09-09 05:33:11 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:20 -0400 |
commit | af03abecd8e3646736904431f3335dad5e28cb8d (patch) | |
tree | f3522e1dac8916ec7fabcf40f5577cabac3eb43a /drivers/net/wireless/ath/ath9k/main.c | |
parent | 2e20250a2ce1f4a7ba7c83ccb62d9b7b9b96c736 (diff) |
ath9k: move hw specific btcoex info to ath_hw
Since we now access it via the ath_hw declare the ath_hw pointer
at the header of some routines and se it. ath9k.h no longer needs to
access btcoex.h and to adjust for this move ath_btcoex_set_weight()
into btcoex.h and instead give main.c a helper for setting initial
values upon drv_start()
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 612e83678b23..63e1f183b470 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/nl80211.h> | 17 | #include <linux/nl80211.h> |
18 | #include "ath9k.h" | 18 | #include "ath9k.h" |
19 | #include "btcoex.h" | ||
19 | 20 | ||
20 | static char *dev_info = "ath9k"; | 21 | static char *dev_info = "ath9k"; |
21 | 22 | ||
@@ -439,8 +440,10 @@ static void ath_start_ani(struct ath_softc *sc) | |||
439 | */ | 440 | */ |
440 | void ath_update_chainmask(struct ath_softc *sc, int is_ht) | 441 | void ath_update_chainmask(struct ath_softc *sc, int is_ht) |
441 | { | 442 | { |
443 | struct ath_hw *ah = sc->sc_ah; | ||
444 | |||
442 | if ((sc->sc_flags & SC_OP_SCANNING) || is_ht || | 445 | if ((sc->sc_flags & SC_OP_SCANNING) || is_ht || |
443 | (sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE)) { | 446 | (ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE)) { |
444 | sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask; | 447 | sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask; |
445 | sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask; | 448 | sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask; |
446 | } else { | 449 | } else { |
@@ -448,7 +451,7 @@ void ath_update_chainmask(struct ath_softc *sc, int is_ht) | |||
448 | sc->rx_chainmask = 1; | 451 | sc->rx_chainmask = 1; |
449 | } | 452 | } |
450 | 453 | ||
451 | DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n", | 454 | DPRINTF(ah, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n", |
452 | sc->tx_chainmask, sc->rx_chainmask); | 455 | sc->tx_chainmask, sc->rx_chainmask); |
453 | } | 456 | } |
454 | 457 | ||
@@ -478,6 +481,8 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta) | |||
478 | static void ath9k_tasklet(unsigned long data) | 481 | static void ath9k_tasklet(unsigned long data) |
479 | { | 482 | { |
480 | struct ath_softc *sc = (struct ath_softc *)data; | 483 | struct ath_softc *sc = (struct ath_softc *)data; |
484 | struct ath_hw *ah = sc->sc_ah; | ||
485 | |||
481 | u32 status = sc->intrstatus; | 486 | u32 status = sc->intrstatus; |
482 | 487 | ||
483 | ath9k_ps_wakeup(sc); | 488 | ath9k_ps_wakeup(sc); |
@@ -502,16 +507,16 @@ static void ath9k_tasklet(unsigned long data) | |||
502 | * TSF sync does not look correct; remain awake to sync with | 507 | * TSF sync does not look correct; remain awake to sync with |
503 | * the next Beacon. | 508 | * the next Beacon. |
504 | */ | 509 | */ |
505 | DPRINTF(sc->sc_ah, ATH_DBG_PS, "TSFOOR - Sync with next Beacon\n"); | 510 | DPRINTF(ah, ATH_DBG_PS, "TSFOOR - Sync with next Beacon\n"); |
506 | sc->sc_flags |= SC_OP_WAIT_FOR_BEACON | SC_OP_BEACON_SYNC; | 511 | sc->sc_flags |= SC_OP_WAIT_FOR_BEACON | SC_OP_BEACON_SYNC; |
507 | } | 512 | } |
508 | 513 | ||
509 | if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) | 514 | if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) |
510 | if (status & ATH9K_INT_GENTIMER) | 515 | if (status & ATH9K_INT_GENTIMER) |
511 | ath_gen_timer_isr(sc->sc_ah); | 516 | ath_gen_timer_isr(sc->sc_ah); |
512 | 517 | ||
513 | /* re-enable hardware interrupt */ | 518 | /* re-enable hardware interrupt */ |
514 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); | 519 | ath9k_hw_set_interrupts(ah, sc->imask); |
515 | ath9k_ps_restore(sc); | 520 | ath9k_ps_restore(sc); |
516 | } | 521 | } |
517 | 522 | ||
@@ -1281,12 +1286,12 @@ void ath_detach(struct ath_softc *sc) | |||
1281 | if (ATH_TXQ_SETUP(sc, i)) | 1286 | if (ATH_TXQ_SETUP(sc, i)) |
1282 | ath_tx_cleanupq(sc, &sc->tx.txq[i]); | 1287 | ath_tx_cleanupq(sc, &sc->tx.txq[i]); |
1283 | 1288 | ||
1284 | if ((sc->btcoex_info.no_stomp_timer) && | 1289 | if ((ah->btcoex_info.no_stomp_timer) && |
1285 | sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) | 1290 | ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) |
1286 | ath_gen_timer_free(ah, sc->btcoex_info.no_stomp_timer); | 1291 | ath_gen_timer_free(ah, ah->btcoex_info.no_stomp_timer); |
1287 | 1292 | ||
1288 | ath9k_hw_detach(ah); | 1293 | ath9k_hw_detach(ah); |
1289 | ath9k_exit_debug(sc->sc_ah); | 1294 | ath9k_exit_debug(ah); |
1290 | sc->sc_ah = NULL; | 1295 | sc->sc_ah = NULL; |
1291 | } | 1296 | } |
1292 | 1297 | ||
@@ -1516,7 +1521,7 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid) | |||
1516 | ARRAY_SIZE(ath9k_5ghz_chantable); | 1521 | ARRAY_SIZE(ath9k_5ghz_chantable); |
1517 | } | 1522 | } |
1518 | 1523 | ||
1519 | if (sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) { | 1524 | if (ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) { |
1520 | r = ath9k_hw_btcoex_init(ah); | 1525 | r = ath9k_hw_btcoex_init(ah); |
1521 | if (r) | 1526 | if (r) |
1522 | goto bad2; | 1527 | goto bad2; |
@@ -1905,11 +1910,12 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1905 | { | 1910 | { |
1906 | struct ath_wiphy *aphy = hw->priv; | 1911 | struct ath_wiphy *aphy = hw->priv; |
1907 | struct ath_softc *sc = aphy->sc; | 1912 | struct ath_softc *sc = aphy->sc; |
1913 | struct ath_hw *ah = sc->sc_ah; | ||
1908 | struct ieee80211_channel *curchan = hw->conf.channel; | 1914 | struct ieee80211_channel *curchan = hw->conf.channel; |
1909 | struct ath9k_channel *init_channel; | 1915 | struct ath9k_channel *init_channel; |
1910 | int r; | 1916 | int r; |
1911 | 1917 | ||
1912 | DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "Starting driver with " | 1918 | DPRINTF(ah, ATH_DBG_CONFIG, "Starting driver with " |
1913 | "initial channel: %d MHz\n", curchan->center_freq); | 1919 | "initial channel: %d MHz\n", curchan->center_freq); |
1914 | 1920 | ||
1915 | mutex_lock(&sc->mutex); | 1921 | mutex_lock(&sc->mutex); |
@@ -1942,7 +1948,7 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1942 | init_channel = ath_get_curchannel(sc, hw); | 1948 | init_channel = ath_get_curchannel(sc, hw); |
1943 | 1949 | ||
1944 | /* Reset SERDES registers */ | 1950 | /* Reset SERDES registers */ |
1945 | ath9k_hw_configpcipowersave(sc->sc_ah, 0, 0); | 1951 | ath9k_hw_configpcipowersave(ah, 0, 0); |
1946 | 1952 | ||
1947 | /* | 1953 | /* |
1948 | * The basic interface to setting the hardware in a good | 1954 | * The basic interface to setting the hardware in a good |
@@ -1952,9 +1958,9 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1952 | * and then setup of the interrupt mask. | 1958 | * and then setup of the interrupt mask. |
1953 | */ | 1959 | */ |
1954 | spin_lock_bh(&sc->sc_resetlock); | 1960 | spin_lock_bh(&sc->sc_resetlock); |
1955 | r = ath9k_hw_reset(sc->sc_ah, init_channel, false); | 1961 | r = ath9k_hw_reset(ah, init_channel, false); |
1956 | if (r) { | 1962 | if (r) { |
1957 | DPRINTF(sc->sc_ah, ATH_DBG_FATAL, | 1963 | DPRINTF(ah, ATH_DBG_FATAL, |
1958 | "Unable to reset hardware; reset status %d " | 1964 | "Unable to reset hardware; reset status %d " |
1959 | "(freq %u MHz)\n", r, | 1965 | "(freq %u MHz)\n", r, |
1960 | curchan->center_freq); | 1966 | curchan->center_freq); |
@@ -1977,7 +1983,7 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1977 | * here except setup the interrupt mask. | 1983 | * here except setup the interrupt mask. |
1978 | */ | 1984 | */ |
1979 | if (ath_startrecv(sc) != 0) { | 1985 | if (ath_startrecv(sc) != 0) { |
1980 | DPRINTF(sc->sc_ah, ATH_DBG_FATAL, "Unable to start recv logic\n"); | 1986 | DPRINTF(ah, ATH_DBG_FATAL, "Unable to start recv logic\n"); |
1981 | r = -EIO; | 1987 | r = -EIO; |
1982 | goto mutex_unlock; | 1988 | goto mutex_unlock; |
1983 | } | 1989 | } |
@@ -1987,10 +1993,10 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1987 | | ATH9K_INT_RXEOL | ATH9K_INT_RXORN | 1993 | | ATH9K_INT_RXEOL | ATH9K_INT_RXORN |
1988 | | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL; | 1994 | | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL; |
1989 | 1995 | ||
1990 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_GTT) | 1996 | if (ah->caps.hw_caps & ATH9K_HW_CAP_GTT) |
1991 | sc->imask |= ATH9K_INT_GTT; | 1997 | sc->imask |= ATH9K_INT_GTT; |
1992 | 1998 | ||
1993 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) | 1999 | if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) |
1994 | sc->imask |= ATH9K_INT_CST; | 2000 | sc->imask |= ATH9K_INT_CST; |
1995 | 2001 | ||
1996 | ath_cache_conf_rate(sc, &hw->conf); | 2002 | ath_cache_conf_rate(sc, &hw->conf); |
@@ -1999,20 +2005,19 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1999 | 2005 | ||
2000 | /* Disable BMISS interrupt when we're not associated */ | 2006 | /* Disable BMISS interrupt when we're not associated */ |
2001 | sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); | 2007 | sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); |
2002 | ath9k_hw_set_interrupts(sc->sc_ah, sc->imask); | 2008 | ath9k_hw_set_interrupts(ah, sc->imask); |
2003 | 2009 | ||
2004 | ieee80211_wake_queues(hw); | 2010 | ieee80211_wake_queues(hw); |
2005 | 2011 | ||
2006 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); | 2012 | ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
2007 | 2013 | ||
2008 | if ((sc->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) && | 2014 | if ((ah->btcoex_info.btcoex_scheme != ATH_BTCOEX_CFG_NONE) && |
2009 | !(sc->sc_flags & SC_OP_BTCOEX_ENABLED)) { | 2015 | !(sc->sc_flags & SC_OP_BTCOEX_ENABLED)) { |
2010 | ath_btcoex_set_weight(&sc->btcoex_info, AR_BT_COEX_WGHT, | 2016 | ath9k_hw_btcoex_init_weight(ah); |
2011 | AR_STOMP_LOW_WLAN_WGHT); | 2017 | ath9k_hw_btcoex_enable(ah); |
2012 | ath9k_hw_btcoex_enable(sc->sc_ah); | ||
2013 | 2018 | ||
2014 | ath_pcie_aspm_disable(sc); | 2019 | ath_pcie_aspm_disable(sc); |
2015 | if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) | 2020 | if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) |
2016 | ath_btcoex_timer_resume(sc); | 2021 | ath_btcoex_timer_resume(sc); |
2017 | } | 2022 | } |
2018 | 2023 | ||
@@ -2125,6 +2130,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2125 | { | 2130 | { |
2126 | struct ath_wiphy *aphy = hw->priv; | 2131 | struct ath_wiphy *aphy = hw->priv; |
2127 | struct ath_softc *sc = aphy->sc; | 2132 | struct ath_softc *sc = aphy->sc; |
2133 | struct ath_hw *ah = sc->sc_ah; | ||
2128 | 2134 | ||
2129 | mutex_lock(&sc->mutex); | 2135 | mutex_lock(&sc->mutex); |
2130 | 2136 | ||
@@ -2139,7 +2145,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2139 | } | 2145 | } |
2140 | 2146 | ||
2141 | if (sc->sc_flags & SC_OP_INVALID) { | 2147 | if (sc->sc_flags & SC_OP_INVALID) { |
2142 | DPRINTF(sc->sc_ah, ATH_DBG_ANY, "Device not present\n"); | 2148 | DPRINTF(ah, ATH_DBG_ANY, "Device not present\n"); |
2143 | mutex_unlock(&sc->mutex); | 2149 | mutex_unlock(&sc->mutex); |
2144 | return; | 2150 | return; |
2145 | } | 2151 | } |
@@ -2150,32 +2156,32 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
2150 | } | 2156 | } |
2151 | 2157 | ||
2152 | if (sc->sc_flags & SC_OP_BTCOEX_ENABLED) { | 2158 | if (sc->sc_flags & SC_OP_BTCOEX_ENABLED) { |
2153 | ath9k_hw_btcoex_disable(sc->sc_ah); | 2159 | ath9k_hw_btcoex_disable(ah); |
2154 | if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) | 2160 | if (ah->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE) |
2155 | ath_btcoex_timer_pause(sc); | 2161 | ath_btcoex_timer_pause(sc); |
2156 | } | 2162 | } |
2157 | 2163 | ||
2158 | /* make sure h/w will not generate any interrupt | 2164 | /* make sure h/w will not generate any interrupt |
2159 | * before setting the invalid flag. */ | 2165 | * before setting the invalid flag. */ |
2160 | ath9k_hw_set_interrupts(sc->sc_ah, 0); | 2166 | ath9k_hw_set_interrupts(ah, 0); |
2161 | 2167 | ||
2162 | if (!(sc->sc_flags & SC_OP_INVALID)) { | 2168 | if (!(sc->sc_flags & SC_OP_INVALID)) { |
2163 | ath_drain_all_txq(sc, false); | 2169 | ath_drain_all_txq(sc, false); |
2164 | ath_stoprecv(sc); | 2170 | ath_stoprecv(sc); |
2165 | ath9k_hw_phy_disable(sc->sc_ah); | 2171 | ath9k_hw_phy_disable(ah); |
2166 | } else | 2172 | } else |
2167 | sc->rx.rxlink = NULL; | 2173 | sc->rx.rxlink = NULL; |
2168 | 2174 | ||
2169 | /* disable HAL and put h/w to sleep */ | 2175 | /* disable HAL and put h/w to sleep */ |
2170 | ath9k_hw_disable(sc->sc_ah); | 2176 | ath9k_hw_disable(ah); |
2171 | ath9k_hw_configpcipowersave(sc->sc_ah, 1, 1); | 2177 | ath9k_hw_configpcipowersave(ah, 1, 1); |
2172 | ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP); | 2178 | ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP); |
2173 | 2179 | ||
2174 | sc->sc_flags |= SC_OP_INVALID; | 2180 | sc->sc_flags |= SC_OP_INVALID; |
2175 | 2181 | ||
2176 | mutex_unlock(&sc->mutex); | 2182 | mutex_unlock(&sc->mutex); |
2177 | 2183 | ||
2178 | DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, "Driver halt\n"); | 2184 | DPRINTF(ah, ATH_DBG_CONFIG, "Driver halt\n"); |
2179 | } | 2185 | } |
2180 | 2186 | ||
2181 | static int ath9k_add_interface(struct ieee80211_hw *hw, | 2187 | static int ath9k_add_interface(struct ieee80211_hw *hw, |