aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath9k/pci.c
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-01-14 20:17:08 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 16:00:33 -0500
commit9dbeb91a8b97e2892c04461e28d2bdd0198b719d (patch)
tree3ac42d298b739da86a991ed2bd53aa12377cb956 /drivers/net/wireless/ath9k/pci.c
parent09329d371e57ff9fcb645b8e2cdee1ec8b9b539f (diff)
ath9k: get EEPROM contents from platform data on AHB bus
On the AR913x SOCs we have to provide EEPROM contents via platform_data, because accessing the flash via MMIO is not safe. Additionally different boards may store the radio calibration data at different locations. Changes-licensed-under: ISC Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Imre Kaloz <kaloz@openwrt.org> Tested-by: Pavel Roskin <proski@gnu.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/pci.c')
-rw-r--r--drivers/net/wireless/ath9k/pci.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c
index 4ff1caa9ba9..05612bf2836 100644
--- a/drivers/net/wireless/ath9k/pci.c
+++ b/drivers/net/wireless/ath9k/pci.c
@@ -58,9 +58,27 @@ static void ath_pci_cleanup(struct ath_softc *sc)
pci_disable_device(pdev);
}
+static bool ath_pci_eeprom_read(struct ath_hal *ah, u32 off, u16 *data)
+{
+ (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
+
+ if (!ath9k_hw_wait(ah,
+ AR_EEPROM_STATUS_DATA,
+ AR_EEPROM_STATUS_DATA_BUSY |
+ AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0)) {
+ return false;
+ }
+
+ *data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA),
+ AR_EEPROM_STATUS_DATA_VAL);
+
+ return true;
+}
+
static struct ath_bus_ops ath_pci_bus_ops = {
.read_cachesize = ath_pci_read_cachesize,
.cleanup = ath_pci_cleanup,
+ .eeprom_read = ath_pci_eeprom_read,
};
static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)