parent
b59113f2e7
commit
058fa75a74
@ -0,0 +1,212 @@ |
||||
--- a/drivers/net/wireless/ath/debug.c
|
||||
+++ b/drivers/net/wireless/ath/debug.c
|
||||
@@ -19,19 +19,14 @@
|
||||
|
||||
void ath_print(struct ath_common *common, int dbg_mask, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (likely(!(common->debug_mask & dbg_mask)))
|
||||
return;
|
||||
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_DEBUG "ath: %pV", &vaf);
|
||||
-
|
||||
+ printk(KERN_DEBUG "ath: ");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
EXPORT_SYMBOL(ath_print);
|
||||
--- a/drivers/net/wireless/b43/main.c
|
||||
+++ b/drivers/net/wireless/b43/main.c
|
||||
@@ -322,83 +322,59 @@ static int b43_ratelimit(struct b43_wl *
|
||||
|
||||
void b43info(struct b43_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (b43_modparam_verbose < B43_VERBOSITY_INFO)
|
||||
return;
|
||||
if (!b43_ratelimit(wl))
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_INFO "b43-%s: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_INFO "b43-%s: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void b43err(struct b43_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (b43_modparam_verbose < B43_VERBOSITY_ERROR)
|
||||
return;
|
||||
if (!b43_ratelimit(wl))
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_ERR "b43-%s ERROR: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_ERR "b43-%s ERROR: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void b43warn(struct b43_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (b43_modparam_verbose < B43_VERBOSITY_WARN)
|
||||
return;
|
||||
if (!b43_ratelimit(wl))
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_WARNING "b43-%s warning: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_WARNING "b43-%s warning: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void b43dbg(struct b43_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (b43_modparam_verbose < B43_VERBOSITY_DEBUG)
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_DEBUG "b43-%s debug: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_DEBUG "b43-%s debug: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
--- a/drivers/net/wireless/b43legacy/main.c
|
||||
+++ b/drivers/net/wireless/b43legacy/main.c
|
||||
@@ -181,75 +181,52 @@ static int b43legacy_ratelimit(struct b4
|
||||
|
||||
void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (!b43legacy_ratelimit(wl))
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_INFO "b43legacy-%s: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_INFO "b43legacy-%s: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (!b43legacy_ratelimit(wl))
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_ERR "b43legacy-%s ERROR: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_ERR "b43legacy-%s ERROR: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
if (!b43legacy_ratelimit(wl))
|
||||
return;
|
||||
-
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_WARNING "b43legacy-%s warning: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_WARNING "b43legacy-%s warning: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#if B43legacy_DEBUG
|
||||
void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...)
|
||||
{
|
||||
- struct va_format vaf;
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
-
|
||||
- vaf.fmt = fmt;
|
||||
- vaf.va = &args;
|
||||
-
|
||||
- printk(KERN_DEBUG "b43legacy-%s debug: %pV",
|
||||
- (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan", &vaf);
|
||||
-
|
||||
+ printk(KERN_DEBUG "b43legacy-%s debug: ",
|
||||
+ (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
|
||||
+ vprintk(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
#endif /* DEBUG */
|
@ -1,16 +0,0 @@ |
||||
--- a/include/linux/pm_qos_params.h
|
||||
+++ b/include/linux/pm_qos_params.h
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <linux/version.h>
|
||||
|
||||
+#ifndef __COMPAT_LINUX_PM_QOS_PARAMS_H
|
||||
+#define __COMPAT_LINUX_PM_QOS_PARAMS_H
|
||||
+
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
|
||||
#include_next <linux/pm_qos_params.h>
|
||||
#else
|
||||
@@ -30,3 +33,4 @@ int pm_qos_add_notifier(int qos, struct
|
||||
int pm_qos_remove_notifier(int qos, struct notifier_block *notifier);
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */
|
||||
|
||||
+#endif
|
@ -1,11 +0,0 @@ |
||||
--- a/include/linux/compat-2.6.36.h
|
||||
+++ b/include/linux/compat-2.6.36.h
|
||||
@@ -83,7 +83,7 @@ struct pm_qos_request_list {
|
||||
} while (0)
|
||||
|
||||
#define pm_qos_update_request(_req, _value) \
|
||||
- pm_qos_update_request((_req)->request, (_value)
|
||||
+ pm_qos_update_request((_req)->request, (_value))
|
||||
|
||||
#define pm_qos_remove_request(_req) \
|
||||
pm_qos_remove_request((_req)->request)
|
@ -0,0 +1,114 @@ |
||||
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
|
||||
@@ -3271,6 +3271,18 @@ static bool ar9300_check_eeprom_header(s
|
||||
return ar9300_check_header(header);
|
||||
}
|
||||
|
||||
+static int ar9300_eeprom_restore_flash(struct ath_hw *ah, u8 *mptr,
|
||||
+ int mdata_size)
|
||||
+{
|
||||
+ struct ath_common *common = ath9k_hw_common(ah);
|
||||
+ u16 *data = (u16 *) mptr;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < mdata_size / 2; i++, data++)
|
||||
+ ath9k_hw_nvram_read(common, i, data);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
/*
|
||||
* Read the configuration data from the eeprom.
|
||||
* The data can be put in any specified memory buffer.
|
||||
@@ -3293,6 +3305,9 @@ static int ar9300_eeprom_restore_interna
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
eeprom_read_op read;
|
||||
|
||||
+ if (ath9k_hw_use_flash(ah))
|
||||
+ return ar9300_eeprom_restore_flash(ah, mptr, mdata_size);
|
||||
+
|
||||
word = kzalloc(2048, GFP_KERNEL);
|
||||
if (!word)
|
||||
return -1;
|
||||
--- a/drivers/net/wireless/ath/ath9k/hw.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/hw.c
|
||||
@@ -419,10 +419,6 @@ static void ath9k_hw_init_defaults(struc
|
||||
ah->hw_version.magic = AR5416_MAGIC;
|
||||
ah->hw_version.subvendorid = 0;
|
||||
|
||||
- ah->ah_flags = 0;
|
||||
- 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/init.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/init.c
|
||||
@@ -533,6 +533,9 @@ static int ath9k_init_softc(u16 devid, s
|
||||
ah->hw_version.subsysid = subsysid;
|
||||
sc->sc_ah = ah;
|
||||
|
||||
+ if (!sc->dev->platform_data)
|
||||
+ ah->ah_flags |= AH_USE_EEPROM;
|
||||
+
|
||||
common = ath9k_hw_common(ah);
|
||||
common->ops = &ath9k_common_ops;
|
||||
common->bus_ops = bus_ops;
|
||||
--- 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 DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
|
||||
@@ -53,21 +54,36 @@ static void ath_pci_read_cachesize(struc
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1,58 +0,0 @@ |
||||
--- 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 DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
|
||||
@@ -53,21 +54,36 @@ static void ath_pci_read_cachesize(struc
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -1,44 +0,0 @@ |
||||
--- a/drivers/net/wireless/ath/ath9k/main.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/main.c
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <linux/nl80211.h>
|
||||
#include <linux/pm_qos_params.h>
|
||||
+#include <linux/ath9k_platform.h>
|
||||
#include "ath9k.h"
|
||||
#include "btcoex.h"
|
||||
|
||||
--- a/drivers/net/wireless/ath/ath9k/init.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/init.c
|
||||
@@ -522,6 +522,7 @@ static int ath9k_init_softc(u16 devid, s
|
||||
{
|
||||
struct ath_hw *ah = NULL;
|
||||
struct ath_common *common;
|
||||
+ struct ath9k_platform_data *pdata;
|
||||
int ret = 0, i;
|
||||
int csz = 0;
|
||||
|
||||
@@ -533,6 +534,10 @@ static int ath9k_init_softc(u16 devid, s
|
||||
ah->hw_version.subsysid = subsysid;
|
||||
sc->sc_ah = ah;
|
||||
|
||||
+ pdata = (struct ath9k_platform_data *) sc->dev->platform_data;
|
||||
+ if (!pdata)
|
||||
+ ah->ah_flags |= AH_USE_EEPROM;
|
||||
+
|
||||
common = ath9k_hw_common(ah);
|
||||
common->ops = &ath9k_common_ops;
|
||||
common->bus_ops = bus_ops;
|
||||
--- a/drivers/net/wireless/ath/ath9k/hw.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/hw.c
|
||||
@@ -420,10 +420,6 @@ static void ath9k_hw_init_defaults(struc
|
||||
ah->hw_version.magic = AR5416_MAGIC;
|
||||
ah->hw_version.subvendorid = 0;
|
||||
|
||||
- ah->ah_flags = 0;
|
||||
- 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 |
|
@ -1,11 +0,0 @@ |
||||
--- a/drivers/net/wireless/ath/ath9k/hw.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/hw.c
|
||||
@@ -1438,7 +1438,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
|
||||
|
||||
if (ah->config.rx_intr_mitigation) {
|
||||
REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500);
|
||||
- REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000);
|
||||
+ REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 500);
|
||||
}
|
||||
|
||||
if (ah->config.tx_intr_mitigation) {
|
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@ |
||||
--- a/drivers/net/wireless/ath/ath9k/xmit.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
|
||||
@@ -1656,9 +1656,6 @@ static void ath_tx_start_dma(struct ath_
|
||||
bf->bf_buf_addr,
|
||||
txctl->txq->axq_qnum);
|
||||
|
||||
- if (bf->bf_state.bfs_paprd)
|
||||
- ar9003_hw_set_paprd_txdesc(ah, ds, bf->bf_state.bfs_paprd);
|
||||
-
|
||||
spin_lock_bh(&txctl->txq->axq_lock);
|
||||
|
||||
if (bf_isht(bf) && (sc->sc_flags & SC_OP_TXAGGR) &&
|
||||
@@ -1684,6 +1681,9 @@ static void ath_tx_start_dma(struct ath_
|
||||
bf->bf_state.bfs_ftype = txctl->frame_type;
|
||||
bf->bf_state.bfs_paprd = txctl->paprd;
|
||||
|
||||
+ if (bf->bf_state.bfs_paprd)
|
||||
+ ar9003_hw_set_paprd_txdesc(ah, ds, bf->bf_state.bfs_paprd);
|
||||
+
|
||||
if (txctl->paprd)
|
||||
bf->bf_state.bfs_paprd_timestamp = jiffies;
|
||||
|
@ -1,149 +0,0 @@ |
||||
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
|
||||
@@ -3104,6 +3104,36 @@ error:
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool ar9300_otp_read_word(struct ath_hw *ah, int addr, u32 *data)
|
||||
+{
|
||||
+ REG_READ(ah, AR9300_OTP_BASE + (4 * addr));
|
||||
+
|
||||
+ if (!ath9k_hw_wait(ah, AR9300_OTP_STATUS, AR9300_OTP_STATUS_TYPE,
|
||||
+ AR9300_OTP_STATUS_VALID, 1000))
|
||||
+ return false;
|
||||
+
|
||||
+ *data = REG_READ(ah, AR9300_OTP_READ_DATA);
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static bool ar9300_read_otp(struct ath_hw *ah, int address, u8 *buffer,
|
||||
+ int count)
|
||||
+{
|
||||
+ u32 data;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ int offset = 8 * ((address - i) % 4);
|
||||
+ if (!ar9300_otp_read_word(ah, (address - i) / 4, &data))
|
||||
+ return false;
|
||||
+
|
||||
+ buffer[i] = (data >> offset) & 0xff;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static void ar9300_comp_hdr_unpack(u8 *best, int *code, int *reference,
|
||||
int *length, int *major, int *minor)
|
||||
{
|
||||
@@ -3221,6 +3251,26 @@ static int ar9300_compress_decision(stru
|
||||
return 0;
|
||||
}
|
||||
|
||||
+typedef bool (*eeprom_read_op)(struct ath_hw *ah, int address, u8 *buffer,
|
||||
+ int count);
|
||||
+
|
||||
+static bool ar9300_check_header(void *data)
|
||||
+{
|
||||
+ u32 *word = data;
|
||||
+ return !(*word == 0 || *word == ~0);
|
||||
+}
|
||||
+
|
||||
+static bool ar9300_check_eeprom_header(struct ath_hw *ah, eeprom_read_op read,
|
||||
+ int base_addr)
|
||||
+{
|
||||
+ u8 header[4];
|
||||
+
|
||||
+ if (!read(ah, base_addr, header, 4))
|
||||
+ return false;
|
||||
+
|
||||
+ return ar9300_check_header(header);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Read the configuration data from the eeprom.
|
||||
* The data can be put in any specified memory buffer.
|
||||
@@ -3241,6 +3291,7 @@ static int ar9300_eeprom_restore_interna
|
||||
int it;
|
||||
u16 checksum, mchecksum;
|
||||
struct ath_common *common = ath9k_hw_common(ah);
|
||||
+ eeprom_read_op read;
|
||||
|
||||
word = kzalloc(2048, GFP_KERNEL);
|
||||
if (!word)
|
||||
@@ -3248,14 +3299,42 @@ static int ar9300_eeprom_restore_interna
|
||||
|
||||
memcpy(mptr, &ar9300_default, mdata_size);
|
||||
|
||||
+ read = ar9300_read_eeprom;
|
||||
cptr = AR9300_BASE_ADDR;
|
||||
+ ath_print(common, ATH_DBG_EEPROM,
|
||||
+ "Trying EEPROM accesss at Address 0x%04x\n", cptr);
|
||||
+ if (ar9300_check_eeprom_header(ah, read, cptr))
|
||||
+ goto found;
|
||||
+
|
||||
+ cptr = AR9300_BASE_ADDR_512;
|
||||
+ ath_print(common, ATH_DBG_EEPROM,
|
||||
+ "Trying EEPROM accesss at Address 0x%04x\n", cptr);
|
||||
+ if (ar9300_check_eeprom_header(ah, read, cptr))
|
||||
+ goto found;
|
||||
+
|
||||
+ read = ar9300_read_otp;
|
||||
+ cptr = AR9300_BASE_ADDR;
|
||||
+ ath_print(common, ATH_DBG_EEPROM,
|
||||
+ "Trying OTP accesss at Address 0x%04x\n", cptr);
|
||||
+ if (ar9300_check_eeprom_header(ah, read, cptr))
|
||||
+ goto found;
|
||||
+
|
||||
+ cptr = AR9300_BASE_ADDR_512;
|
||||
+ ath_print(common, ATH_DBG_EEPROM,
|
||||
+ "Trying OTP accesss at Address 0x%04x\n", cptr);
|
||||
+ if (ar9300_check_eeprom_header(ah, read, cptr))
|
||||
+ goto found;
|
||||
+
|
||||
+ goto fail;
|
||||
+
|
||||
+found:
|
||||
+ ath_print(common, ATH_DBG_EEPROM, "Found valid EEPROM data");
|
||||
+
|
||||
for (it = 0; it < MSTATE; it++) {
|
||||
- if (!ar9300_read_eeprom(ah, cptr, word, COMP_HDR_LEN))
|
||||
+ if (!read(ah, cptr, word, COMP_HDR_LEN))
|
||||
goto fail;
|
||||
|
||||
- if ((word[0] == 0 && word[1] == 0 && word[2] == 0 &&
|
||||
- word[3] == 0) || (word[0] == 0xff && word[1] == 0xff
|
||||
- && word[2] == 0xff && word[3] == 0xff))
|
||||
+ if (!ar9300_check_header(word))
|
||||
break;
|
||||
|
||||
ar9300_comp_hdr_unpack(word, &code, &reference,
|
||||
@@ -3272,8 +3351,7 @@ static int ar9300_eeprom_restore_interna
|
||||
}
|
||||
|
||||
osize = length;
|
||||
- ar9300_read_eeprom(ah, cptr, word,
|
||||
- COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
|
||||
+ read(ah, cptr, word, COMP_HDR_LEN + osize + COMP_CKSUM_LEN);
|
||||
checksum = ar9300_comp_cksum(&word[COMP_HDR_LEN], length);
|
||||
mchecksum = word[COMP_HDR_LEN + osize] |
|
||||
(word[COMP_HDR_LEN + osize + 1] << 8);
|
||||
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
|
||||
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
|
||||
@@ -79,6 +79,15 @@
|
||||
#define FIXED_CCA_THRESHOLD 15
|
||||
|
||||
#define AR9300_BASE_ADDR 0x3ff
|
||||
+#define AR9300_BASE_ADDR_512 0x1ff
|
||||
+
|
||||
+#define AR9300_OTP_BASE 0x14000
|
||||
+#define AR9300_OTP_STATUS 0x15f18
|
||||
+#define AR9300_OTP_STATUS_TYPE 0x7
|
||||
+#define AR9300_OTP_STATUS_VALID 0x4
|
||||
+#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2
|
||||
+#define AR9300_OTP_STATUS_SM_BUSY 0x1
|
||||
+#define AR9300_OTP_READ_DATA 0x15f1c
|
||||
|
||||
enum targetPowerHTRates {
|
||||
HT_TARGET_RATE_0_8_16,
|
Loading…
Reference in new issue