build/patch/u-boot/u-boot-rockchip64/board-pinebook-pro-0007-increase-nvme-timeout.patch

32 lines
1.1 KiB
Diff

From 656ccd6ac62714b11b163b6eb62370a78c7bc808 Mon Sep 17 00:00:00 2001
From: pcm720 <pcm720@users.noreply.github.com>
Date: Mon, 20 Jul 2020 20:33:26 +0300
Subject: [PATCH] drivers: nvme: address NVMe instability for Pinebook Pro
Apparently, some NVMe SSDs on Pinebook Pro don't become ready before timeout specified in drive's CAP register expires.
The workaround is to increase timeout. Tested and confirmed to work on Intel 660p.
---
drivers/nvme/nvme.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index fc64d93ab8..138b9f8fbb 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -61,6 +61,12 @@ static int nvme_wait_ready(struct nvme_dev *dev, bool enabled)
/* Timeout field in the CAP register is in 500 millisecond units */
timeout = NVME_CAP_TIMEOUT(dev->cap) * 500;
+
+ #ifdef CONFIG_TARGET_PINEBOOK_PRO_RK3399
+ /* Some NVMe SSDs on Pinebook Pro don't become ready before timeout expires.
+ Workaround: increase timeout */
+ timeout *= 2;
+ #endif
start = get_timer(0);
while (get_timer(start) < timeout) {
--
2.27.0