]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: restrict TOP reset to some devices
authorJohannes Berg <johannes.berg@intel.com>
Thu, 19 Mar 2026 18:48:42 +0000 (20:48 +0200)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 25 Mar 2026 09:31:56 +0000 (11:31 +0200)
Due to the Bluetooth implementation needing to match, not all
devices can actually do TOP reset. Restrict it to Sc2/Sc2f or
later, with Wh RF or later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260319204647.6c4479f4e49d.I5023d70cb33f1e18f7cb15981fc3acfbb00862b7@changeid
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c

index 89901786fd6878626390a193b7b89d7f6a71e2fc..16b2c313e72b25e8ff38045cbc6c6a090457fb75 100644 (file)
@@ -138,7 +138,7 @@ iwl_trans_determine_restart_mode(struct iwl_trans *trans)
                IWL_RESET_MODE_FUNC_RESET,
                IWL_RESET_MODE_PROD_RESET,
        };
-       static const enum iwl_reset_mode escalation_list_sc[] = {
+       static const enum iwl_reset_mode escalation_list_top[] = {
                IWL_RESET_MODE_SW_RESET,
                IWL_RESET_MODE_REPROBE,
                IWL_RESET_MODE_REPROBE,
@@ -159,14 +159,14 @@ iwl_trans_determine_restart_mode(struct iwl_trans *trans)
 
        if (trans->request_top_reset) {
                trans->request_top_reset = 0;
-               if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_SC)
+               if (iwl_trans_is_top_reset_supported(trans))
                        return IWL_RESET_MODE_TOP_RESET;
                return IWL_RESET_MODE_PROD_RESET;
        }
 
-       if (trans->mac_cfg->device_family >= IWL_DEVICE_FAMILY_SC) {
-               escalation_list = escalation_list_sc;
-               escalation_list_size = ARRAY_SIZE(escalation_list_sc);
+       if (iwl_trans_is_top_reset_supported(trans)) {
+               escalation_list = escalation_list_top;
+               escalation_list_size = ARRAY_SIZE(escalation_list_top);
        } else {
                escalation_list = escalation_list_old;
                escalation_list_size = ARRAY_SIZE(escalation_list_old);
index aa0952a011e01be165215602c28b982383c6b220..61e4f4776dcb30c064af3e31f5aa68920b9f2253 100644 (file)
@@ -1258,4 +1258,22 @@ bool iwl_trans_is_pm_supported(struct iwl_trans *trans);
 
 bool iwl_trans_is_ltr_enabled(struct iwl_trans *trans);
 
+static inline bool iwl_trans_is_top_reset_supported(struct iwl_trans *trans)
+{
+       /* not supported before Sc family */
+       if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_SC)
+               return false;
+
+       /* for Sc family only supported for Sc2/Sc2f */
+       if (trans->mac_cfg->device_family == IWL_DEVICE_FAMILY_SC &&
+           CSR_HW_REV_TYPE(trans->info.hw_rev) == IWL_CFG_MAC_TYPE_SC)
+               return false;
+
+       /* so far these numbers are increasing - not before Pe */
+       if (CSR_HW_RFID_TYPE(trans->info.hw_rf_id) < IWL_CFG_RF_TYPE_PE)
+               return false;
+
+       return true;
+}
+
 #endif /* __iwl_trans_h__ */
index 4560d92d76fe0a3eebae9bb5ffde43b6803b7b05..a05f60f9224b484829d766d7bd2e1e418c03e2f0 100644 (file)
@@ -3197,7 +3197,7 @@ static ssize_t iwl_dbgfs_reset_write(struct file *file,
                if (!test_bit(STATUS_DEVICE_ENABLED, &trans->status))
                        return -EINVAL;
                if (mode == IWL_RESET_MODE_TOP_RESET) {
-                       if (trans->mac_cfg->device_family < IWL_DEVICE_FAMILY_SC)
+                       if (!iwl_trans_is_top_reset_supported(trans))
                                return -EINVAL;
                        trans->request_top_reset = 1;
                }