diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/dw_mmc.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index b070ee542c8e..1ca5e72ceb65 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -617,14 +617,15 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot) | |||
617 | u32 div; | 617 | u32 div; |
618 | 618 | ||
619 | if (slot->clock != host->current_speed) { | 619 | if (slot->clock != host->current_speed) { |
620 | if (host->bus_hz % slot->clock) | 620 | div = host->bus_hz / slot->clock; |
621 | if (host->bus_hz % slot->clock && host->bus_hz > slot->clock) | ||
621 | /* | 622 | /* |
622 | * move the + 1 after the divide to prevent | 623 | * move the + 1 after the divide to prevent |
623 | * over-clocking the card. | 624 | * over-clocking the card. |
624 | */ | 625 | */ |
625 | div = ((host->bus_hz / slot->clock) >> 1) + 1; | 626 | div += 1; |
626 | else | 627 | |
627 | div = (host->bus_hz / slot->clock) >> 1; | 628 | div = (host->bus_hz != slot->clock) ? DIV_ROUND_UP(div, 2) : 0; |
628 | 629 | ||
629 | dev_info(&slot->mmc->class_dev, | 630 | dev_info(&slot->mmc->class_dev, |
630 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" | 631 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" |