From patchwork Thu Oct 13 11:37:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 77615 Delivered-To: patches@linaro.org Received: by 10.140.97.247 with SMTP id m110csp186671qge; Thu, 13 Oct 2016 04:38:03 -0700 (PDT) X-Received: by 10.25.159.76 with SMTP id i73mr9157599lfe.136.1476358683538; Thu, 13 Oct 2016 04:38:03 -0700 (PDT) Return-Path: Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com. [2a00:1450:4010:c07::233]) by mx.google.com with ESMTPS id i77si8170905lfg.86.2016.10.13.04.38.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Oct 2016 04:38:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) client-ip=2a00:1450:4010:c07::233; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x233.google.com with SMTP id b75so131023146lfg.3 for ; Thu, 13 Oct 2016 04:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ifd9ypVxRlHBfTum+6ORUTCv/C/Kp5NZkkHsL/Ld6EM=; b=f2J+tH1mYdlEcb52Weu/VesMlmUip4bAzfZXTwxmivb3by5E+niMbqXTXrHLuaqE88 S7a9eZ4sNzGt+xXwEHXHlQW59H4nJqoEceZ81pT4BtrCShY9+7tHhQ1Kh7Xbs+6t10Dy /NN3W/i+hiJUJS1vrOhCZjdpXUYwbYDLfte4A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ifd9ypVxRlHBfTum+6ORUTCv/C/Kp5NZkkHsL/Ld6EM=; b=eHnRHV12rRyLo+vkjrHq2Xb2TCbfFqzc7F7dDNhA3U6coBLxBFFYjNdHU3r1QuFVHN uU4dSfLZm+Hcz5kdQJUarxW+v1gPFOUJQogPblFkm0QxYNAyjXMrRZSonAUixpmGPD60 +krCKaNqBel4MjtD1qenFX1gsrN7moxXmzp7ODIz67b1WJDrgHtzdGuxJnEhssd5bm50 0f+BXz+6SKd7MPNt7Wn+roDIUDjlhbWZqiIdB9hwvoy92YztZhKqx7M9zdWeNwsBbdop ZQNia6hQeBwuqInwVQp359be0dxNjJBJBGoxHp0sGjr+Wiyv8cz5glM1T9tZg4s8cwn0 spVQ== X-Gm-Message-State: AA6/9RkNRWhARjuVWsx/vwRvl08/RKjVma4fCCUbmV7vVK0QvoEHfi78UJTcHOMwqaqjjPAvKlA= X-Received: by 10.25.206.138 with SMTP id e132mr9135767lfg.39.1476358682829; Thu, 13 Oct 2016 04:38:02 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id p76sm3648114lfd.11.2016.10.13.04.38.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Oct 2016 04:38:01 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Ulf Hansson Cc: Ritesh Raj Sarraf , Alan Stern , Oliver Neukum , USB list , Roger Tseng , Wei WANG Subject: [PATCH 6/6] mmc: core: Don't power off the card when starting the host Date: Thu, 13 Oct 2016 13:37:40 +0200 Message-Id: <1476358660-8338-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476358660-8338-1-git-send-email-ulf.hansson@linaro.org> References: <1476358660-8338-1-git-send-email-ulf.hansson@linaro.org> 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 Cc: Alan Stern Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 1.9.1 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);