aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-16 22:19:47 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-11-18 14:22:24 -0500
commitaaa13ca2428789b3c8096b5edc175d4d78b5f504 (patch)
treeb0d128512a013abcc50780a1ef6c49396128f666
parenta05b5d45049d60a06a1b12976150572304a51928 (diff)
ath9k_hw: support reading calibration data from flash on AR9003
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>
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 230a1228de8e..9a7e151f0796 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -3271,6 +3271,18 @@ static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
3271 return ar9300_check_header(header); 3271 return ar9300_check_header(header);
3272} 3272}
3273 3273
3274static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
3275 int mdata_size)
3276{
3277 struct ath_common *common = ath9k_hw_common(ah);
3278 u16 *data = (u16 *) mptr;
3279 int i;
3280
3281 for (i = 0; i < mdata_size / 2; i++, data++)
3282 ath9k_hw_nvram_read(common, i, data);
3283
3284 return 0;
3285}
3274/* 3286/*
3275 * Read the configuration data from the eeprom. 3287 * Read the configuration data from the eeprom.
3276 * The data can be put in any specified memory buffer. 3288 * The data can be put in any specified memory buffer.
@@ -3293,6 +3305,9 @@ static int ar9300_eeprom_restore_internal(struct ath_hw *ah,
3293 struct ath_common *common = ath9k_hw_common(ah); 3305 struct ath_common *common = ath9k_hw_common(ah);
3294 eeprom_read_op read; 3306 eeprom_read_op read;
3295 3307
3308 if (ath9k_hw_use_flash(ah))
3309 return ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
3310
3296 word = kzalloc(2048, GFP_KERNEL); 3311 word = kzalloc(2048, GFP_KERNEL);
3297 if (!word) 3312 if (!word)
3298 return -1; 3313 return -1;