Skip to contentSkip to conversation

mmc: sdhci: programmable clock calculation needs multiplier +1

PATCH In review [email protected] 3 participants 3 messages Apr 12, 2024 – Apr 15, 2024 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci: programmable clock calculation needs multiplier +1

From: cmachida <[email protected]>

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

---

 drivers/mmc/sdhci.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/sdhci.c +9 -0
index 0178ed8a11..a8476ec4e9 100644
@@ -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) {
Signature · 1 line
2.43.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Saturday, April 13, 2024 4:27 AM
To: [email protected]; Peng Fan <[email protected]>; Jaehoon Chung <[email protected]>
Cc: cmachida <[email protected]>; Jonas Karlman <[email protected]>; Kever Yang <kever.yang@rock- chips.com>; Peter Geis <[email protected]>; Sean Anderson <[email protected]>; Simon Glass <[email protected]>; Tom Rini <[email protected]>
Subject: [PATCH] mmc: sdhci: programmable clock calculation needs multiplier +1

Quoted 8 lines

From: cmachida <[email protected]>

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

Best Regards,
Jaehoon Chung

Quoted 27 lines

---

 drivers/mmc/sdhci.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/sdhci.c +9 -1
index 0178ed8a11..a8476ec4e9 100644
@@ -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 on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 36 lines · On 4/12/24 15:26, [email protected] wrote:

[You don't often get email from [email protected]. Learn why this is important at https://cas5-0-urlprotect.trendmicro.com:443/wis/clicktime/v1/query?url=https%3a%2f%2faka.ms%2fLearnAboutSenderIdentification&umid=4f25273f-b33b-4eb3-8643-c1f6eff8842b&auth=d807158c60b7d2502abde8a2fc01f40662980862-c95c2e418b830130ad99c91e42b2732e3f7e44ee ]

From: cmachida <[email protected]>

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

---

 drivers/mmc/sdhci.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/sdhci.c +9 -1
index 0178ed8a11..a8476ec4e9 100644
@@ -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) {
--
Quoted 2 lines

2.43.2