diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2008-12-23 18:58:40 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:29 -0500 |
commit | ae8d2858c54f52dc4df513a818cc4e1257fd9143 (patch) | |
tree | e58f270784474a5d244b8d296b8e10bb6c912fa2 /drivers/net/wireless/ath9k/hw.c | |
parent | ce111badf5ac387e9eefe1f2bba751f595994cb2 (diff) |
ath9k: consolidate arguments on hw reset
HW reset calls pass the same variables or structs
which we can obtain easily from ah. Although this also applies
during channel changes as we will keep around the ath9k_channel
passed as an argument for now.
We now also now propagate the hw reset errors down.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/hw.c')
-rw-r--r-- | drivers/net/wireless/ath9k/hw.c | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/drivers/net/wireless/ath9k/hw.c b/drivers/net/wireless/ath9k/hw.c index 34474edefc97..46029ec13545 100644 --- a/drivers/net/wireless/ath9k/hw.c +++ b/drivers/net/wireless/ath9k/hw.c | |||
@@ -2222,23 +2222,20 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha | |||
2222 | REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); | 2222 | REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask); |
2223 | } | 2223 | } |
2224 | 2224 | ||
2225 | bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | 2225 | int ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, |
2226 | enum ath9k_ht_macmode macmode, | 2226 | bool bChannelChange) |
2227 | u8 txchainmask, u8 rxchainmask, | ||
2228 | enum ath9k_ht_extprotspacing extprotspacing, | ||
2229 | bool bChannelChange, int *status) | ||
2230 | { | 2227 | { |
2231 | u32 saveLedState; | 2228 | u32 saveLedState; |
2229 | struct ath_softc *sc = ah->ah_sc; | ||
2232 | struct ath_hal_5416 *ahp = AH5416(ah); | 2230 | struct ath_hal_5416 *ahp = AH5416(ah); |
2233 | struct ath9k_channel *curchan = ah->ah_curchan; | 2231 | struct ath9k_channel *curchan = ah->ah_curchan; |
2234 | u32 saveDefAntenna; | 2232 | u32 saveDefAntenna; |
2235 | u32 macStaId1; | 2233 | u32 macStaId1; |
2236 | int ecode; | 2234 | int i, rx_chainmask, r; |
2237 | int i, rx_chainmask; | ||
2238 | 2235 | ||
2239 | ahp->ah_extprotspacing = extprotspacing; | 2236 | ahp->ah_extprotspacing = sc->sc_ht_extprotspacing; |
2240 | ahp->ah_txchainmask = txchainmask; | 2237 | ahp->ah_txchainmask = sc->sc_tx_chainmask; |
2241 | ahp->ah_rxchainmask = rxchainmask; | 2238 | ahp->ah_rxchainmask = sc->sc_rx_chainmask; |
2242 | 2239 | ||
2243 | if (AR_SREV_9280(ah)) { | 2240 | if (AR_SREV_9280(ah)) { |
2244 | ahp->ah_txchainmask &= 0x3; | 2241 | ahp->ah_txchainmask &= 0x3; |
@@ -2249,14 +2246,11 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2249 | DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL, | 2246 | DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL, |
2250 | "invalid channel %u/0x%x; no mapping\n", | 2247 | "invalid channel %u/0x%x; no mapping\n", |
2251 | chan->channel, chan->channelFlags); | 2248 | chan->channel, chan->channelFlags); |
2252 | ecode = -EINVAL; | 2249 | return -EINVAL; |
2253 | goto bad; | ||
2254 | } | 2250 | } |
2255 | 2251 | ||
2256 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) { | 2252 | if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) |
2257 | ecode = -EIO; | 2253 | return -EIO; |
2258 | goto bad; | ||
2259 | } | ||
2260 | 2254 | ||
2261 | if (curchan) | 2255 | if (curchan) |
2262 | ath9k_hw_getnf(ah, curchan); | 2256 | ath9k_hw_getnf(ah, curchan); |
@@ -2270,10 +2264,10 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2270 | (!AR_SREV_9280(ah) || (!IS_CHAN_A_5MHZ_SPACED(chan) && | 2264 | (!AR_SREV_9280(ah) || (!IS_CHAN_A_5MHZ_SPACED(chan) && |
2271 | !IS_CHAN_A_5MHZ_SPACED(ah->ah_curchan)))) { | 2265 | !IS_CHAN_A_5MHZ_SPACED(ah->ah_curchan)))) { |
2272 | 2266 | ||
2273 | if (ath9k_hw_channel_change(ah, chan, macmode)) { | 2267 | if (ath9k_hw_channel_change(ah, chan, sc->tx_chan_width)) { |
2274 | ath9k_hw_loadnf(ah, ah->ah_curchan); | 2268 | ath9k_hw_loadnf(ah, ah->ah_curchan); |
2275 | ath9k_hw_start_nfcal(ah); | 2269 | ath9k_hw_start_nfcal(ah); |
2276 | return true; | 2270 | return 0; |
2277 | } | 2271 | } |
2278 | } | 2272 | } |
2279 | 2273 | ||
@@ -2291,8 +2285,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2291 | 2285 | ||
2292 | if (!ath9k_hw_chip_reset(ah, chan)) { | 2286 | if (!ath9k_hw_chip_reset(ah, chan)) { |
2293 | DPRINTF(ah->ah_sc, ATH_DBG_RESET, "chip reset failed\n"); | 2287 | DPRINTF(ah->ah_sc, ATH_DBG_RESET, "chip reset failed\n"); |
2294 | ecode = -EINVAL; | 2288 | return -EINVAL; |
2295 | goto bad; | ||
2296 | } | 2289 | } |
2297 | 2290 | ||
2298 | if (AR_SREV_9280(ah)) { | 2291 | if (AR_SREV_9280(ah)) { |
@@ -2308,11 +2301,9 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2308 | ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | 2301 | ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
2309 | } | 2302 | } |
2310 | 2303 | ||
2311 | ecode = ath9k_hw_process_ini(ah, chan, macmode); | 2304 | r = ath9k_hw_process_ini(ah, chan, sc->tx_chan_width); |
2312 | if (ecode != 0) { | 2305 | if (r) |
2313 | ecode = -EINVAL; | 2306 | return r; |
2314 | goto bad; | ||
2315 | } | ||
2316 | 2307 | ||
2317 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) | 2308 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
2318 | ath9k_hw_set_delta_slope(ah, chan); | 2309 | ath9k_hw_set_delta_slope(ah, chan); |
@@ -2325,8 +2316,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2325 | if (!ath9k_hw_eeprom_set_board_values(ah, chan)) { | 2316 | if (!ath9k_hw_eeprom_set_board_values(ah, chan)) { |
2326 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, | 2317 | DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, |
2327 | "error setting board options\n"); | 2318 | "error setting board options\n"); |
2328 | ecode = -EIO; | 2319 | return -EIO; |
2329 | goto bad; | ||
2330 | } | 2320 | } |
2331 | 2321 | ||
2332 | ath9k_hw_decrease_chain_power(ah, chan); | 2322 | ath9k_hw_decrease_chain_power(ah, chan); |
@@ -2354,15 +2344,11 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2354 | REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR); | 2344 | REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR); |
2355 | 2345 | ||
2356 | if (AR_SREV_9280_10_OR_LATER(ah)) { | 2346 | if (AR_SREV_9280_10_OR_LATER(ah)) { |
2357 | if (!(ath9k_hw_ar9280_set_channel(ah, chan))) { | 2347 | if (!(ath9k_hw_ar9280_set_channel(ah, chan))) |
2358 | ecode = -EIO; | 2348 | return -EIO; |
2359 | goto bad; | ||
2360 | } | ||
2361 | } else { | 2349 | } else { |
2362 | if (!(ath9k_hw_set_channel(ah, chan))) { | 2350 | if (!(ath9k_hw_set_channel(ah, chan))) |
2363 | ecode = -EIO; | 2351 | return -EIO; |
2364 | goto bad; | ||
2365 | } | ||
2366 | } | 2352 | } |
2367 | 2353 | ||
2368 | for (i = 0; i < AR_NUM_DCU; i++) | 2354 | for (i = 0; i < AR_NUM_DCU; i++) |
@@ -2396,10 +2382,8 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2396 | 2382 | ||
2397 | ath9k_hw_init_bb(ah, chan); | 2383 | ath9k_hw_init_bb(ah, chan); |
2398 | 2384 | ||
2399 | if (!ath9k_hw_init_cal(ah, chan)){ | 2385 | if (!ath9k_hw_init_cal(ah, chan)) |
2400 | ecode = -EIO;; | 2386 | return -EIO;; |
2401 | goto bad; | ||
2402 | } | ||
2403 | 2387 | ||
2404 | rx_chainmask = ahp->ah_rxchainmask; | 2388 | rx_chainmask = ahp->ah_rxchainmask; |
2405 | if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) { | 2389 | if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) { |
@@ -2428,11 +2412,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan, | |||
2428 | #endif | 2412 | #endif |
2429 | } | 2413 | } |
2430 | 2414 | ||
2431 | return true; | 2415 | return 0; |
2432 | bad: | ||
2433 | if (status) | ||
2434 | *status = ecode; | ||
2435 | return false; | ||
2436 | } | 2416 | } |
2437 | 2417 | ||
2438 | /************************/ | 2418 | /************************/ |