summaryrefslogtreecommitdiff
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorPhil Elwell <phil@raspberrypi.org>2018-02-12 23:13:44 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2018-02-14 13:30:10 +0300
commit118032be389009b07ecb5a03ffe219a89d421def (patch)
tree06be4c283829cb1fdbca85e2a548debeb8b38c08 /drivers/mmc/host
parentfe0e58048f005fdce315eb4d185e5c160be4ac01 (diff)
downloadlinux-118032be389009b07ecb5a03ffe219a89d421def.tar.xz
mmc: bcm2835: Don't overwrite max frequency unconditionally
The optional DT parameter max-frequency could init the max bus frequency. So take care of this, before setting the max bus frequency. Fixes: 660fc733bd74 ("mmc: bcm2835: Add new driver for the sdhost controller.") Signed-off-by: Phil Elwell <phil@raspberrypi.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Cc: <stable@vger.kernel.org> # 4.12+ Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/bcm2835.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 229dc18f0581..768972af8b85 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -1265,7 +1265,8 @@ static int bcm2835_add_host(struct bcm2835_host *host)
char pio_limit_string[20];
int ret;
- mmc->f_max = host->max_clk;
+ if (!mmc->f_max || mmc->f_max > host->max_clk)
+ mmc->f_max = host->max_clk;
mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
mmc->max_busy_timeout = ~0 / (mmc->f_max / 1000);