aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom_def.c31
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/init.c2
-rw-r--r--include/linux/ath9k_platform.h1
4 files changed, 14 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c
index 3218ca994746..122b846b8ec0 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c
@@ -262,7 +262,7 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
262{ 262{
263 struct ar5416_eeprom_def *eep = &ah->eeprom.def; 263 struct ar5416_eeprom_def *eep = &ah->eeprom.def;
264 struct ath_common *common = ath9k_hw_common(ah); 264 struct ath_common *common = ath9k_hw_common(ah);
265 u16 *eepdata, temp, magic, magic2; 265 u16 *eepdata, temp, magic;
266 u32 sum = 0, el; 266 u32 sum = 0, el;
267 bool need_swap = false; 267 bool need_swap = false;
268 int i, addr, size; 268 int i, addr, size;
@@ -272,27 +272,16 @@ static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
272 return false; 272 return false;
273 } 273 }
274 274
275 if (!ath9k_hw_use_flash(ah)) { 275 if (swab16(magic) == AR5416_EEPROM_MAGIC &&
276 ath_dbg(common, EEPROM, "Read Magic = 0x%04X\n", magic); 276 !(ah->ah_flags & AH_NO_EEP_SWAP)) {
277 277 size = sizeof(struct ar5416_eeprom_def);
278 if (magic != AR5416_EEPROM_MAGIC) { 278 need_swap = true;
279 magic2 = swab16(magic); 279 eepdata = (u16 *) (&ah->eeprom);
280
281 if (magic2 == AR5416_EEPROM_MAGIC) {
282 size = sizeof(struct ar5416_eeprom_def);
283 need_swap = true;
284 eepdata = (u16 *) (&ah->eeprom);
285 280
286 for (addr = 0; addr < size / sizeof(u16); addr++) { 281 for (addr = 0; addr < size / sizeof(u16); addr++) {
287 temp = swab16(*eepdata); 282 temp = swab16(*eepdata);
288 *eepdata = temp; 283 *eepdata = temp;
289 eepdata++; 284 eepdata++;
290 }
291 } else {
292 ath_err(common,
293 "Invalid EEPROM Magic. Endianness mismatch.\n");
294 return -EINVAL;
295 }
296 } 285 }
297 } 286 }
298 287
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index f204099c38b8..c6dba9b4afdf 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -731,6 +731,7 @@ enum ath_cal_list {
731#define AH_USE_EEPROM 0x1 731#define AH_USE_EEPROM 0x1
732#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ 732#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
733#define AH_FASTCC 0x4 733#define AH_FASTCC 0x4
734#define AH_NO_EEP_SWAP 0x8 /* Do not swap EEPROM data */
734 735
735struct ath_hw { 736struct ath_hw {
736 struct ath_ops reg_ops; 737 struct ath_ops reg_ops;
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 57a17601b0b6..5d9c711b6aa0 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -531,6 +531,8 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
531 ah->is_clk_25mhz = pdata->is_clk_25mhz; 531 ah->is_clk_25mhz = pdata->is_clk_25mhz;
532 ah->get_mac_revision = pdata->get_mac_revision; 532 ah->get_mac_revision = pdata->get_mac_revision;
533 ah->external_reset = pdata->external_reset; 533 ah->external_reset = pdata->external_reset;
534 if (!pdata->endian_check)
535 ah->ah_flags |= AH_NO_EEP_SWAP;
534 } 536 }
535 537
536 common->ops = &ah->reg_ops; 538 common->ops = &ah->reg_ops;
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index a495a959e8a7..43501657bce9 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -31,6 +31,7 @@ struct ath9k_platform_data {
31 u32 gpio_mask; 31 u32 gpio_mask;
32 u32 gpio_val; 32 u32 gpio_val;
33 33
34 bool endian_check;
34 bool is_clk_25mhz; 35 bool is_clk_25mhz;
35 bool tx_gain_buffalo; 36 bool tx_gain_buffalo;
36 37