From 57a79ed56ae70ecbec766f911d6da79169954c0c Mon Sep 17 00:00:00 2001 From: Rahul Bansal Date: Tue, 30 Nov 2010 20:39:08 +0530 Subject: sdhci-tegra: Optimizing sdio suspend handler Bug: 730157 Change-Id: I8741f2be5c3c8933edf0dcc3b9d00006eeb86117 Reviewed-on: http://git-master/r/11682 Reviewed-by: Rahul Bansal Tested-by: Rahul Bansal Reviewed-by: Rakesh Kumar Reviewed-by: Bharat Nihalani Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- drivers/mmc/host/sdhci-tegra.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 18a8eff70579..4cba6d5807a2 100755 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -32,7 +32,7 @@ #include #include #include - +#include #include #include #include @@ -465,7 +465,7 @@ static int tegra_sdhci_suspend(struct device *dev) int ret = 0; if (host->card_always_on && is_card_sdio(sdhost->mmc->card)) { - int div; + int div = 0; u16 clk; unsigned int clock = 100000; @@ -476,11 +476,11 @@ static int tegra_sdhci_suspend(struct device *dev) tegra_sdhci_set_clock(sdhost, clock); sdhci_writew(sdhost, 0, SDHCI_CLOCK_CONTROL); - for (div = 1;div < 256;div *= 2) { - if ((sdhost->max_clk / div) <= clock) - break; + if (sdhost->max_clk > clock) { + div = 1 << (fls(sdhost->max_clk / clock) - 2); + if (div > 128) + div = 128; } - div >>= 1; clk = div << SDHCI_DIVIDER_SHIFT; clk |= SDHCI_CLOCK_INT_EN | SDHCI_CLOCK_CARD_EN; -- cgit v1.2.3