summaryrefslogtreecommitdiff
path: root/drivers/mmc/core/sdio.c
diff options
context:
space:
mode:
authorharish_kandiga@mentor.com <harish_kandiga@mentor.com>2018-04-10 10:00:31 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2018-05-02 16:08:39 +0300
commitebc5a1bf4f2afc2f2b348320dcfb45a8c0ac3de5 (patch)
treea3444f451f815f7e4d05b31c67c5b00e996c85ec /drivers/mmc/core/sdio.c
parentd39b1b2abf9fcae3001b868186faa1ae889aecf5 (diff)
downloadlinux-ebc5a1bf4f2afc2f2b348320dcfb45a8c0ac3de5.tar.xz
mmc: core: Add a new quirk for limiting clock rate
This patch adds a quirk to limit clock rate which can be used to reduce the SDIO clock rate for some chips with broken UHS. Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/sdio.c')
-rw-r--r--drivers/mmc/core/sdio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index c599a628a387..24b510b743da 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -444,6 +444,7 @@ static int sdio_set_bus_speed_mode(struct mmc_card *card)
unsigned int bus_speed, timing;
int err;
unsigned char speed;
+ unsigned int max_rate;
/*
* If the host doesn't support any of the UHS-I modes, fallback on
@@ -500,9 +501,12 @@ static int sdio_set_bus_speed_mode(struct mmc_card *card)
if (err)
return err;
+ max_rate = min_not_zero(card->quirk_max_rate,
+ card->sw_caps.uhs_max_dtr);
+
if (bus_speed) {
mmc_set_timing(card->host, timing);
- mmc_set_clock(card->host, card->sw_caps.uhs_max_dtr);
+ mmc_set_clock(card->host, max_rate);
}
return 0;