From 3018b457f932157b3aa33d67582cf37dca32e02c Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 16 Nov 2009 17:31:29 +0000 Subject: [PATCH] package/mac80211: use platform_data on PCI devices in ath9k SVN-Revision: 18436 --- package/mac80211/Makefile | 2 +- ...m-data-from-platform-data-on-pci-bus.patch | 58 +++++++++++++++++++ ...ROM-only-if-no-platform-data-present.patch | 43 ++++++++++++++ .../patches/560-ath9k_rate_control_api.patch | 8 +-- 4 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 package/mac80211/patches/405-ath9k-read-eeprom-data-from-platform-data-on-pci-bus.patch create mode 100644 package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index e4e9b7b546..d28e08d3ad 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=2009-11-13 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_URL:= \ http://www.orbit-lab.org/kernel/compat-wireless-2.6/2009/11 \ http://wireless.kernel.org/download/compat-wireless-2.6 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 0000000000..2f33d2e20d --- /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 + #include ++#include + #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; + } + diff --git a/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch b/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch new file mode 100644 index 0000000000..8beb224c91 --- /dev/null +++ b/package/mac80211/patches/406-ath9k-set-AH_USE_EEPROM-only-if-no-platform-data-present.patch @@ -0,0 +1,43 @@ +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -433,11 +433,8 @@ static void ath9k_hw_init_defaults(struc + ah->hw_version.magic = AR5416_MAGIC; + ah->hw_version.subvendorid = 0; + +- ah->ah_flags = 0; + if (ah->hw_version.devid == AR5416_AR9100_DEVID) + ah->hw_version.macVersion = AR_SREV_VERSION_9100; +- if (!AR_SREV_9100(ah)) +- ah->ah_flags = AH_USE_EEPROM; + + ah->atim_window = 0; + ah->sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE; +--- a/drivers/net/wireless/ath/ath9k/main.c ++++ b/drivers/net/wireless/ath/ath9k/main.c +@@ -15,6 +15,7 @@ + */ + + #include ++#include + #include "ath9k.h" + #include "btcoex.h" + +@@ -1633,6 +1634,7 @@ static int ath_init_softc(u16 devid, str + { + struct ath_hw *ah = NULL; + struct ath_common *common; ++ struct ath9k_platform_data *pdata; + int r = 0, i; + int csz = 0; + int qnum; +@@ -1656,6 +1658,10 @@ static int ath_init_softc(u16 devid, str + + ah->hw_version.devid = devid; + ah->hw_version.subsysid = subsysid; ++ pdata = (struct ath9k_platform_data *) sc->dev->platform_data; ++ if (!pdata) ++ ah->ah_flags |= AH_USE_EEPROM; ++ + sc->sc_ah = ah; + + common = ath9k_hw_common(ah); diff --git a/package/mac80211/patches/560-ath9k_rate_control_api.patch b/package/mac80211/patches/560-ath9k_rate_control_api.patch index 219bd8b167..13ada5da0d 100644 --- a/package/mac80211/patches/560-ath9k_rate_control_api.patch +++ b/package/mac80211/patches/560-ath9k_rate_control_api.patch @@ -910,7 +910,7 @@ struct ath_led radio_led; --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -104,37 +104,71 @@ static struct ieee80211_channel ath9k_5g +@@ -105,37 +105,71 @@ static struct ieee80211_channel ath9k_5g CHAN5G(5825, 37), /* Channel 165 */ }; @@ -998,7 +998,7 @@ break; default: BUG_ON(1); -@@ -190,51 +224,6 @@ static u8 parse_mpdudensity(u8 mpdudensi +@@ -191,51 +225,6 @@ static u8 parse_mpdudensity(u8 mpdudensi } } @@ -1050,7 +1050,7 @@ static struct ath9k_channel *ath_get_curchannel(struct ath_softc *sc, struct ieee80211_hw *hw) { -@@ -1707,12 +1696,6 @@ static int ath_init_softc(u16 devid, str +@@ -1713,12 +1702,6 @@ static int ath_init_softc(u16 devid, str /* default to MONITOR mode */ sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR; @@ -1063,7 +1063,7 @@ /* * Allocate hardware transmit queues: one queue for * beacon frames and one data queue for each QoS -@@ -1833,19 +1816,22 @@ static int ath_init_softc(u16 devid, str +@@ -1839,19 +1822,22 @@ static int ath_init_softc(u16 devid, str /* setup channels and rates */ sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; -- 2.30.2