300-ath9k_gpio_settings.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --- a/drivers/net/wireless/ath/ath9k/debug.c
  2. +++ b/drivers/net/wireless/ath/ath9k/debug.c
  3. @@ -927,6 +927,12 @@ int ath9k_init_debug(struct ath_hw *ah)
  4. sc->debug.debugfs_phy, &ah->config.cwm_ignore_extcca))
  5. goto err;
  6. + debugfs_create_u32("gpio_mask", S_IRUSR | S_IWUSR,
  7. + sc->debug.debugfs_phy, &sc->sc_ah->gpio_mask);
  8. +
  9. + debugfs_create_u32("gpio_val", S_IRUSR | S_IWUSR,
  10. + sc->debug.debugfs_phy, &sc->sc_ah->gpio_val);
  11. +
  12. sc->debug.regidx = 0;
  13. return 0;
  14. err:
  15. --- a/drivers/net/wireless/ath/ath9k/hw.h
  16. +++ b/drivers/net/wireless/ath/ath9k/hw.h
  17. @@ -791,6 +791,8 @@ struct ath_hw {
  18. int initPDADC;
  19. int PDADCdelta;
  20. u8 led_pin;
  21. + u32 gpio_mask;
  22. + u32 gpio_val;
  23. struct ar5416IniArray iniModes;
  24. struct ar5416IniArray iniCommon;
  25. --- a/drivers/net/wireless/ath/ath9k/hw.c
  26. +++ b/drivers/net/wireless/ath/ath9k/hw.c
  27. @@ -1171,6 +1171,20 @@ static bool ath9k_hw_channel_change(stru
  28. return true;
  29. }
  30. +static void ath9k_hw_apply_gpio_override(struct ath_hw *ah)
  31. +{
  32. + u32 gpio_mask = ah->gpio_mask;
  33. + int i;
  34. +
  35. + for (i = 0; gpio_mask; i++, gpio_mask >>= 1) {
  36. + if (!(gpio_mask & 1))
  37. + continue;
  38. +
  39. + ath9k_hw_cfg_output(ah, i, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  40. + ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i)));
  41. + }
  42. +}
  43. +
  44. bool ath9k_hw_check_alive(struct ath_hw *ah)
  45. {
  46. int count = 50;
  47. @@ -1459,6 +1473,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
  48. if (AR_SREV_9300_20_OR_LATER(ah))
  49. ar9003_hw_bb_watchdog_config(ah);
  50. + ath9k_hw_apply_gpio_override(ah);
  51. +
  52. return 0;
  53. }
  54. EXPORT_SYMBOL(ath9k_hw_reset);