ath9k_hw: support reading calibration data from flash on AR9003
authorFelix Fietkau <nbd@openwrt.org>
Wed, 17 Nov 2010 03:19:47 +0000 (04:19 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 18 Nov 2010 19:22:24 +0000 (14:22 -0500)
Embedded boards do not have compressed EEPROM data, they use the
struct ar9003_eeprom layout, with little endian fields, so copying
the raw data to the eeprom buffer is enough.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c

index 230a1228de8e1a5e6764ea84faea0c5b164c7e9d..9a7e151f0796735ec6986216ede492c5c45e631b 100644 (file)
@@ -3271,6 +3271,18 @@ static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
        return ar9300_check_header(header);
 }
 
+static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
+                                      int mdata_size)
+{
+       struct ath_common *common = ath9k_hw_common(ah);
+       u16 *data = (u16 *) mptr;
+       int i;
+
+       for (i = 0; i < mdata_size / 2; i++, data++)
+               ath9k_hw_nvram_read(common, i, data);
+
+       return 0;
+}
 /*
  * Read the configuration data from the eeprom.
  * The data can be put in any specified memory buffer.
@@ -3293,6 +3305,9 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
        struct ath_common *common = ath9k_hw_common(ah);
        eeprom_read_op read;
 
+       if (ath9k_hw_use_flash(ah))
+               return ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
+
        word = kzalloc(2048, GFP_KERNEL);
        if (!word)
                return -1;