summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/ahb.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/ahb.c
parent09329d371e57ff9fcb645b8e2cdee1ec8b9b539f (diff)
downloadkernel-crypto-9dbeb91a8b97e2892c04461e28d2bdd0198b719d.tar.gz
kernel-crypto-9dbeb91a8b97e2892c04461e28d2bdd0198b719d.tar.xz
kernel-crypto-9dbeb91a8b97e2892c04461e28d2bdd0198b719d.zip
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/ahb.c')
-rw-r--r--drivers/net/wireless/ath9k/ahb.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath9k/ahb.c b/drivers/net/wireless/ath9k/ahb.c
index 8cbd4c2a7fa..7f2c3a09bca 100644
--- a/drivers/net/wireless/ath9k/ahb.c
+++ b/drivers/net/wireless/ath9k/ahb.c
@@ -18,6 +18,7 @@
#include <linux/nl80211.h>
#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
#include "core.h"
#include "reg.h"
#include "hw.h"
@@ -33,9 +34,29 @@ static void ath_ahb_cleanup(struct ath_softc *sc)
iounmap(sc->mem);
}
+static bool ath_ahb_eeprom_read(struct ath_hal *ah, u32 off, u16 *data)
+{
+ struct ath_softc *sc = ah->ah_sc;
+ struct platform_device *pdev = to_platform_device(sc->dev);
+ struct ath9k_platform_data *pdata;
+
+ pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;
+ if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
+ DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
+ "%s: flash read failed, offset %08x is out of range\n",
+ __func__, off);
+ return false;
+ }
+
+ *data = pdata->eeprom_data[off];
+ return true;
+}
+
static struct ath_bus_ops ath_ahb_bus_ops = {
.read_cachesize = ath_ahb_read_cachesize,
.cleanup = ath_ahb_cleanup,
+
+ .eeprom_read = ath_ahb_eeprom_read,
};
static int ath_ahb_probe(struct platform_device *pdev)
@@ -48,6 +69,12 @@ static int ath_ahb_probe(struct platform_device *pdev)
int ret = 0;
struct ath_hal *ah;
+ if (!pdev->dev.platform_data) {
+ dev_err(&pdev->dev, "no platform data specified\n");
+ ret = -EINVAL;
+ goto err_out;
+ }
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(&pdev->dev, "no memory resource found\n");