Commit 3468968ef766d7bb4ab29c0ef7ebd169a4ac2e96
Committed by
John W. Linville
1 parent
a59dadbeea
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
ath9k: allow disabling bands via platform data
Some devices have multiple bands enables in the EEPROM data, even though they are only calibrated for one. Allow platform data to disable unsupported bands. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Showing 4 changed files with 22 additions and 8 deletions Side-by-side Diff
drivers/net/wireless/ath/ath9k/hw.c
... | ... | @@ -2344,17 +2344,25 @@ |
2344 | 2344 | } |
2345 | 2345 | |
2346 | 2346 | eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); |
2347 | - if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) { | |
2348 | - ath_err(common, | |
2349 | - "no band has been marked as supported in EEPROM\n"); | |
2350 | - return -EINVAL; | |
2347 | + | |
2348 | + if (eeval & AR5416_OPFLAGS_11A) { | |
2349 | + if (ah->disable_5ghz) | |
2350 | + ath_warn(common, "disabling 5GHz band\n"); | |
2351 | + else | |
2352 | + pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; | |
2351 | 2353 | } |
2352 | 2354 | |
2353 | - if (eeval & AR5416_OPFLAGS_11A) | |
2354 | - pCap->hw_caps |= ATH9K_HW_CAP_5GHZ; | |
2355 | + if (eeval & AR5416_OPFLAGS_11G) { | |
2356 | + if (ah->disable_2ghz) | |
2357 | + ath_warn(common, "disabling 2GHz band\n"); | |
2358 | + else | |
2359 | + pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; | |
2360 | + } | |
2355 | 2361 | |
2356 | - if (eeval & AR5416_OPFLAGS_11G) | |
2357 | - pCap->hw_caps |= ATH9K_HW_CAP_2GHZ; | |
2362 | + if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) { | |
2363 | + ath_err(common, "both bands are disabled\n"); | |
2364 | + return -EINVAL; | |
2365 | + } | |
2358 | 2366 | |
2359 | 2367 | if (AR_SREV_9485(ah) || |
2360 | 2368 | AR_SREV_9285(ah) || |
drivers/net/wireless/ath/ath9k/hw.h
drivers/net/wireless/ath/ath9k/init.c
... | ... | @@ -531,6 +531,8 @@ |
531 | 531 | ah->is_clk_25mhz = pdata->is_clk_25mhz; |
532 | 532 | ah->get_mac_revision = pdata->get_mac_revision; |
533 | 533 | ah->external_reset = pdata->external_reset; |
534 | + ah->disable_2ghz = pdata->disable_2ghz; | |
535 | + ah->disable_5ghz = pdata->disable_5ghz; | |
534 | 536 | if (!pdata->endian_check) |
535 | 537 | ah->ah_flags |= AH_NO_EEP_SWAP; |
536 | 538 | } |