summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul Bansal <rbansal@nvidia.com>2010-11-30 20:39:08 +0530
committerVarun Colbert <vcolbert@nvidia.com>2010-12-01 15:20:37 -0800
commit57a79ed56ae70ecbec766f911d6da79169954c0c (patch)
tree426de2bb5e1981074019c6e54c8baaa6d1268e09
parentcd25a25d7a70ec8d45f24f4183e8b3f35a1b5411 (diff)
sdhci-tegra: Optimizing sdio suspend handlertegra-10.9.7
Bug: 730157 Change-Id: I8741f2be5c3c8933edf0dcc3b9d00006eeb86117 Reviewed-on: http://git-master/r/11682 Reviewed-by: Rahul Bansal <rbansal@nvidia.com> Tested-by: Rahul Bansal <rbansal@nvidia.com> Reviewed-by: Rakesh Kumar <krakesh@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rwxr-xr-xdrivers/mmc/host/sdhci-tegra.c12
1 files 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 <linux/clk.h>
#include <linux/gpio.h>
#include <linux/delay.h>
-
+#include <linux/bitops.h>
#include <mach/sdhci.h>
#include <mach/pinmux.h>
#include <nvodm_sdio.h>
@@ -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;