summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Elwell <phil@raspberrypi.org>2015-05-18 11:57:29 +0100
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:13:27 +0100
commit39488597472ffbf54670a6e54e2dbd9084282378 (patch)
tree227c8425a2fb39fbff8c84c544a25a3da93e230a
parent14661407a323f137909284a8721f7b88525fc9a1 (diff)
downloadlinux-39488597472ffbf54670a6e54e2dbd9084282378.tar.gz
bcm2835-sdhost: Round up the overclock, so 62 works for 62.5Mhz
Also only warn once for each overclock setting.
-rw-r--r--drivers/mmc/host/bcm2835-sdhost.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c
index 2a9eb9f7f87d..eef8a24f3438 100644
--- a/drivers/mmc/host/bcm2835-sdhost.c
+++ b/drivers/mmc/host/bcm2835-sdhost.c
@@ -185,6 +185,7 @@ struct bcm2835_host {
struct timeval stop_time; /* when the last stop was issued */
u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */
u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */
+ u32 max_overclock; /* Highest reported */
};
@@ -1227,7 +1228,7 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock)
unsigned int input_clock = clock;
if (host->overclock_50 && (clock == 50000000))
- clock = host->overclock_50 * 1000000;
+ clock = host->overclock_50 * 1000000 + 999999;
/* The SDCDIV register has 11 bits, and holds (div - 2).
But in data mode the max is 50MHz wihout a minimum, and only the
@@ -1274,9 +1275,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock)
clock = host->max_clk / (div + 2);
host->mmc->actual_clock = clock;
- if (clock > input_clock)
+ if ((clock > input_clock) && (clock > host->max_overclock)) {
pr_warn("%s: Overclocking to %dHz\n",
mmc_hostname(host->mmc), clock);
+ host->max_overclock = clock;
+ }
host->cdiv = div;
bcm2835_sdhost_write(host, host->cdiv, SDCDIV);