BACKPORT: FROMLIST: nvme: Add quirk for LiteON CL1 devices running FW 22301111

One of the components in LiteON CL1 device has limitations that
can be encountered based upon boundary race conditions using the
nvme bus specific suspend to idle flow.

When this situation occurs the drive doesn't resume properly from
suspend-to-idle.

LiteON has confirmed this problem and fixed in the next firmware
version.  As this firmware is already in the field, avoid running
nvme specific suspend to idle flow.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Charles Hyde <charles.hyde@dellteam.com>
(am from https://lore.kernel.org/patchwork/patch/1115371/)

BUG=b:138667115
TEST=ran suspend_stress_test on Fircrest DVT2 with LiteON CL1

Change-Id: I69153656d22d0add2bea90270b584c772ae4a11f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1754633
Reviewed-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Sean Chiang <sean_chiang@dell.corp-partner.google.com>
Commit-Queue: Charles Hyde <charles.hyde@dell.corp-partner.google.com>
(cherry picked from commit 2f7d5297b38e364447fdffda2dfcb2f58e010185)

Signed-off-by: Crag Wang <crag0715@gmail.com>
Change-Id: I69153656d22d0add2bea90270b584c772ae4a11f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1759368
Reviewed-by: YH Lin <yueherngl@chromium.org>
Tested-by: Charles Hyde <charles.hyde@dell.corp-partner.google.com>
Commit-Queue: Simon Glass <sjg@chromium.org>
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8886378..7e7a6f1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2089,6 +2089,16 @@
 		.vid = 0x1179,
 		.mn = "THNSF5256GPUK TOSHIBA",
 		.quirks = NVME_QUIRK_NO_APST,
+	},
+	{
+		/*
+		 * This LiteON CL1-3D*-Q11 firmware version has a race condition
+		 * associated with actions related to suspend to idle.  LiteON
+		 * has resolved the problem in future firmware.
+		 */
+		.vid = 0x14a4,
+		.fr = "22301111",
+		.quirks = NVME_QUIRK_SIMPLE_SUSPEND,
 	}
 };
 
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index bea172c..60e04d0 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -90,6 +90,11 @@
 	 * Set MEDIUM priority on SQ creation
 	 */
 	NVME_QUIRK_MEDIUM_PRIO_SQ		= (1 << 7),
+
+	/*
+	 * Force simple suspend/resume path.
+	 */
+	NVME_QUIRK_SIMPLE_SUSPEND		= (1 << 10),
 };
 
 /*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 23f999f..44893f3 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2675,7 +2675,8 @@
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct nvme_dev *ndev = pci_get_drvdata(pdev);
 
-	return pm_resume_via_firmware() || !ndev->ctrl.npss ?
+	return pm_resume_via_firmware() || !ndev->ctrl.npss ||
+	       (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND) ?
 		nvme_simple_resume(dev) : nvme_make_operational(ndev);
 }
 
@@ -2698,7 +2699,8 @@
 	 * use host managed nvme power settings for lowest idle power. This
 	 * should have quicker resume latency than a full device shutdown.
 	 */
-	return pm_suspend_via_firmware() || !ndev->ctrl.npss ?
+	return pm_suspend_via_firmware() || !ndev->ctrl.npss ||
+	       (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND) ?
 		nvme_simple_suspend(dev) : nvme_deep_state(ndev);
 }