mmc: bcm2835: Don't overwrite max frequency unconditionally

"Linux Kernel Mailing List" <[email protected]> Sat, 17 Feb 2018 18:20:25 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/118032be389009b07ecb5a03ffe219a89d421def
Commit:     118032be389009b07ecb5a03ffe219a89d421def
Parent:     fe0e58048f005fdce315eb4d185e5c160be4ac01
Refname:    refs/heads/master
Author:     Phil Elwell <[email protected]>
AuthorDate: Mon Feb 12 21:13:44 2018 +0100
Committer:  Ulf Hansson <[email protected]>
CommitDate: Wed Feb 14 11:30:10 2018 +0100

    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 <[email protected]>
    Signed-off-by: Stefan Wahren <[email protected]>
    Cc: <[email protected]> # 4.12+
    Signed-off-by: Ulf Hansson <[email protected]>
---
 drivers/mmc/host/bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html