From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: pcm720 Date: Mon, 20 Jul 2020 20:33:26 +0300 Subject: 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 1d56517e99..5f90d9d608 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -35,6 +35,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) { -- Armbian