iwlwifi: mvm: use correct GP2 register address for 22000 family
authorAvraham Stern <avraham.stern@intel.com>
Wed, 27 Feb 2019 09:51:11 +0000 (11:51 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 3 Apr 2019 08:20:04 +0000 (11:20 +0300)
The device time register address has changed for 22000 devices.
Add a util function for getting the GP2 time and use the correct
register address depending on the device family.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/cfg/22000.c
drivers/net/wireless/intel/iwlwifi/iwl-config.h
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index 33c9566..e0db198 100644 (file)
@@ -194,7 +194,8 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
        IWL_DEVICE_22000_COMMON,                                        \
        .device_family = IWL_DEVICE_FAMILY_22000,                       \
        .base_params = &iwl_22000_base_params,                          \
-       .csr = &iwl_csr_v1
+       .csr = &iwl_csr_v1,                                             \
+       .gp2_reg_addr = 0xa02c68
 
 #define IWL_DEVICE_22560                                               \
        IWL_DEVICE_22000_COMMON,                                        \
@@ -207,7 +208,8 @@ static const struct iwl_ht_params iwl_22000_ht_params = {
        .device_family = IWL_DEVICE_FAMILY_AX210,                       \
        .base_params = &iwl_22000_base_params,                          \
        .csr = &iwl_csr_v1,                                             \
-       .min_txq_size = 128
+       .min_txq_size = 128,                                            \
+       .gp2_reg_addr = 0xd02c68
 
 const struct iwl_cfg iwl22000_2ac_cfg_hr = {
        .name = "Intel(R) Dual Band Wireless AC 22000",
index 76c1e44..bc929d6 100644 (file)
@@ -456,6 +456,7 @@ struct iwl_cfg {
        u32 fw_mon_smem_write_ptr_msk;
        u32 fw_mon_smem_cycle_cnt_ptr_addr;
        u32 fw_mon_smem_cycle_cnt_ptr_msk;
+       u32 gp2_reg_addr;
 };
 
 extern const struct iwl_csr_params iwl_csr_v1;
index 76bf7fb..fcec25b 100644 (file)
@@ -1113,9 +1113,7 @@ static void iwl_mvm_mac_ctxt_cmd_fill_ap(struct iwl_mvm *mvm,
                                ieee80211_tu_to_usec(data.beacon_int * rand /
                                                     100);
                } else {
-                       mvmvif->ap_beacon_time =
-                               iwl_read_prph(mvm->trans,
-                                             DEVICE_SYSTEM_TIME_REG);
+                       mvmvif->ap_beacon_time = iwl_mvm_get_systime(mvm);
                }
        }
 
index ed866de..d55c7df 100644 (file)
@@ -3730,7 +3730,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
                                    struct ieee80211_vif *vif,
                                    int duration)
 {
-       int res, time_reg = DEVICE_SYSTEM_TIME_REG;
+       int res;
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        struct iwl_mvm_time_event_data *te_data = &mvmvif->hs_time_event_data;
        static const u16 time_event_response[] = { HOT_SPOT_CMD };
@@ -3756,7 +3756,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
                              0);
 
        /* Set the time and duration */
-       tail->apply_time = cpu_to_le32(iwl_read_prph(mvm->trans, time_reg));
+       tail->apply_time = cpu_to_le32(iwl_mvm_get_systime(mvm));
 
        delay = AUX_ROC_MIN_DELAY;
        req_dur = MSEC_TO_TU(duration);
index 45d7a86..cdac510 100644 (file)
@@ -1539,6 +1539,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm);
 u8 first_antenna(u8 mask);
 u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx);
 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime);
+u32 iwl_mvm_get_systime(struct iwl_mvm *mvm);
 
 /* Tx / Host Commands */
 int __must_check iwl_mvm_send_cmd(struct iwl_mvm *mvm,
index 859aa5a..9df21a8 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright(c) 2014 Intel Mobile Communications GmbH
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(C) 2018 Intel Corporation
+ * Copyright(C) 2018 - 2019 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -29,7 +29,7 @@
  *
  * Copyright(c) 2014 Intel Mobile Communications GmbH
  * Copyright(c) 2017 Intel Deutschland GmbH
- * Copyright(C) 2018 Intel Corporation
+ * Copyright(C) 2018 - 2019 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -252,8 +252,7 @@ static void iwl_mvm_tdls_update_cs_state(struct iwl_mvm *mvm,
 
        /* we only send requests to our switching peer - update sent time */
        if (state == IWL_MVM_TDLS_SW_REQ_SENT)
-               mvm->tdls_cs.peer.sent_timestamp =
-                       iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG);
+               mvm->tdls_cs.peer.sent_timestamp = iwl_mvm_get_systime(mvm);
 
        if (state == IWL_MVM_TDLS_SW_IDLE)
                mvm->tdls_cs.cur_sta_id = IWL_MVM_INVALID_STA;
index 4649327..b9914ef 100644 (file)
@@ -1418,6 +1418,16 @@ void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
        cancel_delayed_work_sync(&mvmvif->uapsd_nonagg_detected_wk);
 }
 
+u32 iwl_mvm_get_systime(struct iwl_mvm *mvm)
+{
+       u32 reg_addr = DEVICE_SYSTEM_TIME_REG;
+
+       if (mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22000 &&
+           mvm->trans->cfg->gp2_reg_addr)
+               reg_addr = mvm->trans->cfg->gp2_reg_addr;
+
+       return iwl_read_prph(mvm->trans, reg_addr);
+}
 
 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime)
 {
@@ -1432,7 +1442,7 @@ void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime)
                iwl_mvm_power_update_device(mvm);
        }
 
-       *gp2 = iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG);
+       *gp2 = iwl_mvm_get_systime(mvm);
        *boottime = ktime_get_boot_ns();
 
        if (!ps_disabled) {