diff options
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r-- | drivers/mmc/host/mmci.c | 14 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.h | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 626ac083f4e0..da5fecad74d9 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -425,7 +425,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
425 | host->cclk = host->mclk; | 425 | host->cclk = host->mclk; |
426 | } else { | 426 | } else { |
427 | clk = host->mclk / (2 * ios->clock) - 1; | 427 | clk = host->mclk / (2 * ios->clock) - 1; |
428 | if (clk > 256) | 428 | if (clk >= 256) |
429 | clk = 255; | 429 | clk = 255; |
430 | host->cclk = host->mclk / (2 * (clk + 1)); | 430 | host->cclk = host->mclk / (2 * (clk + 1)); |
431 | } | 431 | } |
@@ -512,6 +512,18 @@ static int mmci_probe(struct amba_device *dev, void *id) | |||
512 | 512 | ||
513 | host->plat = plat; | 513 | host->plat = plat; |
514 | host->mclk = clk_get_rate(host->clk); | 514 | host->mclk = clk_get_rate(host->clk); |
515 | /* | ||
516 | * According to the spec, mclk is max 100 MHz, | ||
517 | * so we try to adjust the clock down to this, | ||
518 | * (if possible). | ||
519 | */ | ||
520 | if (host->mclk > 100000000) { | ||
521 | ret = clk_set_rate(host->clk, 100000000); | ||
522 | if (ret < 0) | ||
523 | goto clk_disable; | ||
524 | host->mclk = clk_get_rate(host->clk); | ||
525 | DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); | ||
526 | } | ||
515 | host->mmc = mmc; | 527 | host->mmc = mmc; |
516 | host->base = ioremap(dev->res.start, SZ_4K); | 528 | host->base = ioremap(dev->res.start, SZ_4K); |
517 | if (!host->base) { | 529 | if (!host->base) { |
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 7fb02e177a3d..299118de8933 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -187,7 +187,7 @@ struct sdhci_host { | |||
187 | struct mmc_request *mrq; /* Current request */ | 187 | struct mmc_request *mrq; /* Current request */ |
188 | struct mmc_command *cmd; /* Current command */ | 188 | struct mmc_command *cmd; /* Current command */ |
189 | struct mmc_data *data; /* Current data request */ | 189 | struct mmc_data *data; /* Current data request */ |
190 | int data_early:1; /* Data finished before cmd */ | 190 | unsigned int data_early:1; /* Data finished before cmd */ |
191 | 191 | ||
192 | struct scatterlist *cur_sg; /* We're working on this */ | 192 | struct scatterlist *cur_sg; /* We're working on this */ |
193 | int num_sg; /* Entries left */ | 193 | int num_sg; /* Entries left */ |