From patchwork Tue Dec 2 16:47:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 5421291 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B8B99BEEA8 for ; Tue, 2 Dec 2014 16:51:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D446920253 for ; Tue, 2 Dec 2014 16:51:07 +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 F26E220225 for ; Tue, 2 Dec 2014 16:51:06 +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 1XvqcL-0007Ps-LU; Tue, 02 Dec 2014 16:48:01 +0000 Received: from mail.kmu-office.ch ([178.209.48.109]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XvqcI-0007KN-2x for linux-arm-kernel@lists.infradead.org; Tue, 02 Dec 2014 16:47:59 +0000 Received: from trochilidae.toradex.int (unknown [46.140.72.82]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 7DADC5E367E; Tue, 2 Dec 2014 17:46:57 +0100 (CET) From: Stefan Agner To: chris@printf.net, ulf.hansson@linaro.org, anton@enomsg.org Subject: [PATCH 1/2] mmc: sdhci-pltfm: fix abort due to missing runtime PM Date: Tue, 2 Dec 2014 17:47:24 +0100 Message-Id: <1417538845-10867-1-git-send-email-stefan@agner.ch> X-Mailer: git-send-email 2.1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141202_084758_315603_125CCCA1 X-CRM114-Status: GOOD ( 12.73 ) X-Spam-Score: 0.0 (/) Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, stefan@agner.ch, rmk+kernel@arm.linux.org.uk, shawn.guo@linaro.org, b29396@freescale.com, linux-arm-kernel@lists.infradead.org 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 When entering suspend while the device is in runtime PM, the sdhci_[suspend|resume]_host function are called without taking care of runtime PM. On Vybrid SoC this leads to external abort since during runtime suspend, the clocks for this peripheral are disabled. [ 37.772967] Unhandled fault: imprecise external abort (0x1c06) at 0x76f5f000 [ 37.780304] Internal error: : 1c06 [#1] ARM [ 37.784670] Modules linked in: [ 37.787908] CPU: 0 PID: 428 Comm: sh Not tainted 3.18.0-rc5-00119-geefd097-dirty #1540 [ 37.796142] task: 8e246c00 ti: 8ca6c000 task.ti: 8ca6c000 [ 37.801785] PC is at esdhc_writel_le+0x40/0xec [ 37.806431] LR is at sdhci_set_card_detection+0xe0/0xe4 [ 37.811877] pc : [<803f0584>] lr : [<803eaaa0>] psr: 400f0013 [ 37.811877] sp : 8ca6dd28 ip : 00000001 fp : 8ca6dd3c [ 37.823766] r10: 807a233c r9 : 00000000 r8 : 8e8b7210 [ 37.829194] r7 : 802d8a08 r6 : 8082e928 r5 : 00000000 r4 : 00000002 [ 37.835974] r3 : 8ea34e90 r2 : 00000038 r1 : 00000000 r0 : 8ea32ac0 ... Signed-off-by: Stefan Agner --- Not really sure this is the right place to fix this. The function now ended up to be identically to the implementations in sdhci-pxav3.c... drivers/mmc/host/sdhci-pltfm.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index c5b01d6..0bc864e 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef CONFIG_PPC #include #endif @@ -237,17 +238,29 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister); #ifdef CONFIG_PM int sdhci_pltfm_suspend(struct device *dev) { + int ret; struct sdhci_host *host = dev_get_drvdata(dev); - return sdhci_suspend_host(host); + pm_runtime_get_sync(dev); + ret = sdhci_suspend_host(host); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + + return ret; } EXPORT_SYMBOL_GPL(sdhci_pltfm_suspend); int sdhci_pltfm_resume(struct device *dev) { + int ret; struct sdhci_host *host = dev_get_drvdata(dev); - return sdhci_resume_host(host); + pm_runtime_get_sync(dev); + ret = sdhci_resume_host(host); + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + + return ret; } EXPORT_SYMBOL_GPL(sdhci_pltfm_resume);