summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Elwell <phil@raspberrypi.org>2015-05-18 12:29:42 +0100
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:13:28 +0100
commitaa3396801dcec10f22192cdc44d230469633d8f1 (patch)
tree8edb8c2c0df15ce43921efb3fe2d81941c827eab
parent39488597472ffbf54670a6e54e2dbd9084282378 (diff)
downloadlinux-aa3396801dcec10f22192cdc44d230469633d8f1.tar.gz
bcm2835-mmc: 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-mmc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c
index c7c2ca1b0271..b7c48837ae8b 100644
--- a/drivers/mmc/host/bcm2835-mmc.c
+++ b/drivers/mmc/host/bcm2835-mmc.c
@@ -133,6 +133,7 @@ struct bcm2835_host {
#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */
+ u32 max_overclock; /* Highest reported */
};
@@ -1091,7 +1092,7 @@ void bcm2835_mmc_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;
host->mmc->actual_clock = 0;
@@ -1118,9 +1119,11 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock)
clock = (host->max_clk * clk_mul) / real_div;
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;
+ }
clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)