From patchwork Sun Nov 28 05:21:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 361742 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAS5JiIF007611 for ; Sun, 28 Nov 2010 05:19:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751454Ab0K1FTq (ORCPT ); Sun, 28 Nov 2010 00:19:46 -0500 Received: from mail-fx0-f46.google.com ([209.85.161.46]:57371 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751427Ab0K1FTq (ORCPT ); Sun, 28 Nov 2010 00:19:46 -0500 Received: by mail-fx0-f46.google.com with SMTP id 15so1617040fxm.19 for ; Sat, 27 Nov 2010 21:19:45 -0800 (PST) Received: by 10.223.116.11 with SMTP id k11mr2742275faq.15.1290921585661; Sat, 27 Nov 2010 21:19:45 -0800 (PST) Received: from localhost.localdomain (46-116-167-32.bb.netvision.net.il [46.116.167.32]) by mx.google.com with ESMTPS id a2sm832791faw.46.2010.11.27.21.19.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 27 Nov 2010 21:19:44 -0800 (PST) From: Ohad Ben-Cohen To: Cc: Chris Ball , Ohad Ben-Cohen Subject: [PATCH 2/3] mmc: sdio: don't reinitialize nonremovable powered-resumed cards Date: Sun, 28 Nov 2010 07:21:29 +0200 Message-Id: <1290921690-6133-3-git-send-email-ohad@wizery.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1290921690-6133-1-git-send-email-ohad@wizery.com> References: <1290921690-6133-1-git-send-email-ohad@wizery.com> 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.3 (demeter1.kernel.org [140.211.167.41]); Sun, 28 Nov 2010 05:19:47 +0000 (UTC) diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index efef5f9..b424fbe 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -627,15 +627,27 @@ static int mmc_sdio_suspend(struct mmc_host *host) static int mmc_sdio_resume(struct mmc_host *host) { - int i, err; + int i, err = 0; BUG_ON(!host); BUG_ON(!host->card); /* Basic card reinitialization. */ mmc_claim_host(host); - err = mmc_sdio_init_card(host, host->ocr, host->card, + + /* No need to reinitialize powered-resumed nonremovable cards */ + if (mmc_card_is_removable(host) || !mmc_card_is_powered_resumed(host)) + err = mmc_sdio_init_card(host, host->ocr, host->card, (host->pm_flags & MMC_PM_KEEP_POWER)); + else if (mmc_card_is_powered_resumed(host)) { + /* We may have switched to 1-bit mode during suspend */ + err = sdio_enable_4bit_bus(host->card); + if (err > 0) { + mmc_set_bus_width(host, MMC_BUS_WIDTH_4); + err = 0; + } + } + if (!err && host->sdio_irqs) mmc_signal_sdio_irq(host); mmc_release_host(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 381c77f..30b6fb9 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -317,5 +317,10 @@ static inline int mmc_card_is_removable(struct mmc_host *host) return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; } +static inline int mmc_card_is_powered_resumed(struct mmc_host *host) +{ + return host->pm_flags & MMC_PM_KEEP_POWER; +} + #endif