[RFC PATCH v2 2/4] mmc: sdhci: get the timeout_clk from callback in Hz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We expect all the variant host drivers to return the timeout
clk rate in Hz unit so that it's more easy for us to work through
all cases in one place.

Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
---

Changes in v2: None

 drivers/mmc/host/sdhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6fdd7a7..9707f11 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3101,6 +3101,7 @@ int sdhci_setup_host(struct sdhci_host *host)
 	unsigned int override_timeout_clk;
 	u32 max_clk;
 	int ret;
+	bool skip_div;
 
 	WARN_ON(host == NULL);
 	if (host == NULL)
@@ -3292,7 +3293,9 @@ int sdhci_setup_host(struct sdhci_host *host)
 		if (host->timeout_clk == 0) {
 			if (host->ops->get_timeout_clock) {
 				host->timeout_clk =
-					host->ops->get_timeout_clock(host);
+					DIV_ROUND_UP(host->ops->get_timeout_clock(host), 1000);
+				if (host->caps & SDHCI_TIMEOUT_CLK_UNIT)
+					skip_div = true;
 			} else {
 				pr_err("%s: Hardware doesn't specify timeout clock frequency.\n",
 					mmc_hostname(mmc));
@@ -3301,7 +3304,7 @@ int sdhci_setup_host(struct sdhci_host *host)
 			}
 		}
 
-		if (host->caps & SDHCI_TIMEOUT_CLK_UNIT)
+		if (host->caps & SDHCI_TIMEOUT_CLK_UNIT && !skip_div)
 			host->timeout_clk *= 1000;
 
 		if (override_timeout_clk)
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux