From patchwork Mon Apr 22 08:29:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2470521 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 862793FD40 for ; Mon, 22 Apr 2013 08:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755760Ab3DVI3h (ORCPT ); Mon, 22 Apr 2013 04:29:37 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:60365 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754666Ab3DVI3f (ORCPT ); Mon, 22 Apr 2013 04:29:35 -0400 Received: from axis700.grange (dslb-178-006-245-192.pools.arcor-ip.net [178.6.245.192]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0Mf6s9-1UAauk1HTN-00OXjb; Mon, 22 Apr 2013 10:29:27 +0200 Received: by axis700.grange (Postfix, from userid 1000) id C7F8B40BB4; Mon, 22 Apr 2013 10:29:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id B922E40BB3; Mon, 22 Apr 2013 10:29:26 +0200 (CEST) Date: Mon, 22 Apr 2013 10:29:26 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: Kuninori Morimoto , Nguyen Viet Dung , hechtb@gmail.com, Horman Simon , Damm Magnus , "^[$B0p5H$5$s^[(B" , linux-mmc@vger.kernel.org, Chris Ball Subject: [PATCH] mmc: tmio: postpone controller reset during resume Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:LGAWegDdArBlx8Oi21RWkG8/5GCxn1a3Ch2NX8i46nH 2b/SOKjhRkF/ZAspTy8XJPe9gsHslAo8hhwtNnJ3fKIqp9SFmG CkKn7RPfRCUSkqORxkNTepJpG01faUMZr9qvh8vv4H4dmODhhJ XyZjCehhio9Jf+uuhP6+OU1xRPSY4mtyuYBhBZuDvbNafQu1fl loCCfxP8waGb93mdD/c/rYT2YDfnArafNoavnJr/WO2b2X10HH f8gQoLZE334FQmDLDkdPboOo2XR5I5n6hOSux/cmAKTzTR4Zj4 KUw9DsrDmNsLxf8tlXNc/jzz0J+p5ygvuH5fd5MJaLU/l/Arj9 fwAlCw7HXd3VIYTifa/AGdo1cnHjK3QfLnqbNBGpwcyOWoxYqF XB+lWpASjC9dg== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org When resuming, the tmio_mmc_host_resume() function is run when the controller might still be powered down. Issuing a reset command to it at that time has no effect. This patch postpones resetting the controller until the first powering-up .set_ios() call. Reported-by: Nguyen Viet Dung Signed-off-by: Guennadi Liakhovetski --- There is some risk associated with this patch: it removes unconditional (attempt of) controller reset from the tmio_mmc_host_resume() function. AFAICS, this shouldn't have any negative effects. There _should_ always be a powering-up .set_ios() call after a resume. However, if anyone sees any (potential) problems with it, please, let me know. drivers/mmc/host/tmio_mmc.h | 1 + drivers/mmc/host/tmio_mmc_pio.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index d857f5c..759d8f4 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -85,6 +85,7 @@ struct tmio_mmc_host { unsigned long last_req_ts; struct mutex ios_lock; /* protect set_ios() context */ bool native_hotplug; + bool resuming; }; int tmio_mmc_host_probe(struct tmio_mmc_host **host, diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index f508ecb..435cc4d 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -862,6 +862,10 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (!host->power) { tmio_mmc_clk_update(mmc); pm_runtime_get_sync(dev); + if (host->resuming) { + tmio_mmc_reset(host); + host->resuming = false; + } } tmio_mmc_set_clock(host, ios->clock); if (!host->power) { @@ -1154,10 +1158,10 @@ int tmio_mmc_host_resume(struct device *dev) struct mmc_host *mmc = dev_get_drvdata(dev); struct tmio_mmc_host *host = mmc_priv(mmc); - tmio_mmc_reset(host); tmio_mmc_enable_dma(host, true); /* The MMC core will perform the complete set up */ + host->resuming = true; return mmc_resume_host(mmc); } EXPORT_SYMBOL(tmio_mmc_host_resume);