Skip to content

Commit

Permalink
ARM: 6981/2: mmci: adjust calculation of f_min
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Walleij authored and Russell King committed Jul 19, 2011
1 parent eb96c92 commit 7f294e4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/mmc/host/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,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
Expand Down

0 comments on commit 7f294e4

Please sign in to comment.