Skip to content

Commit 4524cb7

Browse files
author
Phil Elwell
committed
mmc: bcm2835-sdhost: Support underclocking
Support underclocking of the SD bus in two ways: 1. using the max-frequency DT property (which currently has no DT parameter), and 2. using the exiting sd_overclock parameter. The two methods differ slightly - in the former the MMC subsystem is aware of the underclocking, while in the latter it isn't - but the end results should be the same. See: #2350 Signed-off-by: Phil Elwell <[email protected]>
1 parent 186afa6 commit 4524cb7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/mmc/host/bcm2835-sdhost.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,8 +1517,7 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock)
15171517
if (host->debug)
15181518
pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock);
15191519

1520-
if ((host->overclock_50 > 50) &&
1521-
(clock == 50*MHZ))
1520+
if (host->overclock_50 && (clock == 50*MHZ))
15221521
clock = host->overclock_50 * MHZ + (MHZ - 1);
15231522

15241523
/* The SDCDIV register has 11 bits, and holds (div - 2).
@@ -1892,7 +1891,8 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
18921891

18931892
mmc = host->mmc;
18941893

1895-
mmc->f_max = host->max_clk;
1894+
if (!mmc->f_max || mmc->f_max > host->max_clk)
1895+
mmc->f_max = host->max_clk;
18961896
mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
18971897

18981898
mmc->max_busy_timeout = (~(unsigned int)0)/(mmc->f_max/1000);

0 commit comments

Comments
 (0)