From patchwork Wed Sep 7 09:22:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 1127342 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p87GH8v6027664 for ; Wed, 7 Sep 2011 16:17:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756180Ab1IGQQv (ORCPT ); Wed, 7 Sep 2011 12:16:51 -0400 Received: from queueout02-winn.ispmail.ntl.com ([81.103.221.56]:63019 "EHLO queueout02-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755848Ab1IGQQv (ORCPT ); Wed, 7 Sep 2011 12:16:51 -0400 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20110907092213.WRMU17426.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Wed, 7 Sep 2011 10:22:13 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110907092213.MWNV24017.aamtaout03-winn.ispmail.ntl.com@zog.reactivated.net>; Wed, 7 Sep 2011 10:22:13 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id A52409D401C; Wed, 7 Sep 2011 10:22:09 +0100 (BST) From: Daniel Drake To: cjb@laptop.org Cc: linux-mmc@vger.kernel.org Cc: ohad@wizery.com Subject: [PATCH] mmc: add a short delay in mmc_power_off Message-Id: <20110907092209.A52409D401C@zog.reactivated.net> Date: Wed, 7 Sep 2011 10:22:09 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=3xiFeM0yvhwA:10 a=vJ1w_8FsMGIA:10 a=Op-mwl0xAAAA:8 a=vVPhpLNO5z-8N2rItOQA:9 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 07 Sep 2011 16:17:13 +0000 (UTC) Stress-testing the runtime power management of libertas_sdio through a rmmod/insmod loop revealed that it is quite easy to cause an ETIMEDOUT failure in mmc_sdio_power_restore() leading to: libertas_sdio: probe of mmc1:0001:1 failed with error -16 Experimentation shows that a very short delay (100us) is needed in the power down path before the card can be successfully booted again. We know that this setup is lacking poweroff clamps on the card's power lines, but as only a short delay is needed, apply this unconditionally. Also bump up to 1ms sleep for extra legroom. Signed-off-by: Daniel Drake --- drivers/mmc/core/core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 557856b..7289e99 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1214,6 +1214,13 @@ static void mmc_power_off(struct mmc_host *host) host->ios.timing = MMC_TIMING_LEGACY; mmc_set_ios(host); + /* + * Some configurations, such as the 802.11 SDIO card in the OLPC + * XO-1.5, require a short delay after poweroff before the card + * can be successfully turned on again. + */ + mmc_delay(1); + mmc_host_clk_release(host); }