ath9k_hw: ignore eeprom magic mismatch on flash based devices
PATCH 1/1 ath9k_hw: ignore eeprom magic mismatch on flash based devices
Many AR913x based devices (maybe others too) do not have a valid EEPROM magic in their calibration data partition.
--- drivers/net/wireless/ath/ath9k/eeprom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/eeprom.c +6 -6
@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_hw *ah, bool *swap_needed, int size)return -EIO ; } -if (magic ==AR5416_EEPROM_MAGIC ) { - *swap_needed = false; - }else if (swab16 (magic) ==AR5416_EEPROM_MAGIC ) { + *swap_needed = false; +if (swab16 (magic) ==AR5416_EEPROM_MAGIC ) {if (ah->ah_flags &AH_NO_EEP_SWAP ) {ath_info (common,"Ignoring endianness difference in EEPROM magic bytes.\n" ); - - *swap_needed = false; }else { *swap_needed = true; } - }else { + }else if (magic !=AR5416_EEPROM_MAGIC ) { +if (ath9k_hw_use_flash (ah)) +return 0 ; +ath_err (common,"Invalid EEPROM Magic (0x%04x).\n" , magic);return -EINVAL ;
Signature · 1 line
2.2.2
Quoted 5 lines · Felix Fietkau
Many AR913x based devices (maybe others too) do not have a valid EEPROM magic in their calibration data partition.
Fixes 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")Signed-off-by Felix Fietkau <[email protected]>
After I misread the patch in the first place here's an explanation what the main point is:
there are (many) devices out there which have the EEPROM data provided on a separate flash (for example in a calibration data partition). In this case there are some manufacturers who have programmed invalid EEPROM magic bytes, thus breaking the check I introduced earlier. The "ath9k_hw_use_flash" check detects exactly this: whenever the EEPROM data comes from an external source then the EEPROM magic check is skipped.
I wonder if we should also backport this to 4.4, because that is affected as well.
Thanks for fixing this Felix and sorry for breaking it!
Quoted 36 lines
--- drivers/net/wireless/ath/ath9k/eeprom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/net/wireless/ath/ath9k/eeprom.c +6
-7@@ -150,18 +150,18 @@ int ath9k_hw_nvram_swap_data(struct ath_hw *ah, bool *swap_needed, int size)return -EIO ; } -if (magic ==AR5416_EEPROM_MAGIC ) { - *swap_needed = false; - }else if (swab16 (magic) ==AR5416_EEPROM_MAGIC ) { + *swap_needed = false; +if (swab16 (magic) ==AR5416_EEPROM_MAGIC ) {if (ah->ah_flags &AH_NO_EEP_SWAP ) {ath_info (common,"Ignoring endianness difference in EEPROM magic bytes.\n" ); - - *swap_needed = false; }else { *swap_needed = true; } - }else { + }else if (magic !=AR5416_EEPROM_MAGIC ) { +if (ath9k_hw_use_flash (ah)) +return 0 ; +ath_err (common,"Invalid EEPROM Magic (0x%04x).\n" , magic);return -EINVAL ; --2.2.2
Quoted 8 lines · Martin Blumenstingl
Quoted 5 lines · Felix Fietkau
Many AR913x based devices (maybe others too) do not have a valid EEPROM magic in their calibration data partition.
Fixes 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")Signed-off-by Felix Fietkau <[email protected]>
I'll queue this to 4.5.
Quoted 2 lines
I wonder if we should also backport this to 4.4, because that is affected as well.
Is it? I don't see 6fa658fd5ab2 in 4.4. Can you double check, please?
Signature · 1 line
Kalle Valo
Kalle Valo
AppliedQuoted 5 lines · Felix Fietkau
Many AR913x based devices (maybe others too) do not have a valid EEPROM magic in their calibration data partition.
Fixes 6fa658fd5ab2 ("ath9k: Simplify and fix eeprom endianness swapping")Signed-off-by Felix Fietkau <[email protected]>
Applied to ath-current in ath.git, thanks.
Signature · 1 line
Kalle Valo