Skip to content

Commit

Permalink
Merge tag 'wireless-drivers-for-davem-2016-10-14' of git://git.kernel…
Browse files Browse the repository at this point in the history
….org/pub/scm/linux/kernel/git/kvalo/wireless-drivers

Kalle Valo says:

====================
wireless-drivers fixes for 4.9

wlcore

* fix a double free regression causing hard to track crashes

rtl8xxxu

* fix driver reload issues, a memory leak and an endian bug

rtlwifi

* fix a major regression introduced in 4.9 with firmware loading on
  certain hardware

ath10k

* fix regression about broken cal_data debugfs file (since 4.7)

ath9k

* revert temperature compensation for AR9003+ devices, it was causing
  too much problems

ath6kl

* add Dell OEM SDIO I/O for the Venue 8 Pro
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
davem330 committed Oct 14, 2016
2 parents 610df1d + 1ea2643 commit 9e55d0f
Show file tree
Hide file tree
Showing 21 changed files with 110 additions and 117 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath10k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ struct ath10k_debug {
u32 pktlog_filter;
u32 reg_addr;
u32 nf_cal_period;
void *cal_data;

struct ath10k_fw_crash_data *fw_crash_data;
};
Expand Down
75 changes: 39 additions & 36 deletions drivers/net/wireless/ath/ath10k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
/* ms */
#define ATH10K_DEBUG_HTT_STATS_INTERVAL 1000

#define ATH10K_DEBUG_CAL_DATA_LEN 12064

#define ATH10K_FW_CRASH_DUMP_VERSION 1

/**
Expand Down Expand Up @@ -1451,75 +1453,68 @@ static const struct file_operations fops_fw_dbglog = {
.llseek = default_llseek,
};

static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file)
static int ath10k_debug_cal_data_fetch(struct ath10k *ar)
{
struct ath10k *ar = inode->i_private;
void *buf;
u32 hi_addr;
__le32 addr;
int ret;

mutex_lock(&ar->conf_mutex);

if (ar->state != ATH10K_STATE_ON &&
ar->state != ATH10K_STATE_UTF) {
ret = -ENETDOWN;
goto err;
}
lockdep_assert_held(&ar->conf_mutex);

buf = vmalloc(ar->hw_params.cal_data_len);
if (!buf) {
ret = -ENOMEM;
goto err;
}
if (WARN_ON(ar->hw_params.cal_data_len > ATH10K_DEBUG_CAL_DATA_LEN))
return -EINVAL;

hi_addr = host_interest_item_address(HI_ITEM(hi_board_data));

ret = ath10k_hif_diag_read(ar, hi_addr, &addr, sizeof(addr));
if (ret) {
ath10k_warn(ar, "failed to read hi_board_data address: %d\n", ret);
goto err_vfree;
ath10k_warn(ar, "failed to read hi_board_data address: %d\n",
ret);
return ret;
}

ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), buf,
ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), ar->debug.cal_data,
ar->hw_params.cal_data_len);
if (ret) {
ath10k_warn(ar, "failed to read calibration data: %d\n", ret);
goto err_vfree;
return ret;
}

file->private_data = buf;
return 0;
}

mutex_unlock(&ar->conf_mutex);
static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file)
{
struct ath10k *ar = inode->i_private;

return 0;
mutex_lock(&ar->conf_mutex);

err_vfree:
vfree(buf);
if (ar->state == ATH10K_STATE_ON ||
ar->state == ATH10K_STATE_UTF) {
ath10k_debug_cal_data_fetch(ar);
}

err:
file->private_data = ar;
mutex_unlock(&ar->conf_mutex);

return ret;
return 0;
}

static ssize_t ath10k_debug_cal_data_read(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath10k *ar = file->private_data;
void *buf = file->private_data;

return simple_read_from_buffer(user_buf, count, ppos,
buf, ar->hw_params.cal_data_len);
}
mutex_lock(&ar->conf_mutex);

static int ath10k_debug_cal_data_release(struct inode *inode,
struct file *file)
{
vfree(file->private_data);
count = simple_read_from_buffer(user_buf, count, ppos,
ar->debug.cal_data,
ar->hw_params.cal_data_len);

return 0;
mutex_unlock(&ar->conf_mutex);

return count;
}

static ssize_t ath10k_write_ani_enable(struct file *file,
Expand Down Expand Up @@ -1580,7 +1575,6 @@ static const struct file_operations fops_ani_enable = {
static const struct file_operations fops_cal_data = {
.open = ath10k_debug_cal_data_open,
.read = ath10k_debug_cal_data_read,
.release = ath10k_debug_cal_data_release,
.owner = THIS_MODULE,
.llseek = default_llseek,
};
Expand Down Expand Up @@ -1932,6 +1926,8 @@ void ath10k_debug_stop(struct ath10k *ar)
{
lockdep_assert_held(&ar->conf_mutex);

ath10k_debug_cal_data_fetch(ar);

/* Must not use _sync to avoid deadlock, we do that in
* ath10k_debug_destroy(). The check for htt_stats_mask is to avoid
* warning from del_timer(). */
Expand Down Expand Up @@ -2344,6 +2340,10 @@ int ath10k_debug_create(struct ath10k *ar)
if (!ar->debug.fw_crash_data)
return -ENOMEM;

ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN);
if (!ar->debug.cal_data)
return -ENOMEM;

INIT_LIST_HEAD(&ar->debug.fw_stats.pdevs);
INIT_LIST_HEAD(&ar->debug.fw_stats.vdevs);
INIT_LIST_HEAD(&ar->debug.fw_stats.peers);
Expand All @@ -2357,6 +2357,9 @@ void ath10k_debug_destroy(struct ath10k *ar)
vfree(ar->debug.fw_crash_data);
ar->debug.fw_crash_data = NULL;

vfree(ar->debug.cal_data);
ar->debug.cal_data = NULL;

ath10k_debug_fw_stats_reset(ar);

kfree(ar->debug.tpc_stats);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ath6kl/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,7 @@ static const struct sdio_device_id ath6kl_sdio_devices[] = {
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x0))},
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x1))},
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x2))},
{SDIO_DEVICE(MANUFACTURER_CODE, (MANUFACTURER_ID_AR6004_BASE | 0x18))},
{},
};

Expand Down
25 changes: 3 additions & 22 deletions drivers/net/wireless/ath/ath9k/ar9003_calib.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ struct coeff {

enum ar9003_cal_types {
IQ_MISMATCH_CAL = BIT(0),
TEMP_COMP_CAL = BIT(1),
};

static void ar9003_hw_setup_calibration(struct ath_hw *ah,
Expand All @@ -59,12 +58,6 @@ static void ar9003_hw_setup_calibration(struct ath_hw *ah,
/* Kick-off cal */
REG_SET_BIT(ah, AR_PHY_TIMING4, AR_PHY_TIMING4_DO_CAL);
break;
case TEMP_COMP_CAL:
ath_dbg(common, CALIBRATE,
"starting Temperature Compensation Calibration\n");
REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_LOCAL);
REG_SET_BIT(ah, AR_CH0_THERM, AR_CH0_THERM_START);
break;
default:
ath_err(common, "Invalid calibration type\n");
break;
Expand Down Expand Up @@ -93,8 +86,7 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah,
/*
* Accumulate cal measures for active chains
*/
if (cur_caldata->calCollect)
cur_caldata->calCollect(ah);
cur_caldata->calCollect(ah);
ah->cal_samples++;

if (ah->cal_samples >= cur_caldata->calNumSamples) {
Expand All @@ -107,8 +99,7 @@ static bool ar9003_hw_per_calibration(struct ath_hw *ah,
/*
* Process accumulated data
*/
if (cur_caldata->calPostProc)
cur_caldata->calPostProc(ah, numChains);
cur_caldata->calPostProc(ah, numChains);

/* Calibration has finished. */
caldata->CalValid |= cur_caldata->calType;
Expand Down Expand Up @@ -323,24 +314,17 @@ static const struct ath9k_percal_data iq_cal_single_sample = {
ar9003_hw_iqcalibrate
};

static const struct ath9k_percal_data temp_cal_single_sample = {
TEMP_COMP_CAL,
MIN_CAL_SAMPLES,
PER_MAX_LOG_COUNT,
};

static void ar9003_hw_init_cal_settings(struct ath_hw *ah)
{
ah->iq_caldata.calData = &iq_cal_single_sample;
ah->temp_caldata.calData = &temp_cal_single_sample;

if (AR_SREV_9300_20_OR_LATER(ah)) {
ah->enabled_cals |= TX_IQ_CAL;
if (AR_SREV_9485_OR_LATER(ah) && !AR_SREV_9340(ah))
ah->enabled_cals |= TX_IQ_ON_AGC_CAL;
}

ah->supp_cals = IQ_MISMATCH_CAL | TEMP_COMP_CAL;
ah->supp_cals = IQ_MISMATCH_CAL;
}

#define OFF_UPPER_LT 24
Expand Down Expand Up @@ -1399,9 +1383,6 @@ static void ar9003_hw_init_cal_common(struct ath_hw *ah)
INIT_CAL(&ah->iq_caldata);
INSERT_CAL(ah, &ah->iq_caldata);

INIT_CAL(&ah->temp_caldata);
INSERT_CAL(ah, &ah->temp_caldata);

/* Initialize current pointer to first element in list */
ah->cal_list_curr = ah->cal_list;

Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/ath/ath9k/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,6 @@ struct ath_hw {
/* Calibration */
u32 supp_cals;
struct ath9k_cal_list iq_caldata;
struct ath9k_cal_list temp_caldata;
struct ath9k_cal_list adcgain_caldata;
struct ath9k_cal_list adcdc_caldata;
struct ath9k_cal_list *cal_list;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ struct rtl8xxxu_rxdesc16 {
u32 pattern1match:1;
u32 pattern0match:1;
#endif
__le32 tsfl;
u32 tsfl;
#if 0
u32 bassn:12;
u32 bavld:1;
Expand Down Expand Up @@ -368,7 +368,7 @@ struct rtl8xxxu_rxdesc24 {
u32 ldcp:1;
u32 splcp:1;
#endif
__le32 tsfl;
u32 tsfl;
};

struct rtl8xxxu_txdesc32 {
Expand Down
8 changes: 7 additions & 1 deletion drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,9 @@ static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv)
int count, ret = 0;

/* Turn off RF */
rtl8xxxu_write8(priv, REG_RF_CTRL, 0);
val8 = rtl8xxxu_read8(priv, REG_RF_CTRL);
val8 &= ~RF_ENABLE;
rtl8xxxu_write8(priv, REG_RF_CTRL, val8);

/* Switch DPDT_SEL_P output from register 0x65[2] */
val8 = rtl8xxxu_read8(priv, REG_LEDCFG2);
Expand Down Expand Up @@ -1593,6 +1595,10 @@ static void rtl8192e_enable_rf(struct rtl8xxxu_priv *priv)
u32 val32;
u8 val8;

val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA);
val32 |= (BIT(22) | BIT(23));
rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32);

val8 = rtl8xxxu_read8(priv, REG_GPIO_MUXCFG);
val8 |= BIT(5);
rtl8xxxu_write8(priv, REG_GPIO_MUXCFG, val8);
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,10 @@ static void rtl8723b_enable_rf(struct rtl8xxxu_priv *priv)
u32 val32;
u8 val8;

val32 = rtl8xxxu_read32(priv, REG_RX_WAIT_CCA);
val32 |= (BIT(22) | BIT(23));
rtl8xxxu_write32(priv, REG_RX_WAIT_CCA, val32);

/*
* No indication anywhere as to what 0x0790 does. The 2 antenna
* vendor code preserves bits 6-7 here.
Expand Down
11 changes: 8 additions & 3 deletions drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5197,7 +5197,12 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
pkt_offset = roundup(pkt_len + drvinfo_sz + desc_shift +
sizeof(struct rtl8xxxu_rxdesc16), 128);

if (pkt_cnt > 1)
/*
* Only clone the skb if there's enough data at the end to
* at least cover the rx descriptor
*/
if (pkt_cnt > 1 &&
urb_len > (pkt_offset + sizeof(struct rtl8xxxu_rxdesc16)))
next_skb = skb_clone(skb, GFP_ATOMIC);

rx_status = IEEE80211_SKB_RXCB(skb);
Expand All @@ -5215,7 +5220,7 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats,
rx_desc->rxmcs);

rx_status->mactime = le32_to_cpu(rx_desc->tsfl);
rx_status->mactime = rx_desc->tsfl;
rx_status->flag |= RX_FLAG_MACTIME_START;

if (!rx_desc->swdec)
Expand Down Expand Up @@ -5285,7 +5290,7 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8xxxu_priv *priv, struct sk_buff *skb)
rtl8xxxu_rx_parse_phystats(priv, rx_status, phy_stats,
rx_desc->rxmcs);

rx_status->mactime = le32_to_cpu(rx_desc->tsfl);
rx_status->mactime = rx_desc->tsfl;
rx_status->flag |= RX_FLAG_MACTIME_START;

if (!rx_desc->swdec)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/realtek/rtlwifi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static void rtl_fw_do_work(const struct firmware *firmware, void *context,
if (!err)
goto found_alt;
}
pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
pr_err("Selected firmware is not available\n");
rtlpriv->max_fw_size = 0;
return;
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
u8 tid;
char *fw_name;

rtl8188ee_bt_reg_init(hw);
rtlpriv->dm.dm_initialgain_enable = 1;
Expand Down Expand Up @@ -169,10 +170,10 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
return 1;
}

rtlpriv->cfg->fw_name = "rtlwifi/rtl8188efw.bin";
fw_name = "rtlwifi/rtl8188efw.bin";
rtlpriv->max_fw_size = 0x8000;
pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
pr_info("Using firmware %s\n", fw_name);
err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
rtlpriv->io.dev, GFP_KERNEL, hw,
rtl_fw_cb);
if (err) {
Expand Down Expand Up @@ -284,7 +285,6 @@ static const struct rtl_hal_cfg rtl88ee_hal_cfg = {
.bar_id = 2,
.write_readback = true,
.name = "rtl88e_pci",
.fw_name = "rtlwifi/rtl8188efw.bin",
.ops = &rtl8188ee_hal_ops,
.mod_params = &rtl88ee_mod_params,

Expand Down
Loading

0 comments on commit 9e55d0f

Please sign in to comment.