summaryrefslogtreecommitdiff
path: root/drivers/mmc/sdhci.c
diff options
context:
space:
mode:
authorcmachida <curtis.machida@intel.com>2024-04-12 12:26:40 -0700
committerJaehoon Chung <jh80.chung@samsung.com>2024-04-26 15:31:57 +0900
commit9ae1fe1a5848b48c42ef9ebe4d4a6928ee336afd (patch)
treeece0e0d95c9c9789764afdf364eaf4d0f8ef17a5 /drivers/mmc/sdhci.c
parent4d3dc72165486c88214fbcaa9742ce7dee9693b3 (diff)
downloadu-boot-9ae1fe1a5848b48c42ef9ebe4d4a6928ee336afd.tar.gz
u-boot-9ae1fe1a5848b48c42ef9ebe4d4a6928ee336afd.tar.bz2
u-boot-9ae1fe1a5848b48c42ef9ebe4d4a6928ee336afd.zip
mmc: sdhci: programmable clock calculation needs multiplier +1
According to the SD Host Controller Simplified Specification v4.20, the multiplier value M is one more than the Clock Multiplier field. Copied code from Linux project. drivers/mmc/host/sdhci.c line 4405 Signed-off-by: cmachida <curtis.machida@intel.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r--drivers/mmc/sdhci.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index ceeac32882..af654ea8d1 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -930,6 +930,15 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
debug("%s, caps_1: 0x%x\n", __func__, caps_1);
host->clk_mul = (caps_1 & SDHCI_CLOCK_MUL_MASK) >>
SDHCI_CLOCK_MUL_SHIFT;
+
+ /*
+ * In case the value in Clock Multiplier is 0, then programmable
+ * clock mode is not supported, otherwise the actual clock
+ * multiplier is one more than the value of Clock Multiplier
+ * in the Capabilities Register.
+ */
+ if (host->clk_mul)
+ host->clk_mul += 1;
}
if (host->max_clk == 0) {