[BUGFIX] iwlwifi: pcie: work around suspend/resume issue

In some platforms, having the device enabled with certain radio
frontends causes the platform to not be able to resume properly
from suspend, regardless of the wakeup cause. This was traced to
a hardware issue with the integrated 9000-series A-step variant.
Set the right hardware bit to disable the problematic state.

For Core26 - only - remove the IWL_DEVICE_FAMILY_9000 check as
this wasn't split up in Core26 yet, but Core26 also doesn't have
any support at all for A000 family, so integrated can only mean
9000 family here.

type=bugfix
fixes=unknown
bug=not-tracked

Change-Id: I42cbf6845c5c0c449e689af4571557a9fe584835
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/114526
Reviewed-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Reviewed-by: Coelho, Luciano <luciano.coelho@intel.com>
Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/116796
Reviewed-by: Shaish, Dor <dor.shaish@intel.com>
Tested-by: Shaish, Dor <dor.shaish@intel.com>
x-iwlwifi-stack-dev: f8d8456ab7ab5cd1724628a9bda14a5886660937
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
index ae7e5a6..3b53f9c 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-csr.h
@@ -153,6 +153,10 @@
 /* GIO Chicken Bits (PCI Express bus link power management) */
 #define CSR_GIO_CHICKEN_BITS    (CSR_BASE+0x100)
 
+/* host chicken bits */
+#define CSR_HOST_CHICKEN	(CSR_BASE + 0x204)
+#define CSR_HOST_CHICKEN_PM_IDLE_SRC_DIS_SB_PME	BIT(19)
+
 /* Analog phase-lock-loop configuration  */
 #define CSR_ANA_PLL_CFG         (CSR_BASE+0x20c)
 
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index 3594a43..9d1efae 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -3255,6 +3255,16 @@
 		}
 	}
 
+	/*
+	 * 9000-series integrated A-step has a problem with suspend/resume
+	 * and sometimes even causes the whole platform to get stuck. This
+	 * workaround makes the hardware not go into the problematic state.
+	 */
+	if (trans->cfg->integrated &&
+	    CSR_HW_REV_STEP(trans->hw_rev) == SILICON_A_STEP)
+		iwl_set_bit(trans, CSR_HOST_CHICKEN,
+			    CSR_HOST_CHICKEN_PM_IDLE_SRC_DIS_SB_PME);
+
 	trans->hw_rf_id = iwl_read32(trans, CSR_HW_RF_ID);
 	/*
 	 * The RF_ID is set to zero in blank OTP so read version
diff --git a/versions b/versions
index 5ed1c71..1226826 100644
--- a/versions
+++ b/versions
@@ -2,5 +2,5 @@
 BACKPORTED_KERNEL_VERSION="(see git)"
 BACKPORTED_KERNEL_NAME="iwlwifi"
 BACKPORTS_BUILD_TSTAMP=__DATE__ \" \" __TIME__
-BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:release/LinuxCore26:5867:5e5b1bf6"
+BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:release/LinuxCore26:5868:f8d8456a"
 BACKPORTS_BRANCH_TSTAMP="Jan 09 2017 22:04:37"