iwlwifi: BZ Family SW reset support
authorRoee Goldfiner <roee.h.goldfiner@intel.com>
Sun, 17 Oct 2021 13:25:54 +0000 (16:25 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 22 Oct 2021 07:49:01 +0000 (10:49 +0300)
Previously added BZ reset wasn't taking into account the
call to iwl_trans_pcie_sw_reset which used a pre-BZ logic
to reset the device - enabling iwl_trans_pcie_sw_reset to
support BZ family made this reset redundant.

MAC_ACCESS clear shouldn't be called here but only when calling
_iwl_trans_pcie_stop_device which now support also BZ family.

Signed-off-by: Roee Goldfiner <roee.h.goldfiner@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211017162352.648931fe07e2.Ibf30f9b8e70536da93c4a574ace33d325d3f8da4@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c
drivers/net/wireless/intel/iwlwifi/pcie/trans.c

index a4aad24abb90ed47baec61d02cb8f1fb8be21d67..d7e11cf8627ac49bd9e8bfaea08ea10897f8ad4f 100644 (file)
@@ -163,18 +163,6 @@ void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)
        else
                iwl_pcie_ctxt_info_free(trans);
 
-       /* Make sure (redundant) we've released our request to stay awake */
-       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
-               iwl_clear_bit(trans, CSR_GP_CNTRL,
-                             CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ);
-       else
-               iwl_clear_bit(trans, CSR_GP_CNTRL,
-                             CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-
-       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
-               iwl_set_bit(trans, CSR_GP_CNTRL,
-                           CSR_GP_CNTRL_REG_FLAG_SW_RESET);
-       }
        /* Stop the device, and put it in low power state */
        iwl_pcie_gen2_apm_stop(trans, false);
 
index 22393b724e9856fe2b384763340a5d26fc71d5c0..12a402be2e06e78980b5c03533dcd97795b3c0d2 100644 (file)
@@ -129,7 +129,12 @@ out:
 static void iwl_trans_pcie_sw_reset(struct iwl_trans *trans)
 {
        /* Reset entire device - do controller reset (results in SHRD_HW_RST) */
-       iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
+               iwl_set_bit(trans, CSR_GP_CNTRL,
+                           CSR_GP_CNTRL_REG_FLAG_SW_RESET);
+       else
+               iwl_set_bit(trans, CSR_RESET,
+                           CSR_RESET_REG_FLAG_SW_RESET);
        usleep_range(5000, 6000);
 }
 
@@ -1209,8 +1214,12 @@ static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans)
        }
 
        /* Make sure (redundant) we've released our request to stay awake */
-       iwl_clear_bit(trans, CSR_GP_CNTRL,
-                     CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
+               iwl_clear_bit(trans, CSR_GP_CNTRL,
+                             CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ);
+       else
+               iwl_clear_bit(trans, CSR_GP_CNTRL,
+                             CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
 
        /* Stop the device, and put it in low power state */
        iwl_pcie_apm_stop(trans, false);
@@ -2141,9 +2150,12 @@ static void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans)
 
        if (trans_pcie->cmd_hold_nic_awake)
                goto out;
-
-       __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
-                                  CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+       if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ)
+               __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
+                                          CSR_GP_CNTRL_REG_FLAG_BZ_MAC_ACCESS_REQ);
+       else
+               __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
+                                          CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
        /*
         * Above we read the CSR_GP_CNTRL register, which will flush
         * any previous writes, but we need the write that clears the