Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500207

[PATCH 6/6] mmc: core: Don't power off the card when starting the host

From Ulf Hansson <ulf.hansson@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 6/6] mmc: core: Don't power off the card when starting the host
Date 2016-10-13 13:50 +0200
Message-ID <srMGm-30B-9@gated-at.bofh.it> (permalink)
References <srMwG-2X1-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The MMC_CAP2_NO_PRESCAN_POWERUP was invented to avoid running the power up
sequence, mmc_power_up(), during ->probe() of the mmc host driver, but
instead defer this to the mmc detect work. This is especially useful for
those hosts that suffers from a long initialization time, as this time
would otherwise add up to the total boot time.

However, due to the introduction of runtime PM of mmc host devices in the
mmc core, this behaviour changed a bit. More precisely, it caused the mmc
core to runtime resume the host device during ->probe() of the host driver.
In cases like the rtsx_usb_sdmmc, runtime resuming the device may be costly
and thus affecting the total boot time.

To improve this behaviour when using MMC_CAP2_NO_PRESCAN_POWERUP, let's
postpone also calling mmc_power_off() when starting the host. This change
allows the mmc core to avoid runtime resuming the device, as it don't need
to claim the host for that execution path.

Cc: Ritesh Raj Sarraf <rrs@researchut.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 2553d90..2ad7291 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2824,12 +2824,11 @@ void mmc_start_host(struct mmc_host *host)
 	host->rescan_disable = 0;
 	host->ios.power_mode = MMC_POWER_UNDEFINED;
 
-	mmc_claim_host(host);
-	if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP)
-		mmc_power_off(host);
-	else
+	if (!(host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP)) {
+		mmc_claim_host(host);
 		mmc_power_up(host, host->ocr_avail);
-	mmc_release_host(host);
+		mmc_release_host(host);
+	}
 
 	mmc_gpiod_request_cd_irq(host);
 	_mmc_detect_change(host, 0, false);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] mmc/memstick: rtsx_usb: Fix runtime PM issues Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:40 +0200
  [PATCH 4/6] memstick: rtsx_usb_ms: Manage runtime PM when accessing the device Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:40 +0200
  [PATCH 1/6] mmc: rtsx_usb_sdmmc: Avoid keeping the device runtime resumed when unused Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:40 +0200
  [PATCH 2/6] mmc: rtsx_usb_sdmmc: Handle runtime PM while changing the led Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:40 +0200
  [PATCH 5/6] mmc: rtsx_usb_sdmmc: Enable runtime PM autosuspend Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:50 +0200
  [PATCH 6/6] mmc: core: Don't power off the card when starting the host Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:50 +0200
  [PATCH 3/6] memstick: rtsx_usb_ms: Runtime resume the device when polling for cards Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-13 13:50 +0200
  Re: [PATCH 0/6] mmc/memstick: rtsx_usb: Fix runtime PM issues Ulf Hansson <ulf.hansson@linaro.org> - 2016-10-17 16:00 +0200
    Re: [PATCH 0/6] mmc/memstick: rtsx_usb: Fix runtime PM issues Alan Stern <stern@rowland.harvard.edu> - 2016-10-17 18:40 +0200

csiph-web