diff options
| author | Jan Engelmohr <jan.engelmohr@mailbox.tu-dresden.de> | 2016-08-01 13:36:04 +0200 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-08-26 16:16:45 +0200 |
| commit | 83da961803a184316d128189acee4764b3739b7b (patch) | |
| tree | 976a842581ad26036a38badedcad59a6ff442581 /drivers/mmc | |
| parent | 6117aabd7c9a3441063503fe2603d0fced723e27 (diff) | |
3.10.79 -> 3.10.80
Diffstat (limited to 'drivers/mmc')
| -rw-r--r-- | drivers/mmc/host/atmel-mci.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 84b054b08..e74276167 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -1295,7 +1295,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (ios->clock) { unsigned int clock_min = ~0U; - u32 clkdiv; + int clkdiv; spin_lock_bh(&host->lock); if (!host->mode_reg) { @@ -1320,7 +1320,12 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) /* Calculate clock divider */ if (host->caps.has_odd_clk_div) { clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; - if (clkdiv > 511) { + if (clkdiv < 0) { + dev_warn(&mmc->class_dev, + "clock %u too fast; using %lu\n", + clock_min, host->bus_hz / 2); + clkdiv = 0; + } else if (clkdiv > 511) { dev_warn(&mmc->class_dev, "clock %u too slow; using %lu\n", clock_min, host->bus_hz / (511 + 2)); |
