ath9k: add some cleanups and minor fixes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 38354
v19.07.3_mercusys_ac12_duma
Felix Fietkau 11 years ago
parent a05d20a60f
commit d45a1618eb

File diff suppressed because it is too large Load Diff

@ -8,7 +8,7 @@
#include <asm/unaligned.h>
#include "hw.h"
@@ -517,8 +518,16 @@ static int ath9k_hw_init_macaddr(struct
@@ -513,8 +514,16 @@ static int ath9k_hw_init_macaddr(struct
common->macaddr[2 * i] = eeval >> 8;
common->macaddr[2 * i + 1] = eeval & 0xff;
}

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -779,6 +779,7 @@ static const struct ieee80211_iface_limi
@@ -778,6 +778,7 @@ static const struct ieee80211_iface_limi
#endif
BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_P2P_GO) },

@ -71,7 +71,7 @@
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -747,6 +747,7 @@ enum ath_cal_list {
@@ -717,6 +717,7 @@ enum ath_cal_list {
#define AH_USE_EEPROM 0x1
#define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
#define AH_FASTCC 0x4
@ -81,7 +81,7 @@
struct ath_ops reg_ops;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -631,6 +631,8 @@ static int ath9k_init_softc(u16 devid, s
@@ -630,6 +630,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;

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -1036,23 +1036,23 @@ static int __init ath9k_init(void)
@@ -1035,23 +1035,23 @@ static int __init ath9k_init(void)
goto err_out;
}

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2017,8 +2017,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
@@ -1993,8 +1993,8 @@ int ath9k_hw_reset(struct ath_hw *ah, st
REG_WRITE(ah, AR_OBS, 8);
if (ah->config.rx_intr_mitigation) {

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -114,7 +114,7 @@ int ath_descdma_setup(struct ath_softc *
@@ -113,7 +113,7 @@ int ath_descdma_setup(struct ath_softc *
/* RX / TX */
/***********/

@ -1,16 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -701,6 +701,7 @@ struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
+ u32 chan_bw;
struct survey_info *cur_survey;
struct survey_info survey[ATH9K_NUM_CHANNELS];
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1918,6 +1918,50 @@ static const struct file_operations fops
@@ -1918,6 +1918,52 @@ static const struct file_operations fops
.owner = THIS_MODULE
};
@ -19,10 +9,11 @@
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "0x%08x\n", sc->chan_bw);
+ len = sprintf(buf, "0x%08x\n", common->chan_bw);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
@ -30,6 +21,7 @@
+ size_t count, loff_t *ppos)
+{
+ struct ath_softc *sc = file->private_data;
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ unsigned long chan_bw;
+ char buf[32];
+ ssize_t len;
@ -42,7 +34,7 @@
+ if (kstrtoul(buf, 0, &chan_bw))
+ return -EINVAL;
+
+ sc->chan_bw = chan_bw;
+ common->chan_bw = chan_bw;
+ if (!test_bit(SC_OP_INVALID, &sc->sc_flags))
+ ath9k_ops.config(sc->hw, IEEE80211_CONF_CHANGE_CHANNEL);
+
@ -61,7 +53,7 @@
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -1937,6 +1981,8 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -1937,6 +1983,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("eeprom", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_eeprom);
@ -70,41 +62,66 @@
debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
&fops_dma);
debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1199,8 +1199,10 @@ static int ath9k_config(struct ieee80211
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
@@ -129,6 +129,7 @@ struct ath_common {
struct ieee80211_hw *hw;
int debug_mask;
enum ath_device_state state;
+ u32 chan_bw;
if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
struct ieee80211_channel *curchan = hw->conf.chandef.chan;
+ struct ath9k_channel *hchan;
int pos = curchan->hw_value;
int old_pos = -1;
+ u32 oldflags;
unsigned long flags;
struct ath_ani ani;
if (ah->curchan)
@@ -1237,7 +1239,23 @@ static int ath9k_config(struct ieee80211
memset(&sc->survey[pos], 0, sizeof(struct survey_info));
}
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -52,11 +52,13 @@ EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_ke
/*
* Update internal channel flags.
*/
-static void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
+static void ath9k_cmn_update_ichannel(struct ath_common *common,
+ struct ath9k_channel *ichan,
struct cfg80211_chan_def *chandef)
{
struct ieee80211_channel *chan = chandef->chan;
u16 flags = 0;
+ int width;
ichan->channel = chan->center_freq;
ichan->chan = chan;
@@ -64,7 +66,19 @@ static void ath9k_cmn_update_ichannel(st
if (chan->band == IEEE80211_BAND_5GHZ)
flags |= CHANNEL_5GHZ;
- if (ath_set_channel(sc, hw, &sc->sc_ah->channels[pos]) < 0) {
+ hchan = &sc->sc_ah->channels[pos];
+ oldflags = hchan->channelFlags;
+ switch (sc->chan_bw) {
+ case 5:
+ hchan->channelFlags &= ~CHANNEL_HALF;
+ hchan->channelFlags |= CHANNEL_QUARTER;
+ break;
+ case 10:
+ hchan->channelFlags &= ~CHANNEL_QUARTER;
+ hchan->channelFlags |= CHANNEL_HALF;
+ break;
+ default:
+ hchan->channelFlags &= ~(CHANNEL_HALF | CHANNEL_QUARTER);
+ break;
+ }
- switch (chandef->width) {
+ switch (common->chan_bw) {
+ case 5:
+ width = NL80211_CHAN_WIDTH_5;
+ break;
+ case 10:
+ width = NL80211_CHAN_WIDTH_10;
+ break;
+ default:
+ width = chandef->width;
+ break;
+ }
+
+ if (ath_set_channel(sc, hw, hchan) < 0) {
ath_err(common, "Unable to set channel\n");
mutex_unlock(&sc->mutex);
ath9k_ps_restore(sc);
+ switch (width) {
case NL80211_CHAN_WIDTH_5:
flags |= CHANNEL_QUARTER;
break;
@@ -97,12 +111,13 @@ struct ath9k_channel *ath9k_cmn_get_chan
struct cfg80211_chan_def *chandef)
{
struct ieee80211_channel *curchan = chandef->chan;
+ struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_channel *channel;
u8 chan_idx;
chan_idx = curchan->hw_value;
channel = &ah->channels[chan_idx];
- ath9k_cmn_update_ichannel(channel, chandef);
+ ath9k_cmn_update_ichannel(common, channel, chandef);
return channel;
}

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -728,6 +728,7 @@ int ath9k_hw_init(struct ath_hw *ah)
@@ -724,6 +724,7 @@ int ath9k_hw_init(struct ath_hw *ah)
case AR9300_DEVID_AR9462:
case AR9485_DEVID_AR1111:
case AR9300_DEVID_AR9565:

@ -14,7 +14,7 @@
out:
spin_unlock_bh(&sc->sc_pcu_lock);
@@ -1298,6 +1302,7 @@ static int ath9k_config(struct ieee80211
@@ -1285,6 +1289,7 @@ static int ath9k_config(struct ieee80211
sc->config.txpowlimit = 2 * conf->power_level;
ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);

@ -78,7 +78,7 @@
rxs->rs_keyix = MS(rxsp->status11, AR_KeyIdx);
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -554,25 +554,25 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
@@ -550,25 +550,25 @@ int ath9k_hw_rxprocdesc(struct ath_hw *a
if (ads.ds_rxstatus8 & AR_PostDelimCRCErr) {
rs->rs_rssi = ATH9K_RSSI_BAD;

@ -10,7 +10,7 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2856,7 +2856,7 @@ void ath9k_hw_apply_txpower(struct ath_h
@@ -2832,7 +2832,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);
@ -21,7 +21,7 @@
if (ant_gain > max_gain)
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1298,7 +1298,10 @@ static int ath9k_config(struct ieee80211
@@ -1285,7 +1285,10 @@ static int ath9k_config(struct ieee80211
}
if (changed & IEEE80211_CONF_CHANGE_POWER) {

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -553,6 +553,9 @@ struct ath9k_wow_pattern {
@@ -560,6 +560,9 @@ struct ath9k_wow_pattern {
void ath_init_leds(struct ath_softc *sc);
void ath_deinit_leds(struct ath_softc *sc);
void ath_fill_led_pin(struct ath_softc *sc);
@ -10,7 +10,7 @@
#else
static inline void ath_init_leds(struct ath_softc *sc)
{
@@ -697,6 +700,13 @@ enum spectral_mode {
@@ -704,6 +707,13 @@ enum spectral_mode {
SPECTRAL_CHANSCAN,
};
@ -24,7 +24,7 @@
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;
@@ -739,9 +749,8 @@ struct ath_softc {
@@ -745,9 +755,8 @@ struct ath_softc {
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
#ifdef CPTCFG_MAC80211_LEDS
@ -162,7 +162,7 @@
void ath_fill_led_pin(struct ath_softc *sc)
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -943,7 +943,7 @@ int ath9k_init_device(u16 devid, struct
@@ -942,7 +942,7 @@ int ath9k_init_device(u16 devid, struct
#ifdef CPTCFG_MAC80211_LEDS
/* must be initialized before ieee80211_register_hw */
@ -173,7 +173,7 @@
#endif
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1961,6 +1961,61 @@ static const struct file_operations fops
@@ -1963,6 +1963,61 @@ static const struct file_operations fops
.llseek = default_llseek,
};
@ -235,7 +235,7 @@
int ath9k_init_debug(struct ath_hw *ah)
{
@@ -1983,6 +2038,10 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -1985,6 +2040,10 @@ int ath9k_init_debug(struct ath_hw *ah)
&fops_eeprom);
debugfs_create_file("chanbw", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
sc, &fops_chanbw);

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -705,7 +705,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
@@ -701,7 +701,7 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
{
#define AH_RX_STOP_DMA_TIMEOUT 10000 /* usec */
struct ath_common *common = ath9k_hw_common(ah);
@ -9,7 +9,7 @@
int i;
/* Enable access to the DMA observation bus */
@@ -735,6 +735,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
@@ -731,6 +731,16 @@ bool ath9k_hw_stopdmarecv(struct ath_hw
}
if (i == 0) {

@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -2017,6 +2017,50 @@ static const struct file_operations fops
@@ -2019,6 +2019,50 @@ static const struct file_operations fops
#endif
@ -51,7 +51,7 @@
int ath9k_init_debug(struct ath_hw *ah)
{
struct ath_common *common = ath9k_hw_common(ah);
@@ -2042,6 +2086,8 @@ int ath9k_init_debug(struct ath_hw *ah)
@@ -2044,6 +2088,8 @@ int ath9k_init_debug(struct ath_hw *ah)
debugfs_create_file("gpio_led", S_IWUSR,
sc->debug.debugfs_phy, sc, &fops_gpio_led);
#endif
@ -62,7 +62,7 @@
debugfs_create_file("interrupt", S_IRUSR, sc->debug.debugfs_phy, sc,
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -505,6 +505,12 @@ enum {
@@ -475,6 +475,12 @@ enum {
ATH9K_RESET_COLD,
};
@ -75,7 +75,7 @@
struct ath9k_hw_version {
u32 magic;
u16 devid;
@@ -785,6 +791,8 @@ struct ath_hw {
@@ -755,6 +761,8 @@ struct ath_hw {
u32 rfkill_polarity;
u32 ah_flags;
@ -84,7 +84,7 @@
bool reset_power_on;
bool htc_reset_init;
@@ -1035,6 +1043,7 @@ void ath9k_hw_set_sta_beacon_timers(stru
@@ -1005,6 +1013,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);
@ -94,7 +94,7 @@
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
@@ -1861,6 +1861,20 @@ fail:
@@ -1840,6 +1840,20 @@ fail:
return -EINVAL;
}
@ -115,7 +115,7 @@
int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
struct ath9k_hw_cal_data *caldata, bool fastcc)
{
@@ -2063,6 +2077,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
@@ -2039,6 +2053,7 @@ int ath9k_hw_reset(struct ath_hw *ah, st
}
ath9k_hw_apply_gpio_override(ah);
@ -125,7 +125,7 @@
REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -472,6 +472,11 @@ irqreturn_t ath_isr(int irq, void *dev)
@@ -546,6 +546,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 */

@ -12,7 +12,7 @@
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -2456,17 +2456,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
@@ -2432,17 +2432,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw
}
eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
@ -48,7 +48,7 @@
AR_SREV_9285(ah) ||
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -955,6 +955,8 @@ struct ath_hw {
@@ -925,6 +925,8 @@ struct ath_hw {
bool is_clk_25mhz;
int (*get_mac_revision)(void);
int (*external_reset)(void);
@ -59,7 +59,7 @@
};
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -631,6 +631,8 @@ static int ath9k_init_softc(u16 devid, s
@@ -630,6 +630,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;

Loading…
Cancel
Save