lkml.org 
[lkml]   [2021]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mmc: dw_mmc: avoid long timeout if register invalid
Date

Set the limit to 1s if the register is at reset value.

Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
drivers/mmc/host/dw_mmc.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 6578cc64ae9e..cd9a6e0a7449 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1983,6 +1983,14 @@ static void dw_mci_set_drto(struct dw_mci *host)
/* add a bit spare time */
drto_ms += 10;

+ /*
+ * If TMOUT register still holds the reset value the above calculation
+ * would yield a timeout of over 167 seconds, limit it to 1000ms.
+ * Normal reads/writes should not take anywhere close to 120s.
+ */
+ if (drto_ms > 120000)
+ drto_ms = 1000;
+
spin_lock_irqsave(&host->irq_lock, irqflags);
if (!test_bit(EVENT_DATA_COMPLETE, &host->pending_events))
mod_timer(&host->dto_timer,
--
2.32.0
Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz
Managing Directors: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782
\
 
 \ /
  Last update: 2021-09-17 09:51    [W:0.105 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site