mmc: sdhci: introduce sdhci_update_clock helper to re-enable clock
There are three places where same piece of code is used. Let's split it to a separate function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
committed by
Chris Ball
parent
9ddc4f27cf
commit
22c07f3626
@@ -1189,6 +1189,15 @@ out:
|
|||||||
host->clock = clock;
|
host->clock = clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void sdhci_update_clock(struct sdhci_host *host)
|
||||||
|
{
|
||||||
|
unsigned int clock;
|
||||||
|
|
||||||
|
clock = host->clock;
|
||||||
|
host->clock = 0;
|
||||||
|
sdhci_set_clock(host, clock);
|
||||||
|
}
|
||||||
|
|
||||||
static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
|
static int sdhci_set_power(struct sdhci_host *host, unsigned short power)
|
||||||
{
|
{
|
||||||
u8 pwr = 0;
|
u8 pwr = 0;
|
||||||
@@ -1418,7 +1427,6 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
|
|||||||
|
|
||||||
if (host->version >= SDHCI_SPEC_300) {
|
if (host->version >= SDHCI_SPEC_300) {
|
||||||
u16 clk, ctrl_2;
|
u16 clk, ctrl_2;
|
||||||
unsigned int clock;
|
|
||||||
|
|
||||||
/* In case of UHS-I modes, set High Speed Enable */
|
/* In case of UHS-I modes, set High Speed Enable */
|
||||||
if ((ios->timing == MMC_TIMING_MMC_HS200) ||
|
if ((ios->timing == MMC_TIMING_MMC_HS200) ||
|
||||||
@@ -1458,9 +1466,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
|
|||||||
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
||||||
|
|
||||||
/* Re-enable SD Clock */
|
/* Re-enable SD Clock */
|
||||||
clock = host->clock;
|
sdhci_update_clock(host);
|
||||||
host->clock = 0;
|
|
||||||
sdhci_set_clock(host, clock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1491,9 +1497,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Re-enable SD Clock */
|
/* Re-enable SD Clock */
|
||||||
clock = host->clock;
|
sdhci_update_clock(host);
|
||||||
host->clock = 0;
|
|
||||||
sdhci_set_clock(host, clock);
|
|
||||||
} else
|
} else
|
||||||
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
||||||
|
|
||||||
@@ -2083,14 +2087,9 @@ static void sdhci_tasklet_finish(unsigned long param)
|
|||||||
(host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) {
|
(host->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST))) {
|
||||||
|
|
||||||
/* Some controllers need this kick or reset won't work here */
|
/* Some controllers need this kick or reset won't work here */
|
||||||
if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) {
|
if (host->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET)
|
||||||
unsigned int clock;
|
|
||||||
|
|
||||||
/* This is to force an update */
|
/* This is to force an update */
|
||||||
clock = host->clock;
|
sdhci_update_clock(host);
|
||||||
host->clock = 0;
|
|
||||||
sdhci_set_clock(host, clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Spec says we should do both at the same time, but Ricoh
|
/* Spec says we should do both at the same time, but Ricoh
|
||||||
controllers do not like that. */
|
controllers do not like that. */
|
||||||
|
Reference in New Issue
Block a user