Skip to content

Commit b109be7

Browse files
committed
FROMLIST: mmc: sdhci-msm: Set ICE clk to TURBO at sdhci ICE init
MMC controller lacks a clock scaling mechanism, unlike the UFS controller. By default, the MMC controller is set to TURBO mode during probe, but the ICE clock remains at XO frequency, leading to read/write performance degradation on eMMC. To address this, set the ICE clock to TURBO during sdhci_msm_ice_init to align it with the controller clock. This ensures consistent performance and avoids mismatches between the controller and ICE clock frequencies. For platforms where ICE is represented as a separate device, use the OPP framework to vote for TURBO mode, maintaining proper voltage and power domain constraints. Link: https://lore.kernel.org/all/20260409-enable-ice-clock-scaling-v8-3-ca1129798606@oss.qualcomm.com/ Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Abhinaba Rakshit <abhinaba.rakshit@oss.qualcomm.com>
1 parent 31db98d commit b109be7

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

drivers/mmc/host/sdhci-msm.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,8 @@ static void sdhci_msm_set_clock(struct sdhci_host *host, unsigned int clock)
18891889
#ifdef CONFIG_MMC_CRYPTO
18901890

18911891
static const struct blk_crypto_ll_ops sdhci_msm_crypto_ops; /* forward decl */
1892+
static int sdhci_msm_ice_scale_clk(struct sdhci_msm_host *msm_host, unsigned long target_freq,
1893+
bool round_ceil); /* forward decl */
18921894

18931895
static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
18941896
struct cqhci_host *cq_host)
@@ -1948,6 +1950,11 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
19481950

19491951
mmc->caps2 |= MMC_CAP2_CRYPTO;
19501952
mmc->caps2 |= MMC_CAP2_CRYPTO_NO_REPROG;
1953+
1954+
err = sdhci_msm_ice_scale_clk(msm_host, INT_MAX, false);
1955+
if (err && err != -EOPNOTSUPP)
1956+
dev_warn(dev, "Unable to boost ICE clock to TURBO\n");
1957+
19511958
return 0;
19521959
}
19531960

@@ -1973,6 +1980,16 @@ static int sdhci_msm_ice_suspend(struct sdhci_msm_host *msm_host)
19731980
return 0;
19741981
}
19751982

1983+
static int sdhci_msm_ice_scale_clk(struct sdhci_msm_host *msm_host,
1984+
unsigned long target_freq,
1985+
bool round_ceil)
1986+
{
1987+
if (msm_host->mmc->caps2 & MMC_CAP2_CRYPTO)
1988+
return qcom_ice_scale_clk(msm_host->ice, target_freq, round_ceil);
1989+
1990+
return 0;
1991+
}
1992+
19761993
static inline struct sdhci_msm_host *
19771994
sdhci_msm_host_from_crypto_profile(struct blk_crypto_profile *profile)
19781995
{
@@ -2076,6 +2093,13 @@ sdhci_msm_ice_suspend(struct sdhci_msm_host *msm_host)
20762093
{
20772094
return 0;
20782095
}
2096+
2097+
static inline int
2098+
sdhci_msm_ice_scale_clk(struct sdhci_msm_host *msm_host, unsigned long target_freq,
2099+
bool round_ceil)
2100+
{
2101+
return 0;
2102+
}
20792103
#endif /* !CONFIG_MMC_CRYPTO */
20802104

20812105
/*****************************************************************************\

0 commit comments

Comments
 (0)