From patchwork Wed Apr 24 09:59:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2483571 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5F8EBDF25A for ; Wed, 24 Apr 2013 09:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753351Ab3DXJ7q (ORCPT ); Wed, 24 Apr 2013 05:59:46 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:52472 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753325Ab3DXJ7p (ORCPT ); Wed, 24 Apr 2013 05:59:45 -0400 Received: from axis700.grange (dslb-084-061-106-028.pools.arcor-ip.net [84.61.106.28]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0MBjmR-1UKBN10ncl-00An7g; Wed, 24 Apr 2013 11:59:20 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 9340140BB4; Wed, 24 Apr 2013 11:59:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 8817240BB3; Wed, 24 Apr 2013 11:59:19 +0200 (CEST) Date: Wed, 24 Apr 2013 11:59:19 +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 , Nguyen Hong Ky Subject: [PATCH v2] mmc: tmio: reset the controller after power-up Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:EJNVSTevXoSDLmC9mlb2E2bMEZR9aBJEcuLSzbwJ+G9 DdISW9J0wnxPAQ25QBNj6pEs2oLJcctNE/pS7MpSaTC+ZHnsFo qHFN/9YA83wKdzVqPEU4DanUIRJDFopFGAyr1xcS4JKtXSCtrm CmOzAwO+V+MaKN3s3GhXfpDHv091Q1qMcXt2+hQhNsdU720LCY aKOmXWoeS5y1BsaxTWFLYrynzqsSQ/mVtGbTUpR4PMocIsIbTA yjPiGNb/Indk7rSjdABPxa1hZQ+Jpqx+JysSfmkDDxCdVRXYv7 DXvvmNReeu/b3vTBZNnszyT+Ff/37ZuZVuu4At2b2WspXQTu2L Z5/ub+ITWN/P+wHITg/FaAowGKlyKZx6QAns4vKQCOOdaYDK3Q juAJlkdTt5fxA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org This fixes two reported problems: 1. after a system resume the controller isn't functioning until a command runs on a timeout and a controller reset is performed. 2. if a card is ejected during a running write operation, its re-insertion isn't detected. Reported-by: Nguyen Viet Dung Reported-by: Nguyen Hong Ky Signed-off-by: Guennadi Liakhovetski Tested-by: Nguyen Viet Dung Tested-by: Nguyen Hong Ky --- v2: this patch supersedes the earlier "mmc: tmio: postpone controller reset during resume" in that it extends the number of cases, in which the reset is applied. It turned out, it is needed not only after a resume, but also for recovery after an interrupted write. It also now applies on top of "[PATCH v2] MMC: tmio: fix unbalanced power-on calls with clock-gating enabled" http://article.gmane.org/gmane.linux.kernel.mmc/20233. Reporters are cordially invited to add their "Tested-by" tags ;-) Chris, both these patches are fixes. Not sure whether it's still a good idea to push them for 3.9, maybe better get them into 3.10 and then to stable? drivers/mmc/host/tmio_mmc_pio.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c index 1d5ef64..fcb9503 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -863,6 +863,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) tmio_mmc_clk_update(mmc); pm_runtime_get_sync(dev); } + if (host->power == TMIO_MMC_OFF_STOP) + tmio_mmc_reset(host); tmio_mmc_set_clock(host, ios->clock); if (host->power == TMIO_MMC_OFF_STOP) /* power up SD card and the bus */ @@ -1161,7 +1163,6 @@ 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 */