summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/mmci.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-07-08 09:57:15 +0100
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 16:07:29 +0200
commitab671bcf8d48821530e63cc5a691558dc9bd77d4 (patch)
tree12afe8e1dc40bbf060920bb9f475ec486bcce87a /drivers/mmc/host/mmci.c
parentd178d6b7df78e102da3168dcde3baae5530eb3e6 (diff)
ARM: 6981/2: mmci: adjust calculation of f_min
The ARM version maximum clock divider is 512 whereas for the ST variants it's 257. Let's use DIV_ROUND_UP() for both cases so we can see clearly what's going on here. [Use DIV_ROUND_UP to clarify elder code] Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Change-Id: I45a5b4d4374df5656e4cd640f8544f7b36c592b0 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30591 Reviewed-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com>
Diffstat (limited to 'drivers/mmc/host/mmci.c')
-rw-r--r--drivers/mmc/host/mmci.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index fe140724a02..50f4f77ed20 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -1063,7 +1063,15 @@ static int __devinit mmci_probe(struct amba_device *dev,
}
mmc->ops = &mmci_ops;
- mmc->f_min = (host->mclk + 511) / 512;
+ /*
+ * The ARM and ST versions of the block have slightly different
+ * clock divider equations which means that the minimum divider
+ * differs too.
+ */
+ if (variant->st_clkdiv)
+ mmc->f_min = DIV_ROUND_UP(host->mclk, 257);
+ else
+ mmc->f_min = DIV_ROUND_UP(host->mclk, 512);
/*
* If the platform data supplies a maximum operating
* frequency, this takes precedence. Else, we fall back