310-ath9k_hw-ignore-eeprom-magic-mismatch-on-flash-based.patch 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: Felix Fietkau <nbd@openwrt.org>
  2. Date: Thu, 21 Jan 2016 16:28:44 +0100
  3. Subject: [PATCH] ath9k_hw: ignore eeprom magic mismatch on flash based devices
  4. Many AR913x based devices (maybe others too) do not have a valid EEPROM
  5. magic in their calibration data partition.
  6. Fixes: 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")
  7. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  8. ---
  9. --- a/drivers/net/wireless/ath/ath9k/eeprom.c
  10. +++ b/drivers/net/wireless/ath/ath9k/eeprom.c
  11. @@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_
  12. return -EIO;
  13. }
  14. - if (magic == AR5416_EEPROM_MAGIC) {
  15. - *swap_needed = false;
  16. - } else if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  17. + *swap_needed = false;
  18. + if (swab16(magic) == AR5416_EEPROM_MAGIC) {
  19. if (ah->ah_flags & AH_NO_EEP_SWAP) {
  20. ath_info(common,
  21. "Ignoring endianness difference in EEPROM magic bytes.\n");
  22. -
  23. - *swap_needed = false;
  24. } else {
  25. *swap_needed = true;
  26. }
  27. - } else {
  28. + } else if (magic != AR5416_EEPROM_MAGIC) {
  29. + if (ath9k_hw_use_flash(ah))
  30. + return 0;
  31. +
  32. ath_err(common,
  33. "Invalid EEPROM Magic (0x%04x).\n", magic);
  34. return -EINVAL;