Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Felix Fietkau and committed by
John W. Linville
3468968e a59dadbe

+22 -8
+16 -8
drivers/net/wireless/ath/ath9k/hw.c
··· 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) ||
+2
drivers/net/wireless/ath/ath9k/hw.h
··· 930 930 bool is_clk_25mhz; 931 931 int (*get_mac_revision)(void); 932 932 int (*external_reset)(void); 933 + bool disable_2ghz; 934 + bool disable_5ghz; 933 935 934 936 const struct firmware *eeprom_blob; 935 937
+2
drivers/net/wireless/ath/ath9k/init.c
··· 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 }
+2
include/linux/ath9k_platform.h
··· 34 34 bool endian_check; 35 35 bool is_clk_25mhz; 36 36 bool tx_gain_buffalo; 37 + bool disable_2ghz; 38 + bool disable_5ghz; 37 39 38 40 int (*get_mac_revision)(void); 39 41 int (*external_reset)(void);