aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Figa <tomasz.figa@gmail.com>2014-01-11 16:39:06 -0500
committerChris Ball <chris@printf.net>2014-03-03 10:23:39 -0500
commit2200300060ada5e32136d597502e446ac2ef2a27 (patch)
tree31bef47f87192c6a2df62bc4d36ce03771d57687
parent3ac147facfbd234acf3a990968de9746a399f133 (diff)
mmc: sdhci-s3c: Do not allow frequencies higher than requested
This patch modifies sdhci_s3c_consider_clock() to fail if bus clock being considered can not provide frequency lower or equal requested, instead of returning the lowest supported. Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by; Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <chris@printf.net>
-rw-r--r--drivers/mmc/host/sdhci-s3c.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index bad0e00a3e8f..d61eb5a70833 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -126,11 +126,18 @@ static unsigned int sdhci_s3c_consider_clock(struct sdhci_s3c *ourhost,
126 126
127 rate = ourhost->clk_rates[src]; 127 rate = ourhost->clk_rates[src];
128 128
129 for (shift = 0; shift < 8; ++shift) { 129 for (shift = 0; shift <= 8; ++shift) {
130 if ((rate >> shift) <= wanted) 130 if ((rate >> shift) <= wanted)
131 break; 131 break;
132 } 132 }
133 133
134 if (shift > 8) {
135 dev_dbg(&ourhost->pdev->dev,
136 "clk %d: rate %ld, min rate %lu > wanted %u\n",
137 src, rate, rate / 256, wanted);
138 return UINT_MAX;
139 }
140
134 dev_dbg(&ourhost->pdev->dev, "clk %d: rate %ld, want %d, got %ld\n", 141 dev_dbg(&ourhost->pdev->dev, "clk %d: rate %ld, want %d, got %ld\n",
135 src, rate, wanted, rate >> shift); 142 src, rate, wanted, rate >> shift);
136 143