remove ath9k-watchdog, backport ath9k-patches from openwrt r35786, should fix many dDMA issues

This commit is contained in:
Bjoern Franke 2013-02-27 19:28:07 +01:00
parent 055ab542a2
commit 0dd9c6076a
12 changed files with 2404 additions and 24 deletions

View File

@ -1,16 +0,0 @@
#!/bin/sh
logread -f | while read line
do
case "$line" in
*"Failed to stop TX"*)
#reset wifi
wifi reset
#add batman-adv-if
batctl if add wlan0-1
;;
*)
;;
esac
done

View File

@ -1,8 +1,6 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
#start ath9k-watchdog
/etc/ath9k-watchdog &
#Set Mac-Addr of wr1043nd wifi interface if not right
#HARDWARE_MACADDR=`ifconfig -a wlan0 | grep 'HWaddr' | awk '{ print $5}'`

View File

@ -1,8 +1,6 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
#start ath9k-watchdog
/etc/ath9k-watchdog &
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)

View File

@ -1,8 +1,6 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
#start ath9k-watchdog
/etc/ath9k-watchdog &
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)

View File

@ -1,8 +1,6 @@
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
#start ath9k-watchdog
/etc/ath9k-watchdog &
#Set Mac-Addr of wr1043nd wifi interface if not right
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1951,8 +1951,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
REG_WRITE(ah, AR_OBS, 8);
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_LAST, 250);
+ REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 500);
}
if (ah->config.tx_intr_mitigation) {

View File

@ -0,0 +1,34 @@
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -73,6 +73,7 @@ struct ath_regulatory {
u16 max_power_level;
u16 current_rd;
int16_t power_limit;
+ int16_t max_antenna_gain;
struct reg_dmn_pair_mapping *regpair;
};
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2830,7 +2830,7 @@ void ath9k_hw_apply_txpower(struct ath_h
channel = chan->chan;
chan_pwr = min_t(int, channel->max_power * 2, MAX_RATE_POWER);
new_pwr = min_t(int, chan_pwr, reg->power_limit);
- max_gain = chan_pwr - new_pwr + channel->max_antenna_gain * 2;
+ max_gain = chan_pwr - new_pwr + reg->max_antenna_gain * 2;
ant_gain = get_antenna_gain(ah, chan);
if (ant_gain > max_gain)
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1256,7 +1256,10 @@ int ath9k_config(struct ieee80211_hw *hw
}
if (changed & IEEE80211_CONF_CHANGE_POWER) {
+ struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
+
ath_dbg(common, CONFIG, "Set power: %d\n", conf->power_level);
+ reg->max_antenna_gain = conf->max_antenna_gain;
sc->config.txpowlimit = 2 * conf->power_level;
ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);

View File

@ -0,0 +1,139 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1677,6 +1677,50 @@ static const struct file_operations fops
};
+static ssize_t read_file_diag(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_hw *ah = sc->sc_ah;
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "0x%08lx\n", ah->diag);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_diag(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_hw *ah = sc->sc_ah;
+ unsigned long diag;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (strict_strtoul(buf, 0, &diag))
+ return -EINVAL;
+
+ ah->diag = diag;
+ ath9k_hw_update_diag(ah);
+
+ return count;
+}
+
+static const struct file_operations fops_diag = {
+ .read = read_file_diag,
+ .write = write_file_diag,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
+
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -1759,5 +1803,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_chanbw);
+ debugfs_create_file("diag", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
+ sc, &fops_diag);
+
return 0;
}
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -498,6 +498,12 @@ enum {
ATH9K_RESET_COLD,
};
+enum {
+ ATH_DIAG_DISABLE_RX,
+ ATH_DIAG_DISABLE_TX,
+ ATH_DIAG_TRIGGER_ERROR,
+};
+
struct ath9k_hw_version {
u32 magic;
u16 devid;
@@ -741,6 +747,8 @@ struct ath_hw {
u32 rfkill_polarity;
u32 ah_flags;
+ unsigned long diag;
+
bool htc_reset_init;
enum nl80211_iftype opmode;
@@ -1007,6 +1015,7 @@ void ath9k_hw_set_sta_beacon_timers(stru
bool ath9k_hw_check_alive(struct ath_hw *ah);
bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode);
+void ath9k_hw_update_diag(struct ath_hw *ah);
#ifdef CONFIG_ATH9K_DEBUGFS
void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause);
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1751,6 +1751,20 @@ fail:
return -EINVAL;
}
+void ath9k_hw_update_diag(struct ath_hw *ah)
+{
+ if (test_bit(ATH_DIAG_DISABLE_RX, &ah->diag))
+ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
+ else
+ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
+
+ if (test_bit(ATH_DIAG_DISABLE_TX, &ah->diag))
+ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK);
+ else
+ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_LOOP_BACK);
+}
+EXPORT_SYMBOL(ath9k_hw_update_diag);
+
int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
struct ath9k_hw_cal_data *caldata, bool fastcc)
{
@@ -2028,6 +2042,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
}
ath9k_hw_apply_gpio_override(ah);
+ ath9k_hw_update_diag(ah);
return 0;
}
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -469,6 +469,11 @@ irqreturn_t ath_isr(int irq, void *dev)
ath9k_hw_getisr(ah, &status); /* NB: clears ISR too */
status &= ah->imask; /* discard unasked-for bits */
+ if (test_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag)) {
+ status |= ATH9K_INT_FATAL;
+ clear_bit(ATH_DIAG_TRIGGER_ERROR, &ah->diag);
+ }
+
/*
* If there are no status bits set, then this interrupt was not
* for me (should have been caught above).

View File

@ -0,0 +1,72 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1766,6 +1766,8 @@ int ath9k_init_debug(struct ath_hw *ah)
sc->debug.debugfs_phy, sc, &fops_tx_chainmask);
debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_disable_ani);
+ debugfs_create_bool("paprd", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
+ &sc->sc_ah->config.enable_paprd);
debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_regidx);
debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2523,10 +2523,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw
pCap->rx_status_len = sizeof(struct ar9003_rxs);
pCap->tx_desc_len = sizeof(struct ar9003_txc);
pCap->txs_len = sizeof(struct ar9003_txs);
- if (!ah->config.paprd_disable &&
- ah->eep_ops->get_eeprom(ah, EEP_PAPRD) &&
- !AR_SREV_9462(ah))
- pCap->hw_caps |= ATH9K_HW_CAP_PAPRD;
} else {
pCap->tx_desc_len = sizeof(struct ath_desc);
if (AR_SREV_9280_20(ah))
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -236,7 +236,6 @@ enum ath9k_hw_caps {
ATH9K_HW_CAP_LDPC = BIT(6),
ATH9K_HW_CAP_FASTCLOCK = BIT(7),
ATH9K_HW_CAP_SGI_20 = BIT(8),
- ATH9K_HW_CAP_PAPRD = BIT(9),
ATH9K_HW_CAP_ANT_DIV_COMB = BIT(10),
ATH9K_HW_CAP_2GHZ = BIT(11),
ATH9K_HW_CAP_5GHZ = BIT(12),
@@ -287,12 +286,12 @@ struct ath9k_ops_config {
u8 pcie_clock_req;
u32 pcie_waen;
u8 analog_shiftreg;
- u8 paprd_disable;
u32 ofdm_trig_low;
u32 ofdm_trig_high;
u32 cck_trig_high;
u32 cck_trig_low;
u32 enable_ani;
+ u32 enable_paprd;
int serialize_regmode;
bool rx_intr_mitigation;
bool tx_intr_mitigation;
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -2982,6 +2982,10 @@ static u32 ath9k_hw_ar9300_get_eeprom(st
case EEP_RX_MASK:
return pBase->txrxMask & 0xf;
case EEP_PAPRD:
+ if (AR_SREV_9462(ah))
+ return false;
+ if (!ah->config.enable_paprd);
+ return false;
return !!(pBase->featureEnable & BIT(5));
case EEP_CHAIN_MASK_REDUCE:
return (pBase->miscConfiguration >> 0x3) & 0x1;
--- a/drivers/net/wireless/ath/ath9k/link.c
+++ b/drivers/net/wireless/ath/ath9k/link.c
@@ -423,7 +423,7 @@ set_timer:
cal_interval = min(cal_interval, (u32)short_cal_interval);
mod_timer(&common->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
- if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->caldata) {
+ if (ah->eep_ops->get_eeprom(ah, EEP_PAPRD) && ah->caldata) {
if (!ah->caldata->paprd_done)
ieee80211_queue_work(sc->hw, &sc->paprd_work);
else if (!ah->paprd_table_write_done)

View File

@ -0,0 +1,70 @@
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -31,6 +31,9 @@ struct ath9k_platform_data {
bool endian_check;
bool is_clk_25mhz;
+ bool disable_2ghz;
+ bool disable_5ghz;
+
int (*get_mac_revision)(void);
int (*external_reset)(void);
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2415,17 +2415,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
}
eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
- if ((eeval & (AR5416_OPFLAGS_11G | AR5416_OPFLAGS_11A)) == 0) {
- ath_err(common,
- "no band has been marked as supported in EEPROM\n");
- return -EINVAL;
+
+ if (eeval & AR5416_OPFLAGS_11A) {
+ if (ah->disable_5ghz)
+ ath_warn(common, "disabling 5GHz band\n");
+ else
+ pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
}
- if (eeval & AR5416_OPFLAGS_11A)
- pCap->hw_caps |= ATH9K_HW_CAP_5GHZ;
+ if (eeval & AR5416_OPFLAGS_11G) {
+ if (ah->disable_2ghz)
+ ath_warn(common, "disabling 2GHz band\n");
+ else
+ pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
+ }
- if (eeval & AR5416_OPFLAGS_11G)
- pCap->hw_caps |= ATH9K_HW_CAP_2GHZ;
+ if ((pCap->hw_caps & (ATH9K_HW_CAP_2GHZ | ATH9K_HW_CAP_5GHZ)) == 0) {
+ ath_err(common, "both bands are disabled\n");
+ return -EINVAL;
+ }
if (AR_SREV_9485(ah) || AR_SREV_9285(ah) || AR_SREV_9330(ah))
chip_chainmask = 1;
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -927,6 +927,8 @@ struct ath_hw {
bool is_clk_25mhz;
int (*get_mac_revision)(void);
int (*external_reset)(void);
+ bool disable_2ghz;
+ bool disable_5ghz;
};
struct ath_bus_ops {
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -537,6 +537,8 @@ static int ath9k_init_softc(u16 devid, s
ah->is_clk_25mhz = pdata->is_clk_25mhz;
ah->get_mac_revision = pdata->get_mac_revision;
ah->external_reset = pdata->external_reset;
+ ah->disable_2ghz = pdata->disable_2ghz;
+ ah->disable_5ghz = pdata->disable_5ghz;
if (!pdata->endian_check)
ah->ah_flags |= AH_NO_EEP_SWAP;
}

View File

@ -22,6 +22,9 @@ prepare() {
# This adds the sysctl load just before the network comes up
cat build_patches/invoke_sysctl_before_network.patch | patch -p0 -d $target
#backport ath9k-fixes from openwrt r35786
cp build_patches/mac80211/* $target/package/mac80211/patches
board_prepare
}