summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/eeprom.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-12-10 15:30:28 +0100
committerJohn W. Linville <linville@tuxdriver.com>2012-12-10 15:49:57 -0500
commitab5c4f71d8c7add173a2d32e5beefdaaf1b7cbbc (patch)
tree6eadeb30e44afd144f270c2cbfe04c70bbbd6ffd /drivers/net/wireless/ath/ath9k/eeprom.c
parent0e4b9f2f12e94686855605eda64ea534a95d77f2 (diff)
downloadlinux-ab5c4f71d8c7add173a2d32e5beefdaaf1b7cbbc.tar.gz
linux-ab5c4f71d8c7add173a2d32e5beefdaaf1b7cbbc.tar.bz2
linux-ab5c4f71d8c7add173a2d32e5beefdaaf1b7cbbc.zip
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>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/eeprom.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/eeprom.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index eb9ac5ea6180..971d770722cf 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -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);