Skip to content

Commit e17fda0

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
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 63f2900 commit e17fda0

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
@@ -1519,8 +1519,7 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock)
15191519
if (host->debug)
15201520
pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock);
15211521

1522-
if ((host->overclock_50 > 50) &&
1523-
(clock == 50*MHZ))
1522+
if (host->overclock_50 && (clock == 50*MHZ))
15241523
clock = host->overclock_50 * MHZ + (MHZ - 1);
15251524

15261525
/* The SDCDIV register has 11 bits, and holds (div - 2).
@@ -1894,7 +1893,8 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host)
18941893

18951894
mmc = host->mmc;
18961895

1897-
mmc->f_max = host->max_clk;
1896+
if (!mmc->f_max || mmc->f_max > host->max_clk)
1897+
mmc->f_max = host->max_clk;
18981898
mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;
18991899

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

0 commit comments

Comments
 (0)