From patchwork Mon Jun 10 15:03:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 17743 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52C5D25E5D for ; Mon, 10 Jun 2013 15:04:27 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id gf12sf6967563vcb.2 for ; Mon, 10 Jun 2013 08:04:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=Xa8tyIhOXCQSxaS0HdogCrWWBlVCoeOQ8bseJObndSA=; b=IFFd6ZK+/IKHI0KAzGMyGjfIcSJt6/97cNd5n8CjRY+KjjcUCKRDltib5t1lUPOhTi jOMIUgm1uuAxxbGicjWrLLoOkYmkZ/blKn1x3nZaC5vaW8NjOsKhd7IVC4WJMsKhOL1q iuKlYjCyKJOB+Are5aWqDQVoDEHLuqSM7+yeU8POILapnMQVC9NJo5Zj6+wvDZ81yUkM qPCjngGyv86sVH0eWgBIyqEJmu9gcuJy40/ZZRqxFjmXCl2PjXjetXzhYeozeIKNi7LU go7Zs0Y7QjZlPIe/AsSdOyQ2W5FWVLnsmlns6VaKstr1UATD2bFmhrpIGi0rbYvfzBi2 HZZA== X-Received: by 10.58.118.7 with SMTP id ki7mr1431866veb.5.1370876667039; Mon, 10 Jun 2013 08:04:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.236 with SMTP id 12ls2843057qeh.97.gmail; Mon, 10 Jun 2013 08:04:26 -0700 (PDT) X-Received: by 10.220.174.75 with SMTP id s11mr5784344vcz.61.1370876666659; Mon, 10 Jun 2013 08:04:26 -0700 (PDT) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [2607:f8b0:400c:c02::230]) by mx.google.com with ESMTPS id di3si5076078vcb.5.2013.06.10.08.04.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 08:04:26 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::230; Received: by mail-vb0-f48.google.com with SMTP id w15so2200845vbf.21 for ; Mon, 10 Jun 2013 08:04:26 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr5811128vcb.8.1370876666534; Mon, 10 Jun 2013 08:04:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp71498vcb; Mon, 10 Jun 2013 08:04:25 -0700 (PDT) X-Received: by 10.14.69.199 with SMTP id n47mr11647670eed.11.1370876665376; Mon, 10 Jun 2013 08:04:25 -0700 (PDT) Received: from eu1sys200aog115.obsmtp.com (eu1sys200aog115.obsmtp.com [207.126.144.139]) by mx.google.com with SMTP id w41si8545231eex.126.2013.06.10.08.04.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Jun 2013 08:04:25 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.139 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.139; Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKUbXq9SDcIoI0Fa91iMU1D4/tE3PMLu4J@postini.com; Mon, 10 Jun 2013 15:04:25 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id 8932441; Mon, 10 Jun 2013 15:03:19 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 1110954; Mon, 10 Jun 2013 15:04:20 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 981C5A8065; Mon, 10 Jun 2013 17:04:13 +0200 (CEST) Received: from steludxu1397.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Mon, 10 Jun 2013 17:04:19 +0200 From: Ulf Hansson To: , Chris Ball Cc: Ulf Hansson Subject: [PATCH 10/12] mmc: core: Enable power_off_notify for eMMC shutdown sequence Date: Mon, 10 Jun 2013 17:03:45 +0200 Message-ID: <1370876627-13439-11-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1370876627-13439-1-git-send-email-ulf.hansson@stericsson.com> References: <1370876627-13439-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlwMrnPPEO45pyr3e47zqRxGProlUVM1xTazFqWi4hjDCHo0Kc3OEg3ZmyhiYPXKJcOsE8V X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Ulf Hansson In suspend mode it is important to save power. If the host is able to cut buth vcc and vccq, the MMC_CAP2_POWEROFF_NOTIFY shall be set. It will mean the card will be completely powered down at suspend and the power off notification cmd will be sent prior power down. It seems common not being able to cut both vcc and vccq for a host. In this situation we issue the sleep cmd in favor of the power off notification cmd, to save more power. While maintainng the above policy, we also want to make use of the power off notification in the shutdown sequence, even in the case were the host has not set MMC_CAP2_POWEROFF_NOTIFY, since we know vcc and vccq will regardless be cut. We accomplish this by always enabling the power off notification byte in the EXT_CSD and issue the power off notification when either MMC_CAP2_POWEROFF_NOTIFY is set or we are executing a shutdown. Signed-off-by: Ulf Hansson --- drivers/mmc/core/mmc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 3aafb2e..a96dcaa 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1041,11 +1041,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } /* - * If the host supports the power_off_notify capability then - * set the notification byte in the ext_csd register of device + * Enable power_off_notification byte in the ext_csd register */ - if ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) && - (card->ext_csd.rev >= 6)) { + if (card->ext_csd.rev >= 6) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_POWER_OFF_NOTIFICATION, EXT_CSD_POWER_ON, @@ -1485,7 +1483,8 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) if (err) goto out; - if (mmc_can_poweroff_notify(host->card)) + if (mmc_can_poweroff_notify(host->card) && + ((host->caps2 & MMC_CAP2_POWEROFF_NOTIFY) || !is_suspend)) err = mmc_poweroff_notify(host->card, notify_type); else if (mmc_can_sleep(host->card)) err = mmc_sleep(host);