]> git.ipfire.org Git - thirdparty/u-boot.git/commit
mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK
authorLoic Poulain <loic.poulain@oss.qualcomm.com>
Wed, 10 Dec 2025 15:54:52 +0000 (16:54 +0100)
committerCasey Connolly <casey.connolly@linaro.org>
Wed, 14 Jan 2026 15:25:09 +0000 (16:25 +0100)
commitedd1fb0c3695d64b8b0b49471595ac0211148409
tree0507a55152871799fa39af39d1101a14118424b5
parent4ad3992cc357b24a0fbf6bccf5409fa353e20343
mmc: msm_sdhci: Fix incorrect divider calculation for SDCLK

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>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Link: https://patch.msgid.link/20251210155454.1561611-1-loic.poulain@oss.qualcomm.com
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
drivers/mmc/msm_sdhci.c