From patchwork Sat Apr 23 01:01:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 1167 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:49:48 -0000 Delivered-To: patches@linaro.org Received: by 10.224.80.148 with SMTP id t20cs36568qak; Fri, 22 Apr 2011 18:02:00 -0700 (PDT) Received: by 10.236.88.235 with SMTP id a71mr1521432yhf.287.1303520520453; Fri, 22 Apr 2011 18:02:00 -0700 (PDT) Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx.google.com with ESMTPS id w42si2729343yhk.144.2011.04.22.18.01.59 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Apr 2011 18:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.159 as permitted sender) client-ip=32.97.110.159; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.110.159 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e38.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p3MHGDap026490; Fri, 22 Apr 2011 11:16:13 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p3N11sVp106002; Fri, 22 Apr 2011 19:01:54 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3N11rWp019713; Fri, 22 Apr 2011 19:01:54 -0600 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p3N11rL1019704; Fri, 22 Apr 2011 19:01:53 -0600 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id B417A1E7513; Fri, 22 Apr 2011 18:01:52 -0700 (PDT) From: John Stultz To: linux-mmc@vger.kernel.org Cc: San Mehat , Chris Ball , Arnd Bergmann , Dima Zavin , John Stultz Subject: [PATCH 5/6] mmc: sd: When resuming, try a little harder to init the card Date: Fri, 22 Apr 2011 18:01:41 -0700 Message-Id: <1303520502-32171-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1303520502-32171-1-git-send-email-john.stultz@linaro.org> References: <1303520502-32171-1-git-send-email-john.stultz@linaro.org> From: San Mehat CC: Chris Ball CC: Arnd Bergmann CC: Dima Zavin Signed-off-by: San Mehat Signed-off-by: John Stultz --- drivers/mmc/core/sd.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index c0f14cb..7b6cab2 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -734,12 +734,31 @@ static int mmc_sd_suspend(struct mmc_host *host) static int mmc_sd_resume(struct mmc_host *host) { int err; +#ifdef CONFIG_MMC_PARANOID_SD_INIT + int retries; +#endif BUG_ON(!host); BUG_ON(!host->card); mmc_claim_host(host); +#ifdef CONFIG_MMC_PARANOID_SD_INIT + retries = 5; + while (retries) { + err = mmc_sd_init_card(host, host->ocr, host->card); + + if (err) { + printk(KERN_ERR "%s: Re-init card rc = %d (retries = %d)\n", + mmc_hostname(host), err, retries); + mdelay(5); + retries--; + continue; + } + break; + } +#else err = mmc_sd_init_card(host, host->ocr, host->card); +#endif mmc_release_host(host); return err;