diff options
author | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-03-27 13:21:53 +0000 |
---|---|---|
committer | nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-03-27 13:21:53 +0000 |
commit | 9f0871090d031ad656d1d1e77f2881c9a864b343 (patch) | |
tree | e2ca8e84842743218ac6661437d2a9ba46745980 | |
parent | a3bf9b4420d34660c7e4f44c642ed80740fa2d6b (diff) |
ath9k: make endian check optional
Turns out it triggers on some AR71xx devices where no swapping should be done.
Enable endian check for the lantiq target.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31084 3c298f89-4303-0410-b956-a3cf2f4a3e73
3 files changed, 58 insertions, 2 deletions
diff --git a/package/mac80211/patches/501-ath9k-eeprom_endianess.patch b/package/mac80211/patches/501-ath9k-eeprom_endianess.patch index 25d5450a79..3d74cac022 100644 --- a/package/mac80211/patches/501-ath9k-eeprom_endianess.patch +++ b/package/mac80211/patches/501-ath9k-eeprom_endianess.patch @@ -9,7 +9,7 @@ u32 sum = 0, el; bool need_swap = false; int i, addr, size; -@@ -277,27 +277,15 @@ static int ath9k_hw_def_check_eeprom(str +@@ -277,27 +277,16 @@ static int ath9k_hw_def_check_eeprom(str return false; } @@ -34,7 +34,8 @@ - "Invalid EEPROM Magic. Endianness mismatch.\n"); - return -EINVAL; - } -+ if (swab16(magic) == AR5416_EEPROM_MAGIC) { ++ if (swab16(magic) == AR5416_EEPROM_MAGIC && ++ !(ah->ah_flags & AH_NO_EEP_SWAP)) { + size = sizeof(struct ar5416_eeprom_def); + need_swap = true; + eepdata = (u16 *) (&ah->eeprom); @@ -46,3 +47,56 @@ } } +--- a/drivers/net/wireless/ath/ath9k/eeprom_4k.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_4k.c +@@ -196,7 +196,7 @@ static int ath9k_hw_4k_check_eeprom(stru + int i, addr; + + +- if (!ath9k_hw_use_flash(ah)) { ++ if (!(ah->ah_flags & AH_NO_EEP_SWAP)) { + if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, + &magic)) { + ath_err(common, "Reading Magic # failed\n"); +--- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c ++++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c +@@ -189,7 +189,7 @@ static int ath9k_hw_ar9287_check_eeprom( + struct ar9287_eeprom *eep = &ah->eeprom.map9287; + struct ath_common *common = ath9k_hw_common(ah); + +- if (!ath9k_hw_use_flash(ah)) { ++ if (!(ah->ah_flags & AH_NO_EEP_SWAP)) { + if (!ath9k_hw_nvram_read(common, AR5416_EEPROM_MAGIC_OFFSET, + &magic)) { + ath_err(common, "Reading Magic # failed\n"); +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -662,6 +662,7 @@ enum ath_cal_list { + #define AH_USE_EEPROM 0x1 + #define AH_UNPLUGGED 0x2 /* The card has been physically removed. */ + #define AH_FASTCC 0x4 ++#define AH_NO_EEP_SWAP 0x8 /* Do not swap EEPROM data */ + + struct ath_hw { + struct ath_ops reg_ops; +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -537,6 +537,8 @@ static int ath9k_init_softc(u16 devid, s + ah->is_clk_25mhz = pdata->is_clk_25mhz; + ah->get_mac_revision = pdata->get_mac_revision; + ah->external_reset = pdata->external_reset; ++ if (!pdata->endian_check) ++ ah->ah_flags |= AH_NO_EEP_SWAP; + } + + common = ath9k_hw_common(ah); +--- a/include/linux/ath9k_platform.h ++++ b/include/linux/ath9k_platform.h +@@ -29,6 +29,7 @@ struct ath9k_platform_data { + u32 gpio_mask; + u32 gpio_val; + ++ bool endian_check; + bool is_clk_25mhz; + int (*get_mac_revision)(void); + int (*external_reset)(void); diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h index b37d23d834..15b913730f 100644 --- a/target/linux/generic/files/include/linux/ath9k_platform.h +++ b/target/linux/generic/files/include/linux/ath9k_platform.h @@ -29,6 +29,7 @@ struct ath9k_platform_data { u32 gpio_mask; u32 gpio_val; + bool endian_check; bool is_clk_25mhz; int (*get_mac_revision)(void); int (*external_reset)(void); diff --git a/target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/dev-wifi-athxk.c b/target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/dev-wifi-athxk.c index 882cd8cf70..a75abe3e00 100644 --- a/target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/dev-wifi-athxk.c +++ b/target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/dev-wifi-athxk.c @@ -19,6 +19,7 @@ extern int (*ltqpci_plat_dev_init)(struct pci_dev *dev); struct ath5k_platform_data ath5k_pdata; struct ath9k_platform_data ath9k_pdata = { .led_pin = -1, + .endian_check = true, }; static int |