From: Matthieu CASTET <matthieu.castet@parrot.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Chris Ball <chris@printf.net>,
Matthieu CASTET <matthieu.castet@parrot.com>
Subject: [PATCH 2/2] sdhci : recompute timeout_clk when needed
Date: Thu, 14 Aug 2014 16:03:18 +0200 [thread overview]
Message-ID: <1408024998-4097-2-git-send-email-matthieu.castet@parrot.com> (raw)
In-Reply-To: <1408024998-4097-1-git-send-email-matthieu.castet@parrot.com>
when SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK is set, timeout_clk is sdclk.
We need to update it when we change sdclk in sdhci_set_clock.
This allow to have a more precisse timeout and max_busy_timeout. This
can help for command that need a big busy wait (erase, ...).
Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
---
drivers/mmc/host/sdhci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9df59a4..76b1aab 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1192,8 +1192,13 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
}
clock_set:
- if (real_div)
+ if (real_div) {
host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div;
+ if (host->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) {
+ host->timeout_clk = host->mmc->actual_clock / 1000;
+ host->mmc->max_busy_timeout = (1 << 27) / host->timeout_clk;
+ }
+ }
clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
--
2.1.0.rc1
next prev parent reply other threads:[~2014-08-14 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 14:03 [PATCH 1/2] sdhci : handle busy timeout irq Matthieu CASTET
2014-08-14 14:03 ` Matthieu CASTET [this message]
2014-08-18 11:15 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Ulf Hansson
2014-08-18 11:13 ` [PATCH 1/2] sdhci : handle busy timeout irq Ulf Hansson
-- strict thread matches above, loose matches on Subject: below --
2014-07-09 15:01 Matthieu CASTET
2014-07-09 15:01 ` [PATCH 2/2] sdhci : recompute timeout_clk when needed Matthieu CASTET
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408024998-4097-2-git-send-email-matthieu.castet@parrot.com \
--to=matthieu.castet@parrot.com \
--cc=chris@printf.net \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox