ath9k doesn't check (and eventually swap) the endianness of caldata if
platform_data is set.

In my platform I have the caldata in flash (hence platform_data is set) but
I need ath9k to swap the bytes, so I added a field to platform_data to force
the check.

Maybe there's a better way, but since nobody replied when I asked, I did it
this way.

Note that the method described in

http://wiki.openwrt.org/doc/devel/patches

doesn't seem to work with mac80211, so I had to do the patch manually.

Signed-off-by: Luca Olivetti <l...@ventoso.org>

---

Index: 
package/mac80211/patches/410-ath9k-check-endianness-in-platform-data.patch
===================================================================
--- package/mac80211/patches/410-ath9k-check-endianness-in-platform-data.patch  
(revisiĆ³n: 0)
+++ package/mac80211/patches/410-ath9k-check-endianness-in-platform-data.patch  
(revisiĆ³n: 0)
@@ -0,0 +1,42 @@
+--- a/drivers/net/wireless/ath/ath9k/eeprom_def.c      2011-02-08 
17:33:42.000000000 +0100
++++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c      2011-02-20 
17:51:47.000000000 +0100
+@@ -14,8 +14,11 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+ 
++#include <linux/ath9k_platform.h>
++
+ #include "hw.h"
+ #include "ar9002_phy.h"
++#include "ath9k.h"
+ 
+ static void ath9k_get_txgain_index(struct ath_hw *ah,
+               struct ath9k_channel *chan,
+@@ -137,6 +140,8 @@
+       struct ar5416_eeprom_def *eep =
+               (struct ar5416_eeprom_def *) &ah->eeprom.def;
+       struct ath_common *common = ath9k_hw_common(ah);
++      struct ath_softc *sc = common->priv;
++      struct ath9k_platform_data *pdata = sc->dev->platform_data;
+       u16 *eepdata, temp, magic, magic2;
+       u32 sum = 0, el;
+       bool need_swap = false;
+@@ -147,7 +152,7 @@
+               return false;
+       }
+ 
+-      if (!ath9k_hw_use_flash(ah)) {
++      if (!ath9k_hw_use_flash(ah) || pdata->check_endianness) {
+               ath_dbg(common, ATH_DBG_EEPROM,
+                       "Read Magic = 0x%04X\n", magic);
+ 
+--- a/include/linux/ath9k_platform.h   2011-02-20 14:45:42.000000000 +0100
++++ b/include/linux/ath9k_platform.h   2011-02-20 17:17:22.000000000 +0100
+@@ -28,6 +28,7 @@
+       int led_pin;
+       u32 gpio_mask;
+       u32 gpio_val;
++      int check_endianness;
+ };
+ 
+ #endif /* _LINUX_ATH9K_PLATFORM_H */
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to