Skip to content

Commit 0d3e335

Browse files
ahunter6cjb
authored andcommitted
mmc: core: fix performance regression initializing MMC host controllers
Commit fa55018 introduced a performance regression by adding mmc_power_up() to mmc_start_host(). mmc_power_up() is not necessary to host controller initialization, it is part of card initialization and is performed anyway asynchronously. This patch allows a driver to leave the power up in asynchronous code (as it was before). On my current target platform this reduces driver initialization from: [ 1.313220] initcall sdhci_acpi_driver_init+0x0/0x12 returned 0 after 102008 usecs to this: [ 1.217209] initcall sdhci_acpi_driver_init+0x0/0x12 returned 0 after 8331 usecs Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent f9a94e0 commit 0d3e335

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/mmc/core/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2416,7 +2416,8 @@ void mmc_start_host(struct mmc_host *host)
24162416
{
24172417
host->f_init = max(freqs[0], host->f_min);
24182418
host->rescan_disable = 0;
2419-
mmc_power_up(host);
2419+
if (!(host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP))
2420+
mmc_power_up(host);
24202421
mmc_detect_change(host, 0);
24212422
}
24222423

drivers/mmc/host/sdhci-acpi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
195195
host->mmc->pm_caps |= c->slot->pm_caps;
196196
}
197197

198+
host->mmc->caps2 |= MMC_CAP2_NO_PRESCAN_POWERUP;
199+
198200
err = sdhci_add_host(host);
199201
if (err)
200202
goto err_free;

include/linux/mmc/host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ struct mmc_host {
280280
#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
281281
#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282282
MMC_CAP2_PACKED_WR)
283+
#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283284

284285
mmc_pm_flag_t pm_caps; /* supported pm features */
285286

0 commit comments

Comments
 (0)