You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/target/linux/brcm2708/patches-4.14/950-0166-mmc-bcm2835-sdhost...

44 lines
1.5 KiB
Diff

From c03a6b0585e7c469c199d349405b3967bcf18672 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Mon, 22 Jan 2018 12:17:27 +0000
Subject: [PATCH 166/454] 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: https://github.com/raspberrypi/linux/issues/2350
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/mmc/host/bcm2835-sdhost.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/drivers/mmc/host/bcm2835-sdhost.c
+++ b/drivers/mmc/host/bcm2835-sdhost.c
@@ -1519,8 +1519,7 @@ void bcm2835_sdhost_set_clock(struct bcm
if (host->debug)
pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock);
- if ((host->overclock_50 > 50) &&
- (clock == 50*MHZ))
+ if (host->overclock_50 && (clock == 50*MHZ))
clock = host->overclock_50 * MHZ + (MHZ - 1);
/* The SDCDIV register has 11 bits, and holds (div - 2).
@@ -1894,7 +1893,8 @@ int bcm2835_sdhost_add_host(struct bcm28
mmc = host->mmc;
- 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 = (~(unsigned int)0)/(mmc->f_max/1000);