All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK
@ 2025-12-10 15:54 Loic Poulain
  2025-12-10 15:54 ` [PATCH 2/3] clk/qcom: qcm2290: Add SDCC1 apps clock frequency table Loic Poulain
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Loic Poulain @ 2025-12-10 15:54 UTC (permalink / raw)
  To: lukma, casey.connolly, neil.armstrong
  Cc: sumit.garg, trini, peng.fan, jh80.chung, u-boot-qcom, u-boot,
	Loic Poulain

When 'max-clk' is not specified, the SDHCI core retrieves the base clock
from the SDHCI_CAPABILITIES register (bits [15:8]). However, this field
is unreliable on MSM SDHCI controllers, as noted by the Linux driver
using the SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN flag. In addition, the field
is only 8 bits wide and cannot represent base clocks above 255 MHz.

On platforms like Agatti/QCM2290, the firmware sets the SDHCI clock to
384 MHz, but the capabilities register reports 200 MHz. As a result,
the core calculates a divider of 4, producing a 96 MHz SDCLK instead of
the intended ~52 MHz. This overclocking can cause sporadic CRC errors
with certain eMMC.

To fix this, use the actual clock rate reported by the SDHCI core clock
instead of relying on the capabilities register for divider calculation.

Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
---
 drivers/mmc/msm_sdhci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c
index ac77fb06bf7..ec003991928 100644
--- a/drivers/mmc/msm_sdhci.c
+++ b/drivers/mmc/msm_sdhci.c
@@ -114,6 +114,9 @@ static int msm_sdc_clk_init(struct udevice *dev)
 		return -EINVAL;
 	}
 
+	/* This is the base clock sdhci core will use to configure the SDCLK */
+	prv->host.max_clk = clk_rate;
+
 	writel_relaxed(CORE_VENDOR_SPEC_POR_VAL,
 		       prv->host.ioaddr + var_info->core_vendor_spec);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-01-16 18:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 15:54 [PATCH 1/3] mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK Loic Poulain
2025-12-10 15:54 ` [PATCH 2/3] clk/qcom: qcm2290: Add SDCC1 apps clock frequency table Loic Poulain
2025-12-12  1:00   ` Sumit Garg
2025-12-10 15:54 ` [PATCH 3/3] mmc: msm_sdhci: Add DLL control hook to disable DLL below 100 MHz Loic Poulain
2025-12-12  0:59 ` [PATCH 1/3] mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK Sumit Garg
2026-01-16 18:03 ` Casey Connolly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.