ath9k: allow to load EEPROM content via firmware API
The calibration data for devices w/o a separate EEPROM chip can be specified via the 'eeprom_data' field of 'ath9k_platform_data'. The 'eeprom_data' is usually filled from board specific setup functions. It is easy if the EEPROM data is mapped to the memory, but it can be complicated if it is stored elsewhere. The patch adds support for loading of the EEPROM data via the firmware API to avoid this limitation. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
0e4b9f2f12
commit
ab5c4f71d8
@@ -113,12 +113,29 @@ void ath9k_hw_usb_gen_fill_eeprom(struct ath_hw *ah, u16 *eep_data,
|
||||
}
|
||||
}
|
||||
|
||||
static bool ath9k_hw_nvram_read_blob(struct ath_hw *ah, u32 off,
|
||||
u16 *data)
|
||||
{
|
||||
u16 *blob_data;
|
||||
|
||||
if (off * sizeof(u16) > ah->eeprom_blob->size)
|
||||
return false;
|
||||
|
||||
blob_data = (u16 *)ah->eeprom_blob->data;
|
||||
*data = blob_data[off];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data)
|
||||
{
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
bool ret;
|
||||
|
||||
ret = common->bus_ops->eeprom_read(common, off, data);
|
||||
if (ah->eeprom_blob)
|
||||
ret = ath9k_hw_nvram_read_blob(ah, off, data);
|
||||
else
|
||||
ret = common->bus_ops->eeprom_read(common, off, data);
|
||||
|
||||
if (!ret)
|
||||
ath_dbg(common, EEPROM,
|
||||
"unable to read eeprom region at offset %u\n", off);
|
||||
|
Reference in New Issue
Block a user