Commit 5a63b04e authored by Kalle Valo's avatar Kalle Valo

Merge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git

ath.git patches for 4.15. Major changes:

ath10k

* add support for CCMP-256, GCMP and GCMP-256 ciphers on hardware
  there it's supported (QCA99x0 and QCA4019)
parents 1d1aa8f1 0a590a38
...@@ -74,6 +74,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -74,6 +74,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA9887_HW_1_0_VERSION, .id = QCA9887_HW_1_0_VERSION,
...@@ -97,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -97,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA6174_HW_2_1_VERSION, .id = QCA6174_HW_2_1_VERSION,
...@@ -119,6 +121,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -119,6 +121,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA6174_HW_2_1_VERSION, .id = QCA6174_HW_2_1_VERSION,
...@@ -141,6 +144,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -141,6 +144,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA6174_HW_3_0_VERSION, .id = QCA6174_HW_3_0_VERSION,
...@@ -163,6 +167,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -163,6 +167,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA6174_HW_3_2_VERSION, .id = QCA6174_HW_3_2_VERSION,
...@@ -188,6 +193,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -188,6 +193,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA99X0_HW_2_0_DEV_VERSION, .id = QCA99X0_HW_2_0_DEV_VERSION,
...@@ -216,6 +222,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -216,6 +222,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 4, .spectral_bin_discard = 4,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 11,
}, },
{ {
.id = QCA9984_HW_1_0_DEV_VERSION, .id = QCA9984_HW_1_0_DEV_VERSION,
...@@ -249,6 +256,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -249,6 +256,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
*/ */
.vht160_mcs_rx_highest = 1560, .vht160_mcs_rx_highest = 1560,
.vht160_mcs_tx_highest = 1560, .vht160_mcs_tx_highest = 1560,
.n_cipher_suites = 11,
}, },
{ {
.id = QCA9888_HW_2_0_DEV_VERSION, .id = QCA9888_HW_2_0_DEV_VERSION,
...@@ -281,6 +289,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -281,6 +289,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
*/ */
.vht160_mcs_rx_highest = 780, .vht160_mcs_rx_highest = 780,
.vht160_mcs_tx_highest = 780, .vht160_mcs_tx_highest = 780,
.n_cipher_suites = 11,
}, },
{ {
.id = QCA9377_HW_1_0_DEV_VERSION, .id = QCA9377_HW_1_0_DEV_VERSION,
...@@ -303,6 +312,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -303,6 +312,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA9377_HW_1_1_DEV_VERSION, .id = QCA9377_HW_1_1_DEV_VERSION,
...@@ -327,6 +337,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -327,6 +337,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 0, .spectral_bin_discard = 0,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 8,
}, },
{ {
.id = QCA4019_HW_1_0_DEV_VERSION, .id = QCA4019_HW_1_0_DEV_VERSION,
...@@ -356,6 +367,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { ...@@ -356,6 +367,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.spectral_bin_discard = 4, .spectral_bin_discard = 4,
.vht160_mcs_rx_highest = 0, .vht160_mcs_rx_highest = 0,
.vht160_mcs_tx_highest = 0, .vht160_mcs_tx_highest = 0,
.n_cipher_suites = 11,
}, },
}; };
...@@ -377,6 +389,7 @@ static const char *const ath10k_core_fw_feature_str[] = { ...@@ -377,6 +389,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
[ATH10K_FW_FEATURE_BTCOEX_PARAM] = "btcoex-param", [ATH10K_FW_FEATURE_BTCOEX_PARAM] = "btcoex-param",
[ATH10K_FW_FEATURE_SKIP_NULL_FUNC_WAR] = "skip-null-func-war", [ATH10K_FW_FEATURE_SKIP_NULL_FUNC_WAR] = "skip-null-func-war",
[ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST] = "allows-mesh-bcast", [ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST] = "allows-mesh-bcast",
[ATH10K_FW_FEATURE_NO_PS] = "no-ps",
}; };
static unsigned int ath10k_core_get_fw_feature_str(char *buf, static unsigned int ath10k_core_get_fw_feature_str(char *buf,
......
...@@ -612,6 +612,9 @@ enum ath10k_fw_features { ...@@ -612,6 +612,9 @@ enum ath10k_fw_features {
*/ */
ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST = 16, ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST = 16,
/* Firmware does not support power save in station mode. */
ATH10K_FW_FEATURE_NO_PS = 17,
/* keep last */ /* keep last */
ATH10K_FW_FEATURE_COUNT, ATH10K_FW_FEATURE_COUNT,
}; };
......
...@@ -310,7 +310,7 @@ static struct ath10k_hw_ce_dst_src_wm_regs wcn3990_wm_dst_ring = { ...@@ -310,7 +310,7 @@ static struct ath10k_hw_ce_dst_src_wm_regs wcn3990_wm_dst_ring = {
.wm_high = &wcn3990_dst_wm_high, .wm_high = &wcn3990_dst_wm_high,
}; };
struct ath10k_hw_ce_regs wcn3990_ce_regs = { const struct ath10k_hw_ce_regs wcn3990_ce_regs = {
.sr_base_addr = 0x00000000, .sr_base_addr = 0x00000000,
.sr_size_addr = 0x00000008, .sr_size_addr = 0x00000008,
.dr_base_addr = 0x0000000c, .dr_base_addr = 0x0000000c,
...@@ -457,7 +457,7 @@ static struct ath10k_hw_ce_dst_src_wm_regs qcax_wm_dst_ring = { ...@@ -457,7 +457,7 @@ static struct ath10k_hw_ce_dst_src_wm_regs qcax_wm_dst_ring = {
.wm_high = &qcax_dst_wm_high, .wm_high = &qcax_dst_wm_high,
}; };
struct ath10k_hw_ce_regs qcax_ce_regs = { const struct ath10k_hw_ce_regs qcax_ce_regs = {
.sr_base_addr = 0x00000000, .sr_base_addr = 0x00000000,
.sr_size_addr = 0x00000004, .sr_size_addr = 0x00000004,
.dr_base_addr = 0x00000008, .dr_base_addr = 0x00000008,
...@@ -604,8 +604,13 @@ static void ath10k_hw_qca988x_set_coverage_class(struct ath10k *ar, ...@@ -604,8 +604,13 @@ static void ath10k_hw_qca988x_set_coverage_class(struct ath10k *ar,
/* Only modify registers if the core is started. */ /* Only modify registers if the core is started. */
if ((ar->state != ATH10K_STATE_ON) && if ((ar->state != ATH10K_STATE_ON) &&
(ar->state != ATH10K_STATE_RESTARTED)) (ar->state != ATH10K_STATE_RESTARTED)) {
spin_lock_bh(&ar->data_lock);
/* Store config value for when radio boots up */
ar->fw_coverage.coverage_class = value;
spin_unlock_bh(&ar->data_lock);
goto unlock; goto unlock;
}
/* Retrieve the current values of the two registers that need to be /* Retrieve the current values of the two registers that need to be
* adjusted. * adjusted.
...@@ -637,7 +642,7 @@ static void ath10k_hw_qca988x_set_coverage_class(struct ath10k *ar, ...@@ -637,7 +642,7 @@ static void ath10k_hw_qca988x_set_coverage_class(struct ath10k *ar,
ar->fw_coverage.reg_ack_cts_timeout_orig = timeout_reg; ar->fw_coverage.reg_ack_cts_timeout_orig = timeout_reg;
ar->fw_coverage.reg_phyclk = phyclk_reg; ar->fw_coverage.reg_phyclk = phyclk_reg;
/* Calculat new value based on the (original) firmware calculation. */ /* Calculate new value based on the (original) firmware calculation. */
slottime_reg = ar->fw_coverage.reg_slottime_orig; slottime_reg = ar->fw_coverage.reg_slottime_orig;
timeout_reg = ar->fw_coverage.reg_ack_cts_timeout_orig; timeout_reg = ar->fw_coverage.reg_ack_cts_timeout_orig;
......
...@@ -369,8 +369,8 @@ extern const struct ath10k_hw_values qca99x0_values; ...@@ -369,8 +369,8 @@ extern const struct ath10k_hw_values qca99x0_values;
extern const struct ath10k_hw_values qca9888_values; extern const struct ath10k_hw_values qca9888_values;
extern const struct ath10k_hw_values qca4019_values; extern const struct ath10k_hw_values qca4019_values;
extern const struct ath10k_hw_values wcn3990_values; extern const struct ath10k_hw_values wcn3990_values;
extern struct ath10k_hw_ce_regs wcn3990_ce_regs; extern const struct ath10k_hw_ce_regs wcn3990_ce_regs;
extern struct ath10k_hw_ce_regs qcax_ce_regs; extern const struct ath10k_hw_ce_regs qcax_ce_regs;
void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey, void ath10k_hw_fill_survey_time(struct ath10k *ar, struct survey_info *survey,
u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev); u32 cc, u32 rcc, u32 cc_prev, u32 rcc_prev);
...@@ -550,6 +550,9 @@ struct ath10k_hw_params { ...@@ -550,6 +550,9 @@ struct ath10k_hw_params {
*/ */
int vht160_mcs_rx_highest; int vht160_mcs_rx_highest;
int vht160_mcs_tx_highest; int vht160_mcs_tx_highest;
/* Number of ciphers supported (i.e First N) in cipher_suites array */
int n_cipher_suites;
}; };
struct htt_rx_desc; struct htt_rx_desc;
......
...@@ -242,6 +242,16 @@ static int ath10k_send_key(struct ath10k_vif *arvif, ...@@ -242,6 +242,16 @@ static int ath10k_send_key(struct ath10k_vif *arvif,
case WLAN_CIPHER_SUITE_WEP104: case WLAN_CIPHER_SUITE_WEP104:
arg.key_cipher = WMI_CIPHER_WEP; arg.key_cipher = WMI_CIPHER_WEP;
break; break;
case WLAN_CIPHER_SUITE_CCMP_256:
arg.key_cipher = WMI_CIPHER_AES_CCM;
break;
case WLAN_CIPHER_SUITE_GCMP:
case WLAN_CIPHER_SUITE_GCMP_256:
arg.key_cipher = WMI_CIPHER_AES_GCM;
break;
case WLAN_CIPHER_SUITE_BIP_GMAC_128:
case WLAN_CIPHER_SUITE_BIP_GMAC_256:
case WLAN_CIPHER_SUITE_BIP_CMAC_256:
case WLAN_CIPHER_SUITE_AES_CMAC: case WLAN_CIPHER_SUITE_AES_CMAC:
WARN_ON(1); WARN_ON(1);
return -EINVAL; return -EINVAL;
...@@ -5723,7 +5733,10 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -5723,7 +5733,10 @@ static int ath10k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
u32 flags2; u32 flags2;
/* this one needs to be done in software */ /* this one needs to be done in software */
if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC ||
key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 ||
key->cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 ||
key->cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256)
return 1; return 1;
if (arvif->nohwcrypt) if (arvif->nohwcrypt)
...@@ -8074,7 +8087,22 @@ int ath10k_mac_register(struct ath10k *ar) ...@@ -8074,7 +8087,22 @@ int ath10k_mac_register(struct ath10k *ar)
WLAN_CIPHER_SUITE_WEP104, WLAN_CIPHER_SUITE_WEP104,
WLAN_CIPHER_SUITE_TKIP, WLAN_CIPHER_SUITE_TKIP,
WLAN_CIPHER_SUITE_CCMP, WLAN_CIPHER_SUITE_CCMP,
/* Do not add hardware supported ciphers before this line.
* Allow software encryption for all chips. Don't forget to
* update n_cipher_suites below.
*/
WLAN_CIPHER_SUITE_AES_CMAC, WLAN_CIPHER_SUITE_AES_CMAC,
WLAN_CIPHER_SUITE_BIP_CMAC_256,
WLAN_CIPHER_SUITE_BIP_GMAC_128,
WLAN_CIPHER_SUITE_BIP_GMAC_256,
/* Only QCA99x0 and QCA4019 varients support GCMP-128, GCMP-256
* and CCMP-256 in hardware.
*/
WLAN_CIPHER_SUITE_GCMP,
WLAN_CIPHER_SUITE_GCMP_256,
WLAN_CIPHER_SUITE_CCMP_256,
}; };
struct ieee80211_supported_band *band; struct ieee80211_supported_band *band;
void *channels; void *channels;
...@@ -8146,8 +8174,13 @@ int ath10k_mac_register(struct ath10k *ar) ...@@ -8146,8 +8174,13 @@ int ath10k_mac_register(struct ath10k *ar)
BIT(NL80211_IFTYPE_P2P_GO); BIT(NL80211_IFTYPE_P2P_GO);
ieee80211_hw_set(ar->hw, SIGNAL_DBM); ieee80211_hw_set(ar->hw, SIGNAL_DBM);
ieee80211_hw_set(ar->hw, SUPPORTS_PS);
ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS); if (!test_bit(ATH10K_FW_FEATURE_NO_PS,
ar->running_fw->fw_file.fw_features)) {
ieee80211_hw_set(ar->hw, SUPPORTS_PS);
ieee80211_hw_set(ar->hw, SUPPORTS_DYNAMIC_PS);
}
ieee80211_hw_set(ar->hw, MFP_CAPABLE); ieee80211_hw_set(ar->hw, MFP_CAPABLE);
ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS); ieee80211_hw_set(ar->hw, REPORTS_TX_ACK_STATUS);
ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL); ieee80211_hw_set(ar->hw, HAS_RATE_CONTROL);
...@@ -8313,7 +8346,18 @@ int ath10k_mac_register(struct ath10k *ar) ...@@ -8313,7 +8346,18 @@ int ath10k_mac_register(struct ath10k *ar)
} }
ar->hw->wiphy->cipher_suites = cipher_suites; ar->hw->wiphy->cipher_suites = cipher_suites;
ar->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
/* QCA988x and QCA6174 family chips do not support CCMP-256, GCMP-128
* and GCMP-256 ciphers in hardware. Fetch number of ciphers supported
* from chip specific hw_param table.
*/
if (!ar->hw_params.n_cipher_suites ||
ar->hw_params.n_cipher_suites > ARRAY_SIZE(cipher_suites)) {
ath10k_err(ar, "invalid hw_params.n_cipher_suites %d\n",
ar->hw_params.n_cipher_suites);
ar->hw_params.n_cipher_suites = 8;
}
ar->hw->wiphy->n_cipher_suites = ar->hw_params.n_cipher_suites;
wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
......
...@@ -2580,6 +2580,12 @@ void ath10k_pci_hif_power_down(struct ath10k *ar) ...@@ -2580,6 +2580,12 @@ void ath10k_pci_hif_power_down(struct ath10k *ar)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ath10k_pci_hif_suspend(struct ath10k *ar) static int ath10k_pci_hif_suspend(struct ath10k *ar)
{
/* Nothing to do; the important stuff is in the driver suspend. */
return 0;
}
static int ath10k_pci_suspend(struct ath10k *ar)
{ {
/* The grace timer can still be counting down and ar->ps_awake be true. /* The grace timer can still be counting down and ar->ps_awake be true.
* It is known that the device may be asleep after resuming regardless * It is known that the device may be asleep after resuming regardless
...@@ -2592,6 +2598,12 @@ static int ath10k_pci_hif_suspend(struct ath10k *ar) ...@@ -2592,6 +2598,12 @@ static int ath10k_pci_hif_suspend(struct ath10k *ar)
} }
static int ath10k_pci_hif_resume(struct ath10k *ar) static int ath10k_pci_hif_resume(struct ath10k *ar)
{
/* Nothing to do; the important stuff is in the driver resume. */
return 0;
}
static int ath10k_pci_resume(struct ath10k *ar)
{ {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
struct pci_dev *pdev = ar_pci->pdev; struct pci_dev *pdev = ar_pci->pdev;
...@@ -3401,11 +3413,7 @@ static __maybe_unused int ath10k_pci_pm_suspend(struct device *dev) ...@@ -3401,11 +3413,7 @@ static __maybe_unused int ath10k_pci_pm_suspend(struct device *dev)
struct ath10k *ar = dev_get_drvdata(dev); struct ath10k *ar = dev_get_drvdata(dev);
int ret; int ret;
if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, ret = ath10k_pci_suspend(ar);
ar->running_fw->fw_file.fw_features))
return 0;
ret = ath10k_hif_suspend(ar);
if (ret) if (ret)
ath10k_warn(ar, "failed to suspend hif: %d\n", ret); ath10k_warn(ar, "failed to suspend hif: %d\n", ret);
...@@ -3417,11 +3425,7 @@ static __maybe_unused int ath10k_pci_pm_resume(struct device *dev) ...@@ -3417,11 +3425,7 @@ static __maybe_unused int ath10k_pci_pm_resume(struct device *dev)
struct ath10k *ar = dev_get_drvdata(dev); struct ath10k *ar = dev_get_drvdata(dev);
int ret; int ret;
if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, ret = ath10k_pci_resume(ar);
ar->running_fw->fw_file.fw_features))
return 0;
ret = ath10k_hif_resume(ar);
if (ret) if (ret)
ath10k_warn(ar, "failed to resume hif: %d\n", ret); ath10k_warn(ar, "failed to resume hif: %d\n", ret);
......
...@@ -4751,6 +4751,7 @@ struct wmi_key_seq_counter { ...@@ -4751,6 +4751,7 @@ struct wmi_key_seq_counter {
#define WMI_CIPHER_WAPI 0x5 #define WMI_CIPHER_WAPI 0x5
#define WMI_CIPHER_CKIP 0x6 #define WMI_CIPHER_CKIP 0x6
#define WMI_CIPHER_AES_CMAC 0x7 #define WMI_CIPHER_AES_CMAC 0x7
#define WMI_CIPHER_AES_GCM 0x8
struct wmi_vdev_install_key_cmd { struct wmi_vdev_install_key_cmd {
__le32 vdev_id; __le32 vdev_id;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <linux/kernel.h>
#include "hw.h" #include "hw.h"
#include "ar9003_phy.h" #include "ar9003_phy.h"
#include "ar9003_eeprom.h" #include "ar9003_eeprom.h"
...@@ -2946,14 +2947,12 @@ static const struct ar9300_eeprom *ar9300_eep_templates[] = { ...@@ -2946,14 +2947,12 @@ static const struct ar9300_eeprom *ar9300_eep_templates[] = {
static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id) static const struct ar9300_eeprom *ar9003_eeprom_struct_find_by_id(int id)
{ {
#define N_LOOP (sizeof(ar9300_eep_templates) / sizeof(ar9300_eep_templates[0]))
int it; int it;
for (it = 0; it < N_LOOP; it++) for (it = 0; it < ARRAY_SIZE(ar9300_eep_templates); it++)
if (ar9300_eep_templates[it]->templateVersion == id) if (ar9300_eep_templates[it]->templateVersion == id)
return ar9300_eep_templates[it]; return ar9300_eep_templates[it];
return NULL; return NULL;
#undef N_LOOP
} }
static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah) static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah)
......
...@@ -480,7 +480,7 @@ EXPORT_SYMBOL(ath9k_hw_addrxbuf_edma); ...@@ -480,7 +480,7 @@ EXPORT_SYMBOL(ath9k_hw_addrxbuf_edma);
int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
void *buf_addr) void *buf_addr)
{ {
struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr; struct ar9003_rxs *rxsp = buf_addr;
unsigned int phyerr; unsigned int phyerr;
if ((rxsp->status11 & AR_RxDone) == 0) if ((rxsp->status11 & AR_RxDone) == 0)
...@@ -610,7 +610,7 @@ void ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start, ...@@ -610,7 +610,7 @@ void ath9k_hw_setup_statusring(struct ath_hw *ah, void *ts_start,
ah->ts_paddr_start = ts_paddr_start; ah->ts_paddr_start = ts_paddr_start;
ah->ts_paddr_end = ts_paddr_start + (size * sizeof(struct ar9003_txs)); ah->ts_paddr_end = ts_paddr_start + (size * sizeof(struct ar9003_txs));
ah->ts_size = size; ah->ts_size = size;
ah->ts_ring = (struct ar9003_txs *) ts_start; ah->ts_ring = ts_start;
ath9k_hw_reset_txstatus_ring(ah); ath9k_hw_reset_txstatus_ring(ah);
} }
......
...@@ -29,6 +29,7 @@ static int ath_set_channel(struct ath_softc *sc) ...@@ -29,6 +29,7 @@ static int ath_set_channel(struct ath_softc *sc)
struct cfg80211_chan_def *chandef = &sc->cur_chan->chandef; struct cfg80211_chan_def *chandef = &sc->cur_chan->chandef;
struct ieee80211_channel *chan = chandef->chan; struct ieee80211_channel *chan = chandef->chan;
int pos = chan->hw_value; int pos = chan->hw_value;
unsigned long flags;
int old_pos = -1; int old_pos = -1;
int r; int r;
...@@ -42,9 +43,9 @@ static int ath_set_channel(struct ath_softc *sc) ...@@ -42,9 +43,9 @@ static int ath_set_channel(struct ath_softc *sc)
chan->center_freq, chandef->width); chan->center_freq, chandef->width);
/* update survey stats for the old channel before switching */ /* update survey stats for the old channel before switching */
spin_lock_bh(&common->cc_lock); spin_lock_irqsave(&common->cc_lock, flags);
ath_update_survey_stats(sc); ath_update_survey_stats(sc);
spin_unlock_bh(&common->cc_lock); spin_unlock_irqrestore(&common->cc_lock, flags);
ath9k_cmn_get_channel(hw, ah, chandef); ath9k_cmn_get_channel(hw, ah, chandef);
......
...@@ -916,7 +916,7 @@ static int open_file_regdump(struct inode *inode, struct file *file) ...@@ -916,7 +916,7 @@ static int open_file_regdump(struct inode *inode, struct file *file)
u8 *buf; u8 *buf;
int i, j = 0; int i, j = 0;
unsigned long num_regs, regdump_len, max_reg_offset; unsigned long num_regs, regdump_len, max_reg_offset;
const struct reg_hole { static const struct reg_hole {
u32 start; u32 start;
u32 end; u32 end;
} reg_hole_list[] = { } reg_hole_list[] = {
......
...@@ -326,7 +326,7 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data, ...@@ -326,7 +326,7 @@ void ath9k_dfs_process_phyerr(struct ath_softc *sc, void *data,
if (ard.ext_rssi & 0x80) if (ard.ext_rssi & 0x80)
ard.ext_rssi = 0; ard.ext_rssi = 0;
vdata_end = (char *)data + datalen; vdata_end = data + datalen;
ard.pulse_bw_info = vdata_end[-1]; ard.pulse_bw_info = vdata_end[-1];
ard.pulse_length_ext = vdata_end[-2]; ard.pulse_length_ext = vdata_end[-2];
ard.pulse_length_pri = vdata_end[-3]; ard.pulse_length_pri = vdata_end[-3];
......
...@@ -424,7 +424,7 @@ static int hif_usb_send_tx(struct hif_device_usb *hif_dev, struct sk_buff *skb) ...@@ -424,7 +424,7 @@ static int hif_usb_send_tx(struct hif_device_usb *hif_dev, struct sk_buff *skb)
static void hif_usb_start(void *hif_handle) static void hif_usb_start(void *hif_handle)
{ {
struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; struct hif_device_usb *hif_dev = hif_handle;
unsigned long flags; unsigned long flags;
hif_dev->flags |= HIF_USB_START; hif_dev->flags |= HIF_USB_START;
...@@ -436,7 +436,7 @@ static void hif_usb_start(void *hif_handle) ...@@ -436,7 +436,7 @@ static void hif_usb_start(void *hif_handle)
static void hif_usb_stop(void *hif_handle) static void hif_usb_stop(void *hif_handle)
{ {
struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; struct hif_device_usb *hif_dev = hif_handle;
struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL; struct tx_buf *tx_buf = NULL, *tx_buf_tmp = NULL;
unsigned long flags; unsigned long flags;
...@@ -457,7 +457,7 @@ static void hif_usb_stop(void *hif_handle) ...@@ -457,7 +457,7 @@ static void hif_usb_stop(void *hif_handle)
static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb) static int hif_usb_send(void *hif_handle, u8 pipe_id, struct sk_buff *skb)
{ {
struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; struct hif_device_usb *hif_dev = hif_handle;
int ret = 0; int ret = 0;
switch (pipe_id) { switch (pipe_id) {
...@@ -492,7 +492,7 @@ static inline bool check_index(struct sk_buff *skb, u8 idx) ...@@ -492,7 +492,7 @@ static inline bool check_index(struct sk_buff *skb, u8 idx)
static void hif_usb_sta_drain(void *hif_handle, u8 idx) static void hif_usb_sta_drain(void *hif_handle, u8 idx)
{ {
struct hif_device_usb *hif_dev = (struct hif_device_usb *)hif_handle; struct hif_device_usb *hif_dev = hif_handle;
struct sk_buff *skb, *tmp; struct sk_buff *skb, *tmp;
unsigned long flags; unsigned long flags;
......
...@@ -384,7 +384,7 @@ void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv, ...@@ -384,7 +384,7 @@ void ath9k_htc_set_tsfadjust(struct ath9k_htc_priv *priv,
static void ath9k_htc_beacon_iter(void *data, u8 *mac, struct ieee80211_vif *vif) static void ath9k_htc_beacon_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
{ {
bool *beacon_configured = (bool *)data; bool *beacon_configured = data;
struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv; struct ath9k_htc_vif *avp = (struct ath9k_htc_vif *) vif->drv_priv;
if (vif->type == NL80211_IFTYPE_STATION && if (vif->type == NL80211_IFTYPE_STATION &&
......
...@@ -233,7 +233,7 @@ static void ath9k_reg_notifier(struct wiphy *wiphy, ...@@ -233,7 +233,7 @@ static void ath9k_reg_notifier(struct wiphy *wiphy,
static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset) static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
__be32 val, reg = cpu_to_be32(reg_offset); __be32 val, reg = cpu_to_be32(reg_offset);
...@@ -255,7 +255,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset) ...@@ -255,7 +255,7 @@ static unsigned int ath9k_regread(void *hw_priv, u32 reg_offset)
static void ath9k_multi_regread(void *hw_priv, u32 *addr, static void ath9k_multi_regread(void *hw_priv, u32 *addr,
u32 *val, u16 count) u32 *val, u16 count)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
__be32 tmpaddr[8]; __be32 tmpaddr[8];
...@@ -301,7 +301,7 @@ static void ath9k_regwrite_multi(struct ath_common *common) ...@@ -301,7 +301,7 @@ static void ath9k_regwrite_multi(struct ath_common *common)
static void ath9k_regwrite_single(void *hw_priv, u32 val, u32 reg_offset) static void ath9k_regwrite_single(void *hw_priv, u32 val, u32 reg_offset)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
const __be32 buf[2] = { const __be32 buf[2] = {
...@@ -322,7 +322,7 @@ static void ath9k_regwrite_single(void *hw_priv, u32 val, u32 reg_offset) ...@@ -322,7 +322,7 @@ static void ath9k_regwrite_single(void *hw_priv, u32 val, u32 reg_offset)
static void ath9k_regwrite_buffer(void *hw_priv, u32 val, u32 reg_offset) static void ath9k_regwrite_buffer(void *hw_priv, u32 val, u32 reg_offset)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
...@@ -345,7 +345,7 @@ static void ath9k_regwrite_buffer(void *hw_priv, u32 val, u32 reg_offset) ...@@ -345,7 +345,7 @@ static void ath9k_regwrite_buffer(void *hw_priv, u32 val, u32 reg_offset)
static void ath9k_regwrite(void *hw_priv, u32 val, u32 reg_offset) static void ath9k_regwrite(void *hw_priv, u32 val, u32 reg_offset)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
...@@ -357,7 +357,7 @@ static void ath9k_regwrite(void *hw_priv, u32 val, u32 reg_offset) ...@@ -357,7 +357,7 @@ static void ath9k_regwrite(void *hw_priv, u32 val, u32 reg_offset)
static void ath9k_enable_regwrite_buffer(void *hw_priv) static void ath9k_enable_regwrite_buffer(void *hw_priv)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
...@@ -366,7 +366,7 @@ static void ath9k_enable_regwrite_buffer(void *hw_priv) ...@@ -366,7 +366,7 @@ static void ath9k_enable_regwrite_buffer(void *hw_priv)
static void ath9k_regwrite_flush(void *hw_priv) static void ath9k_regwrite_flush(void *hw_priv)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
...@@ -383,7 +383,7 @@ static void ath9k_regwrite_flush(void *hw_priv) ...@@ -383,7 +383,7 @@ static void ath9k_regwrite_flush(void *hw_priv)
static void ath9k_reg_rmw_buffer(void *hw_priv, static void ath9k_reg_rmw_buffer(void *hw_priv,
u32 reg_offset, u32 set, u32 clr) u32 reg_offset, u32 set, u32 clr)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
u32 rsp_status; u32 rsp_status;
...@@ -421,7 +421,7 @@ static void ath9k_reg_rmw_buffer(void *hw_priv, ...@@ -421,7 +421,7 @@ static void ath9k_reg_rmw_buffer(void *hw_priv,
static void ath9k_reg_rmw_flush(void *hw_priv) static void ath9k_reg_rmw_flush(void *hw_priv)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
u32 rsp_status; u32 rsp_status;
...@@ -453,7 +453,7 @@ static void ath9k_reg_rmw_flush(void *hw_priv) ...@@ -453,7 +453,7 @@ static void ath9k_reg_rmw_flush(void *hw_priv)
static void ath9k_enable_rmw_buffer(void *hw_priv) static void ath9k_enable_rmw_buffer(void *hw_priv)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
...@@ -466,7 +466,7 @@ static void ath9k_enable_rmw_buffer(void *hw_priv) ...@@ -466,7 +466,7 @@ static void ath9k_enable_rmw_buffer(void *hw_priv)
static u32 ath9k_reg_rmw_single(void *hw_priv, static u32 ath9k_reg_rmw_single(void *hw_priv,
u32 reg_offset, u32 set, u32 clr) u32 reg_offset, u32 set, u32 clr)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
struct register_rmw buf, buf_ret; struct register_rmw buf, buf_ret;
...@@ -490,7 +490,7 @@ static u32 ath9k_reg_rmw_single(void *hw_priv, ...@@ -490,7 +490,7 @@ static u32 ath9k_reg_rmw_single(void *hw_priv,
static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr) static u32 ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv; struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) common->priv;
......
...@@ -1483,7 +1483,7 @@ static void ath9k_htc_set_bssid(struct ath9k_htc_priv *priv) ...@@ -1483,7 +1483,7 @@ static void ath9k_htc_set_bssid(struct ath9k_htc_priv *priv)
static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif) static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
{ {
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)data; struct ath9k_htc_priv *priv = data;
struct ath_common *common = ath9k_hw_common(priv->ah); struct ath_common *common = ath9k_hw_common(priv->ah);
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
......
...@@ -641,7 +641,7 @@ static struct sk_buff* ath9k_htc_tx_get_packet(struct ath9k_htc_priv *priv, ...@@ -641,7 +641,7 @@ static struct sk_buff* ath9k_htc_tx_get_packet(struct ath9k_htc_priv *priv,
void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event) void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event)
{ {
struct wmi_event_txstatus *txs = (struct wmi_event_txstatus *)wmi_event; struct wmi_event_txstatus *txs = wmi_event;
struct __wmi_event_txstatus *__txs; struct __wmi_event_txstatus *__txs;
struct sk_buff *skb; struct sk_buff *skb;
struct ath9k_htc_tx_event *tx_pend; struct ath9k_htc_tx_event *tx_pend;
...@@ -684,7 +684,7 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event) ...@@ -684,7 +684,7 @@ void ath9k_htc_txstatus(struct ath9k_htc_priv *priv, void *wmi_event)
void ath9k_htc_txep(void *drv_priv, struct sk_buff *skb, void ath9k_htc_txep(void *drv_priv, struct sk_buff *skb,
enum htc_endpoint_id ep_id, bool txok) enum htc_endpoint_id ep_id, bool txok)
{ {
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *) drv_priv; struct ath9k_htc_priv *priv = drv_priv;
struct ath9k_htc_tx_ctl *tx_ctl; struct ath9k_htc_tx_ctl *tx_ctl;
struct sk_buff_head *epid_queue; struct sk_buff_head *epid_queue;
...@@ -1103,7 +1103,7 @@ void ath9k_rx_tasklet(unsigned long data) ...@@ -1103,7 +1103,7 @@ void ath9k_rx_tasklet(unsigned long data)
void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb, void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,
enum htc_endpoint_id ep_id) enum htc_endpoint_id ep_id)
{ {
struct ath9k_htc_priv *priv = (struct ath9k_htc_priv *)drv_priv; struct ath9k_htc_priv *priv = drv_priv;
struct ath_hw *ah = priv->ah; struct ath_hw *ah = priv->ah;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL; struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL;
......
...@@ -117,7 +117,7 @@ static const struct ath_ps_ops ath9k_ps_ops = { ...@@ -117,7 +117,7 @@ static const struct ath_ps_ops ath9k_ps_ops = {
static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv; struct ath_softc *sc = (struct ath_softc *) common->priv;
...@@ -132,7 +132,7 @@ static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset) ...@@ -132,7 +132,7 @@ static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset) static unsigned int ath9k_ioread32(void *hw_priv, u32 reg_offset)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv; struct ath_softc *sc = (struct ath_softc *) common->priv;
u32 val; u32 val;
...@@ -172,7 +172,7 @@ static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset, ...@@ -172,7 +172,7 @@ static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset,
static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr) static unsigned int ath9k_reg_rmw(void *hw_priv, u32 reg_offset, u32 set, u32 clr)
{ {
struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_hw *ah = hw_priv;
struct ath_common *common = ath9k_hw_common(ah); struct ath_common *common = ath9k_hw_common(ah);
struct ath_softc *sc = (struct ath_softc *) common->priv; struct ath_softc *sc = (struct ath_softc *) common->priv;
unsigned long uninitialized_var(flags); unsigned long uninitialized_var(flags);
...@@ -275,7 +275,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, ...@@ -275,7 +275,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
if (!dd->dd_desc) if (!dd->dd_desc)
return -ENOMEM; return -ENOMEM;
ds = (u8 *) dd->dd_desc; ds = dd->dd_desc;
ath_dbg(common, CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n", ath_dbg(common, CONFIG, "%s DMA map: %p (%u) -> %llx (%u)\n",
name, ds, (u32) dd->dd_desc_len, name, ds, (u32) dd->dd_desc_len,
ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len); ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len);
......
...@@ -367,10 +367,10 @@ void ath_ani_calibrate(unsigned long data) ...@@ -367,10 +367,10 @@ void ath_ani_calibrate(unsigned long data)
/* Call ANI routine if necessary */ /* Call ANI routine if necessary */
if (aniflag) { if (aniflag) {
spin_lock(&common->cc_lock); spin_lock_irqsave(&common->cc_lock, flags);
ath9k_hw_ani_monitor(ah, ah->curchan); ath9k_hw_ani_monitor(ah, ah->curchan);
ath_update_survey_stats(sc); ath_update_survey_stats(sc);
spin_unlock(&common->cc_lock); spin_unlock_irqrestore(&common->cc_lock, flags);
} }
/* Perform calibration if necessary */ /* Perform calibration if necessary */
......
...@@ -97,11 +97,12 @@ void ath_ps_full_sleep(unsigned long data) ...@@ -97,11 +97,12 @@ void ath_ps_full_sleep(unsigned long data)
{ {
struct ath_softc *sc = (struct ath_softc *) data; struct ath_softc *sc = (struct ath_softc *) data;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
unsigned long flags;
bool reset; bool reset;
spin_lock(&common->cc_lock); spin_lock_irqsave(&common->cc_lock, flags);
ath_hw_cycle_counters_update(common); ath_hw_cycle_counters_update(common);
spin_unlock(&common->cc_lock); spin_unlock_irqrestore(&common->cc_lock, flags);
ath9k_hw_setrxabort(sc->sc_ah, 1); ath9k_hw_setrxabort(sc->sc_ah, 1);
ath9k_hw_stopdmarecv(sc->sc_ah, &reset); ath9k_hw_stopdmarecv(sc->sc_ah, &reset);
...@@ -394,10 +395,10 @@ void ath9k_tasklet(unsigned long data) ...@@ -394,10 +395,10 @@ void ath9k_tasklet(unsigned long data)
if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) && if ((ah->config.hw_hang_checks & HW_BB_WATCHDOG) &&
(status & ATH9K_INT_BB_WATCHDOG)) { (status & ATH9K_INT_BB_WATCHDOG)) {
spin_lock(&common->cc_lock); spin_lock_irqsave(&common->cc_lock, flags);
ath_hw_cycle_counters_update(common); ath_hw_cycle_counters_update(common);
ar9003_hw_bb_watchdog_dbg_info(ah); ar9003_hw_bb_watchdog_dbg_info(ah);
spin_unlock(&common->cc_lock); spin_unlock_irqrestore(&common->cc_lock, flags);
if (ar9003_hw_bb_watchdog_check(ah)) { if (ar9003_hw_bb_watchdog_check(ah)) {
type = RESET_TYPE_BB_WATCHDOG; type = RESET_TYPE_BB_WATCHDOG;
...@@ -1193,7 +1194,7 @@ void ath9k_calculate_summary_state(struct ath_softc *sc, ...@@ -1193,7 +1194,7 @@ void ath9k_calculate_summary_state(struct ath_softc *sc,
static void ath9k_tpc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) static void ath9k_tpc_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
{ {
int *power = (int *)data; int *power = data;
if (*power < vif->bss_conf.txpower) if (*power < vif->bss_conf.txpower)
*power = vif->bss_conf.txpower; *power = vif->bss_conf.txpower;
...@@ -1955,12 +1956,13 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx, ...@@ -1955,12 +1956,13 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
unsigned long flags;
int pos; int pos;
if (IS_ENABLED(CONFIG_ATH9K_TX99)) if (IS_ENABLED(CONFIG_ATH9K_TX99))
return -EOPNOTSUPP; return -EOPNOTSUPP;
spin_lock_bh(&common->cc_lock); spin_lock_irqsave(&common->cc_lock, flags);
if (idx == 0) if (idx == 0)
ath_update_survey_stats(sc); ath_update_survey_stats(sc);
...@@ -1974,7 +1976,7 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx, ...@@ -1974,7 +1976,7 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
sband = hw->wiphy->bands[NL80211_BAND_5GHZ]; sband = hw->wiphy->bands[NL80211_BAND_5GHZ];
if (!sband || idx >= sband->n_channels) { if (!sband || idx >= sband->n_channels) {
spin_unlock_bh(&common->cc_lock); spin_unlock_irqrestore(&common->cc_lock, flags);
return -ENOENT; return -ENOENT;
} }
...@@ -1982,7 +1984,7 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx, ...@@ -1982,7 +1984,7 @@ static int ath9k_get_survey(struct ieee80211_hw *hw, int idx,
pos = chan->hw_value; pos = chan->hw_value;
memcpy(survey, &sc->survey[pos], sizeof(*survey)); memcpy(survey, &sc->survey[pos], sizeof(*survey));
survey->channel = chan; survey->channel = chan;
spin_unlock_bh(&common->cc_lock); spin_unlock_irqrestore(&common->cc_lock, flags);
return 0; return 0;
} }
......
...@@ -453,7 +453,7 @@ int ath_mci_setup(struct ath_softc *sc) ...@@ -453,7 +453,7 @@ int ath_mci_setup(struct ath_softc *sc)
mci->sched_buf.bf_len = ATH_MCI_SCHED_BUF_SIZE; mci->sched_buf.bf_len = ATH_MCI_SCHED_BUF_SIZE;
mci->gpm_buf.bf_len = ATH_MCI_GPM_BUF_SIZE; mci->gpm_buf.bf_len = ATH_MCI_GPM_BUF_SIZE;
mci->gpm_buf.bf_addr = (u8 *)mci->sched_buf.bf_addr + mci->sched_buf.bf_len; mci->gpm_buf.bf_addr = mci->sched_buf.bf_addr + mci->sched_buf.bf_len;
mci->gpm_buf.bf_paddr = mci->sched_buf.bf_paddr + mci->sched_buf.bf_len; mci->gpm_buf.bf_paddr = mci->sched_buf.bf_paddr + mci->sched_buf.bf_len;
ret = ar9003_mci_setup(sc->sc_ah, mci->gpm_buf.bf_paddr, ret = ar9003_mci_setup(sc->sc_ah, mci->gpm_buf.bf_paddr,
......
...@@ -179,6 +179,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, ...@@ -179,6 +179,9 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
ssize_t len; ssize_t len;
int r; int r;
if (count < 1)
return -EINVAL;
if (sc->cur_chan->nvifs > 1) if (sc->cur_chan->nvifs > 1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -186,6 +189,8 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf, ...@@ -186,6 +189,8 @@ static ssize_t write_file_tx99(struct file *file, const char __user *user_buf,
if (copy_from_user(buf, user_buf, len)) if (copy_from_user(buf, user_buf, len))
return -EFAULT; return -EFAULT;
buf[len] = '\0';
if (strtobool(buf, &start)) if (strtobool(buf, &start))
return -EINVAL; return -EINVAL;
......
...@@ -159,7 +159,7 @@ void ath9k_wmi_event_tasklet(unsigned long data) ...@@ -159,7 +159,7 @@ void ath9k_wmi_event_tasklet(unsigned long data)
switch (cmd_id) { switch (cmd_id) {
case WMI_SWBA_EVENTID: case WMI_SWBA_EVENTID:
swba = (struct wmi_event_swba *) wmi_event; swba = wmi_event;
ath9k_htc_swba(priv, swba); ath9k_htc_swba(priv, swba);
break; break;
case WMI_FATAL_EVENTID: case WMI_FATAL_EVENTID:
...@@ -207,7 +207,7 @@ static void ath9k_wmi_rsp_callback(struct wmi *wmi, struct sk_buff *skb) ...@@ -207,7 +207,7 @@ static void ath9k_wmi_rsp_callback(struct wmi *wmi, struct sk_buff *skb)
static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb, static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
enum htc_endpoint_id epid) enum htc_endpoint_id epid)
{ {
struct wmi *wmi = (struct wmi *) priv; struct wmi *wmi = priv;
struct wmi_cmd_hdr *hdr; struct wmi_cmd_hdr *hdr;
u16 cmd_id; u16 cmd_id;
......
...@@ -1136,7 +1136,8 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn) ...@@ -1136,7 +1136,8 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
BIT(NL80211_IFTYPE_MESH_POINT); BIT(NL80211_IFTYPE_MESH_POINT);
wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = &wcn_band_2ghz; wcn->hw->wiphy->bands[NL80211_BAND_2GHZ] = &wcn_band_2ghz;
wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = &wcn_band_5ghz; if (wcn->rf_id != RF_IRIS_WCN3620)
wcn->hw->wiphy->bands[NL80211_BAND_5GHZ] = &wcn_band_5ghz;
wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS; wcn->hw->wiphy->max_scan_ssids = WCN36XX_MAX_SCAN_SSIDS;
wcn->hw->wiphy->max_scan_ie_len = WCN36XX_MAX_SCAN_IE_LEN; wcn->hw->wiphy->max_scan_ie_len = WCN36XX_MAX_SCAN_IE_LEN;
...@@ -1169,6 +1170,7 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn, ...@@ -1169,6 +1170,7 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
struct platform_device *pdev) struct platform_device *pdev)
{ {
struct device_node *mmio_node; struct device_node *mmio_node;
struct device_node *iris_node;
struct resource *res; struct resource *res;
int index; int index;
int ret; int ret;
...@@ -1231,6 +1233,14 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn, ...@@ -1231,6 +1233,14 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
goto unmap_ccu; goto unmap_ccu;
} }
/* External RF module */
iris_node = of_find_node_by_name(mmio_node, "iris");
if (iris_node) {
if (of_device_is_compatible(iris_node, "qcom,wcn3620"))
wcn->rf_id = RF_IRIS_WCN3620;
of_node_put(iris_node);
}
of_node_put(mmio_node); of_node_put(mmio_node);
return 0; return 0;
......
...@@ -94,6 +94,9 @@ enum wcn36xx_ampdu_state { ...@@ -94,6 +94,9 @@ enum wcn36xx_ampdu_state {
#define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags) #define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags)
#define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power) #define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power)
#define RF_UNKNOWN 0x0000
#define RF_IRIS_WCN3620 0x3620
static inline void buff_to_be(u32 *buf, size_t len) static inline void buff_to_be(u32 *buf, size_t len)
{ {
int i; int i;
...@@ -241,6 +244,9 @@ struct wcn36xx { ...@@ -241,6 +244,9 @@ struct wcn36xx {
struct sk_buff *tx_ack_skb; struct sk_buff *tx_ack_skb;
/* RF module */
unsigned rf_id;
#ifdef CONFIG_WCN36XX_DEBUGFS #ifdef CONFIG_WCN36XX_DEBUGFS
/* Debug file system entry */ /* Debug file system entry */
struct wcn36xx_dfs_entry dfs; struct wcn36xx_dfs_entry dfs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment