Skip to content

Commit 1d0ccb2

Browse files
claudiubezneaehristev
authored andcommitted
mmc: sdhci-of-at91: disable selectively clocks on pm runtime
SAMA7G5's SDMMC run-time clock disabling is not supported. Add support to avoid this scenario for SAMA7G5. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 415476d commit 1d0ccb2

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/mmc/host/sdhci-of-at91.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct sdhci_at91_soc_data {
4848
unsigned int divider_for_baseclk;
4949
unsigned int max_sdr104_clk;
5050
bool hs200_broken;
51+
bool pm_runtime_disable_clks;
5152
};
5253

5354
struct sdhci_at91_priv {
@@ -216,12 +217,14 @@ static const struct sdhci_at91_soc_data soc_data_sama5d2 = {
216217
.baseclk_is_generated_internally = false,
217218
.max_sdr104_clk = 120000000,
218219
.hs200_broken = true,
220+
.pm_runtime_disable_clks = true,
219221
};
220222

221223
static const struct sdhci_at91_soc_data soc_data_sam9x60 = {
222224
.pdata = &sdhci_sama5d2_pdata,
223225
.baseclk_is_generated_internally = true,
224226
.divider_for_baseclk = 2,
227+
.pm_runtime_disable_clks = true,
225228
};
226229

227230
static const struct sdhci_at91_soc_data soc_data_sama7g5 = {
@@ -336,9 +339,11 @@ static int sdhci_at91_runtime_suspend(struct device *dev)
336339
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
337340
mmc_retune_needed(host->mmc);
338341

339-
clk_disable_unprepare(priv->gck);
340-
clk_disable_unprepare(priv->hclock);
341-
clk_disable_unprepare(priv->mainck);
342+
if (priv->soc_data->pm_runtime_disable_clks) {
343+
clk_disable_unprepare(priv->gck);
344+
clk_disable_unprepare(priv->hclock);
345+
clk_disable_unprepare(priv->mainck);
346+
}
342347

343348
return ret;
344349
}
@@ -359,6 +364,9 @@ static int sdhci_at91_runtime_resume(struct device *dev)
359364
goto out;
360365
}
361366

367+
if (!priv->soc_data->pm_runtime_disable_clks)
368+
goto out;
369+
362370
ret = clk_prepare_enable(priv->mainck);
363371
if (ret) {
364372
dev_err(dev, "can't enable mainck\n");

0 commit comments

Comments
 (0)