diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-11-16 17:31:29 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-11-16 17:31:29 +0000 |
commit | 3018b457f932157b3aa33d67582cf37dca32e02c (patch) | |
tree | f3d90bd5666255633fce7dabe0717dd586fa04fc /package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch | |
parent | a12a03de8dae6c76d9d3ff764482801fda1df488 (diff) | |
download | mtk-20170518-3018b457f932157b3aa33d67582cf37dca32e02c.zip mtk-20170518-3018b457f932157b3aa33d67582cf37dca32e02c.tar.gz mtk-20170518-3018b457f932157b3aa33d67582cf37dca32e02c.tar.bz2 |
package/mac80211: use platform_data on PCI devices in ath9k
SVN-Revision: 18436
Diffstat (limited to 'package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch')
-rw-r--r-- | package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch b/package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch new file mode 100644 index 0000000..2f33d2e --- /dev/null +++ b/package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch @@ -0,0 +1,58 @@ +--- 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" + + static struct pci_device_id ath_pci_id_table[] __devinitdata = { +@@ -61,21 +62,36 @@ static void ath_pci_cleanup(struct ath_c + + 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; + } + |