2009-11-17 01:31:29 +08:00
|
|
|
--- a/drivers/net/wireless/ath/ath9k/pci.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/pci.c
|
|
|
|
@@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
#include <linux/nl80211.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
+#include <linux/ath9k_platform.h>
|
|
|
|
#include "ath9k.h"
|
|
|
|
|
2010-03-08 00:29:28 +08:00
|
|
|
static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
|
2010-04-11 00:50:15 +08:00
|
|
|
@@ -53,21 +54,36 @@ static void ath_pci_read_cachesize(struc
|
2009-11-17 01:31:29 +08:00
|
|
|
|
|
|
|
static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
|
|
|
|
{
|
|
|
|
- struct ath_hw *ah = (struct ath_hw *) common->ah;
|
|
|
|
+ struct ath_softc *sc = (struct ath_softc *) common->priv;
|
|
|
|
+ struct ath9k_platform_data *pdata = sc->dev->platform_data;
|
|
|
|
|
|
|
|
- common->ops->read(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
|
|
|
|
+ if (pdata) {
|
|
|
|
+ if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
|
|
|
|
+ ath_print(common, ATH_DBG_FATAL,
|
|
|
|
+ "%s: eeprom read failed, offset %08x "
|
|
|
|
+ "is out of range\n",
|
|
|
|
+ __func__, off);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ *data = pdata->eeprom_data[off];
|
|
|
|
+ } else {
|
|
|
|
+ struct ath_hw *ah = (struct ath_hw *) common->ah;
|
|
|
|
+
|
|
|
|
+ common->ops->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,
|
|
|
|
+ AH_WAIT_TIMEOUT)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (!ath9k_hw_wait(ah,
|
|
|
|
- AR_EEPROM_STATUS_DATA,
|
|
|
|
- AR_EEPROM_STATUS_DATA_BUSY |
|
|
|
|
- AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0,
|
|
|
|
- AH_WAIT_TIMEOUT)) {
|
|
|
|
- return false;
|
|
|
|
+ *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
|
|
|
|
+ AR_EEPROM_STATUS_DATA_VAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
- *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
|
|
|
|
- AR_EEPROM_STATUS_DATA_VAL);
|
|
|
|
-
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|