From patchwork Thu Feb 5 10:20:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 5783561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D95689F302 for ; Thu, 5 Feb 2015 10:25:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F7C6201F2 for ; Thu, 5 Feb 2015 10:25:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34E4D2013A for ; Thu, 5 Feb 2015 10:25:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YJJbF-0003jT-Mh; Thu, 05 Feb 2015 10:23:53 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YJJbD-0003iJ-9S for linux-arm-kernel@lists.infradead.org; Thu, 05 Feb 2015 10:23:51 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.14.5/8.14.5) with SMTP id t15AJHb6032250; Thu, 5 Feb 2015 02:23:26 -0800 Received: from sc-owa04.marvell.com ([199.233.58.150]) by mx0a-0016f401.pphosted.com with ESMTP id 1sayvhnxq8-1 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Thu, 05 Feb 2015 02:23:26 -0800 Received: from maili.marvell.com (10.93.76.83) by SC-OWA04.marvell.com (10.93.76.33) with Microsoft SMTP Server id 8.3.327.1; Thu, 5 Feb 2015 02:23:25 -0800 Received: from xhacker (unknown [10.37.135.218]) by maili.marvell.com (Postfix) with ESMTP id C9D2B3F703F; Thu, 5 Feb 2015 02:23:24 -0800 (PST) Date: Thu, 5 Feb 2015 18:20:31 +0800 From: Jisheng Zhang To: Ulf Hansson , Chris Ball , Sebastian Hesselbarth , Thomas Petazzoni , linux-mmc , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [RFC] mmc: sdhci: implement light and heavy runtime pm resume Message-ID: <20150205182031.1a47d726@xhacker> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-02-05_04:2015-02-05, 2015-02-05, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502050100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150205_022351_334276_E9174BC4 X-CRM114-Status: GOOD ( 10.46 ) X-Spam-Score: -0.7 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi all, Most sdhci_runtime_resume_host() users just gate their clocks in their runtime suspend implementation, so the sdhci_runtime_resume_host() is too heavy, we only need to restore interrupts registers. The change is something as following: It's ugly, but per my test on marvell BG2Q platforms, this change can improve the resume latency from 5500us to 11us. Is there any better solution? Thanks in advance, Jisheng diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 0ad412a..9d5bdde 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2856,7 +2856,7 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host) } EXPORT_SYMBOL_GPL(sdhci_runtime_suspend_host); -int sdhci_runtime_resume_host(struct sdhci_host *host) +static void sdhci_runtime_resume_reinit(struct sdhci_host *host) { unsigned long flags; int host_flags = host->flags; @@ -2880,6 +2880,15 @@ int sdhci_runtime_resume_host(struct sdhci_host *host) sdhci_enable_preset_value(host, true); spin_unlock_irqrestore(&host->lock, flags); } +} + +int sdhci_runtime_resume_host(struct sdhci_host *host, bool power_keeped) +{ + unsigned long flags; + int host_flags = host->flags; + + if (!power_keeped) + sdhci_runtime_resume_reinit(host); /* Set the re-tuning expiration flag */ if (host->flags & SDHCI_USING_RETUNING_TIMER)