Commit 5e6b6651 authored by Jorge Ramirez-Ortiz's avatar Jorge Ramirez-Ortiz Committed by Ulf Hansson

mmc: sdhci-msm: fix mutex while in spinlock

mutexes can sleep and therefore should not be taken while holding a
spinlock. move clk_get_rate (can sleep) outside the spinlock protected
region.

Fixes: 83736352 ("mmc: sdhci-msm: Update DLL reset sequence")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarVinod Koul <vkoul@kernel.org>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 8751c8bd
...@@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_host *host) ...@@ -575,11 +575,14 @@ static int msm_init_cm_dll(struct sdhci_host *host)
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
int wait_cnt = 50; int wait_cnt = 50;
unsigned long flags; unsigned long flags, xo_clk = 0;
u32 config; u32 config;
const struct sdhci_msm_offset *msm_offset = const struct sdhci_msm_offset *msm_offset =
msm_host->offset; msm_host->offset;
if (msm_host->use_14lpp_dll_reset && !IS_ERR_OR_NULL(msm_host->xo_clk))
xo_clk = clk_get_rate(msm_host->xo_clk);
spin_lock_irqsave(&host->lock, flags); spin_lock_irqsave(&host->lock, flags);
/* /*
...@@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_host *host) ...@@ -627,10 +630,10 @@ static int msm_init_cm_dll(struct sdhci_host *host)
config &= CORE_FLL_CYCLE_CNT; config &= CORE_FLL_CYCLE_CNT;
if (config) if (config)
mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 8), mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 8),
clk_get_rate(msm_host->xo_clk)); xo_clk);
else else
mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 4), mclk_freq = DIV_ROUND_CLOSEST_ULL((host->clock * 4),
clk_get_rate(msm_host->xo_clk)); xo_clk);
config = readl_relaxed(host->ioaddr + config = readl_relaxed(host->ioaddr +
msm_offset->core_dll_config_2); msm_offset->core_dll_config_2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment