543-ath9k-allow-to-disable-bands-via-platform-data.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --- a/include/linux/ath9k_platform.h
  2. +++ b/include/linux/ath9k_platform.h
  3. @@ -33,6 +33,9 @@ struct ath9k_platform_data {
  4. bool endian_check;
  5. bool is_clk_25mhz;
  6. + bool disable_2ghz;
  7. + bool disable_5ghz;
  8. +
  9. int (*get_mac_revision)(void);
  10. int (*external_reset)(void);
  11. --- a/drivers/net/wireless/ath/ath9k/hw.c
  12. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  13. @@ -2456,17 +2456,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
  14. }
  15. eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
  16. - if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
  17. - ath_err(common,
  18. - "no band has been marked as supported in EEPROM\n");
  19. - return -EINVAL;
  20. +
  21. + if (eeval & AR5416_OPFLAGS_11A) {
  22. + if (ah->disable_5ghz)
  23. + ath_warn(common, "disabling 5GHz band\n");
  24. + else
  25. + pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
  26. }
  27. - if (eeval & AR5416_OPFLAGS_11A)
  28. - pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
  29. + if (eeval & AR5416_OPFLAGS_11G) {
  30. + if (ah->disable_2ghz)
  31. + ath_warn(common, "disabling 2GHz band\n");
  32. + else
  33. + pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
  34. + }
  35. - if (eeval & AR5416_OPFLAGS_11G)
  36. - pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
  37. + if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) {
  38. + ath_err(common, "both bands are disabled\n");
  39. + return -EINVAL;
  40. + }
  41. if (AR_SREV_9485(ah) ||
  42. AR_SREV_9285(ah) ||
  43. --- a/drivers/net/wireless/ath/ath9k/hw.h
  44. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  45. @@ -955,6 +955,8 @@ struct ath_hw {
  46. bool is_clk_25mhz;
  47. int (*get_mac_revision)(void);
  48. int (*external_reset)(void);
  49. + bool disable_2ghz;
  50. + bool disable_5ghz;
  51. const struct firmware *eeprom_blob;
  52. };
  53. --- a/drivers/net/wireless/ath/ath9k/init.c
  54. +++ b/drivers/net/wireless/ath/ath9k/init.c
  55. @@ -631,6 +631,8 @@ static int ath9k_init_softc(u16 devid, s
  56. ah->is_clk_25mhz = pdata->is_clk_25mhz;
  57. ah->get_mac_revision = pdata->get_mac_revision;
  58. ah->external_reset = pdata->external_reset;
  59. + ah->disable_2ghz = pdata->disable_2ghz;
  60. + ah->disable_5ghz = pdata->disable_5ghz;
  61. if (!pdata->endian_check)
  62. ah->ah_flags |= AH_NO_EEP_SWAP;
  63. }