aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/sdhci-s3c.c27
-rw-r--r--drivers/mmc/host/sdhci.c3
2 files changed, 28 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index d7058eee95f9..47138afea2b5 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -203,9 +203,36 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock)
203 } 203 }
204} 204}
205 205
206/**
207 * sdhci_s3c_get_min_clock - callback to get minimal supported clock value
208 * @host: The SDHCI host being queried
209 *
210 * To init mmc host properly a minimal clock value is needed. For high system
211 * bus clock's values the standard formula gives values out of allowed range.
212 * The clock still can be set to lower values, if clock source other then
213 * system bus is selected.
214*/
215static unsigned int sdhci_s3c_get_min_clock(struct sdhci_host *host)
216{
217 struct sdhci_s3c *ourhost = to_s3c(host);
218 unsigned int delta, min = UINT_MAX;
219 int src;
220
221 for (src = 0; src < MAX_BUS_CLK; src++) {
222 delta = sdhci_s3c_consider_clock(ourhost, src, 0);
223 if (delta == UINT_MAX)
224 continue;
225 /* delta is a negative value in this case */
226 if (-delta < min)
227 min = -delta;
228 }
229 return min;
230}
231
206static struct sdhci_ops sdhci_s3c_ops = { 232static struct sdhci_ops sdhci_s3c_ops = {
207 .get_max_clock = sdhci_s3c_get_max_clk, 233 .get_max_clock = sdhci_s3c_get_max_clk,
208 .set_clock = sdhci_s3c_set_clock, 234 .set_clock = sdhci_s3c_set_clock,
235 .get_min_clock = sdhci_s3c_get_min_clock,
209}; 236};
210 237
211static int __devinit sdhci_s3c_probe(struct platform_device *pdev) 238static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3896069bd984..70001ecb6ebe 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1791,8 +1791,7 @@ int sdhci_add_host(struct sdhci_host *host)
1791 * Set host parameters. 1791 * Set host parameters.
1792 */ 1792 */
1793 mmc->ops = &sdhci_ops; 1793 mmc->ops = &sdhci_ops;
1794 if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK && 1794 if (host->ops->get_min_clock)
1795 host->ops->get_min_clock)
1796 mmc->f_min = host->ops->get_min_clock(host); 1795 mmc->f_min = host->ops->get_min_clock(host);
1797 else 1796 else
1798 mmc->f_min = host->max_clk / 256; 1797 mmc->f_min = host->max_clk / 256;