From patchwork Sun Jun 5 12:38:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 849742 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p55CcxGm001727 for ; Sun, 5 Jun 2011 12:38:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756020Ab1FEMi6 (ORCPT ); Sun, 5 Jun 2011 08:38:58 -0400 Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]:26860 "EHLO mtaout02-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756017Ab1FEMi6 (ORCPT ); Sun, 5 Jun 2011 08:38:58 -0400 Received: from aamtaout02-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 <20110605123856.ORVT16165.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Sun, 5 Jun 2011 13:38:56 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20110605123856.WEJN5924.aamtaout02-winn.ispmail.ntl.com@zog.reactivated.net>; Sun, 5 Jun 2011 13:38:56 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id BC6F39D401C; Sun, 5 Jun 2011 13:38:52 +0100 (BST) From: Daniel Drake To: linux-mmc@vger.kernel.org Cc: ohad@wizery.com Subject: [PATCH] mmc: sdio: reset card during power_restore Message-Id: <20110605123852.BC6F39D401C@zog.reactivated.net> Date: Sun, 5 Jun 2011 13:38:52 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=QfTNKbwSQXoA:10 a=vJ1w_8FsMGIA:10 a=Op-mwl0xAAAA:8 a=ObbIJxJc23FSpCeXfucA:9 a=K3Dv1uL1FSr6uia3MisA:7 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]); Sun, 05 Jun 2011 12:38:59 +0000 (UTC) mmc_sdio_power_restore() skips some steps that are performed in other power-related codepaths which are necessary to fully reset the card. Without this, the card can't be powered up and probe fails. All these steps are needed, to satisfy the cases of both normal runtime PM and also suspend/resume situations. Tested on sd8686 libertas wifi on XO-1.5. Signed-off-by: Daniel Drake --- drivers/mmc/core/sdio.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 8af3330..9170ea2 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -706,10 +706,25 @@ static int mmc_sdio_power_restore(struct mmc_host *host) BUG_ON(!host->card); mmc_claim_host(host); + + /* + * Reset the card by performing the same steps that are taken by + * mmc_rescan_try_freq() and mmc_attach_sdio() during a "normal" probe + */ + sdio_reset(host); + mmc_go_idle(host); + mmc_send_if_cond(host, host->ocr_avail); + + ret = mmc_send_io_op_cond(host, 0, NULL); + if (ret) + goto out; + ret = mmc_sdio_init_card(host, host->ocr, host->card, mmc_card_keep_power(host)); if (!ret && host->sdio_irqs) mmc_signal_sdio_irq(host); + +out: mmc_release_host(host); return ret;