Skip to content

Commit 886201c

Browse files
KamalDasustorulf
authored andcommitted
mmc: sdhci-brcmstb: use clk_get_rate(base_clk) in PM resume
Use clk_get_rate for base_clk on resume before setting new rate. This change ensures that the clock api returns current rate and sets the clock to the desired rate and honors CLK_GET_NO_CACHE attribute used by clock api. Fixes: 97904a5 (mmc: sdhci-brcmstb: Add ability to increase max clock rate for 72116b0) Signed-off-by: Kamal Dasu <[email protected]> Acked-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 99ce0f7 commit 886201c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/mmc/host/sdhci-brcmstb.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,14 @@ static int sdhci_brcmstb_resume(struct device *dev)
406406
ret = sdhci_pltfm_resume(dev);
407407
if (!ret && priv->base_freq_hz) {
408408
ret = clk_prepare_enable(priv->base_clk);
409-
if (!ret)
409+
/*
410+
* Note: using clk_get_rate() below as clk_get_rate()
411+
* honors CLK_GET_RATE_NOCACHE attribute, but clk_set_rate()
412+
* may do implicit get_rate() calls that do not honor
413+
* CLK_GET_RATE_NOCACHE.
414+
*/
415+
if (!ret &&
416+
(clk_get_rate(priv->base_clk) != priv->base_freq_hz))
410417
ret = clk_set_rate(priv->base_clk, priv->base_freq_hz);
411418
}
412419

0 commit comments

Comments
 (0)