Skip to content

Commit a178213

Browse files
egrumbachjmberg-intel
authored andcommitted
wifi: iwlwifi: fix the check for the SCRATCH register upon resume
We can't rely on the SCRATCH register being 0 on platform that power gate the NIC in S3. Even in those platforms, the SCRATCH register is still returning 0x1010000. Make sure that we understand that those platforms have powered off the device. Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219597 Fixes: cb347bd ("wifi: iwlwifi: mvm: fix hibernation") Signed-off-by: Emmanuel Grumbach <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250420095642.a7e082ee785c.I9418d76f860f54261cfa89e1f7ac10300904ba40@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 15220a2 commit a178213

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

drivers/net/wireless/intel/iwlwifi/iwl-csr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
* during a error FW error.
149149
*/
150150
#define CSR_FUNC_SCRATCH_INIT_VALUE (0x01010101)
151+
#define CSR_FUNC_SCRATCH_POWER_OFF_MASK 0xFFFF
151152

152153
/* Bits for CSR_HW_IF_CONFIG_REG */
153154
#define CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP_DASH (0x0000000F)

drivers/net/wireless/intel/iwlwifi/pcie/drv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,11 +1736,13 @@ static int _iwl_pci_resume(struct device *device, bool restore)
17361736
* Scratch value was altered, this means the device was powered off, we
17371737
* need to reset it completely.
17381738
* Note: MAC (bits 0:7) will be cleared upon suspend even with wowlan,
1739-
* so assume that any bits there mean that the device is usable.
1739+
* but not bits [15:8]. So if we have bits set in lower word, assume
1740+
* the device is alive.
17401741
* For older devices, just try silently to grab the NIC.
17411742
*/
17421743
if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) {
1743-
if (!iwl_read32(trans, CSR_FUNC_SCRATCH))
1744+
if (!(iwl_read32(trans, CSR_FUNC_SCRATCH) &
1745+
CSR_FUNC_SCRATCH_POWER_OFF_MASK))
17441746
device_was_powered_off = true;
17451747
} else {
17461748
/*

0 commit comments

Comments
 (0)