[PATCH] mmc: sdhci: programmable clock calculation needs multiplier +1

From: cmachida curtis.machida@intel.com
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 ---
drivers/mmc/sdhci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 0178ed8a11..a8476ec4e9 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -929,6 +929,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) {

-----Original Message----- From: curtis.machida@intel.com curtis.machida@intel.com Sent: Saturday, April 13, 2024 4:27 AM To: u-boot@lists.denx.de; Peng Fan peng.fan@nxp.com; Jaehoon Chung jh80.chung@samsung.com Cc: cmachida curtis.machida@intel.com; Jonas Karlman jonas@kwiboo.se; Kever Yang <kever.yang@rock- chips.com>; Peter Geis pgwipeout@gmail.com; Sean Anderson sean.anderson@seco.com; Simon Glass sjg@chromium.org; Tom Rini trini@konsulko.com Subject: [PATCH] mmc: sdhci: programmable clock calculation needs multiplier +1
From: cmachida curtis.machida@intel.com
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
Best Regards, Jaehoon Chung
drivers/mmc/sdhci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 0178ed8a11..a8476ec4e9 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -929,6 +929,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) {
-- 2.43.2

On 4/12/24 15:26, curtis.machida@intel.com wrote:
[You don't often get email from curtis.machida@intel.com. Learn why this is important at https://cas5-0-urlprotect.trendmicro.com:443/wis/clicktime/v1/query?url=http... ]
From: cmachida curtis.machida@intel.com
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
drivers/mmc/sdhci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 0178ed8a11..a8476ec4e9 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -929,6 +929,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) {
-- 2.43.2
Reviewed-by: Sean Anderson sean.anderson@seco.com
participants (3)
-
curtis.machidaļ¼ intel.com
-
Jaehoon Chung
-
Sean Anderson