From patchwork Fri Apr 21 10:08:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 9692371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 313EF6038E for ; Fri, 21 Apr 2017 10:14:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 250DD28111 for ; Fri, 21 Apr 2017 10:14:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19EBD28614; Fri, 21 Apr 2017 10:14:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF0ED2860E for ; Fri, 21 Apr 2017 10:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1037820AbdDUKN5 (ORCPT ); Fri, 21 Apr 2017 06:13:57 -0400 Received: from mga02.intel.com ([134.134.136.20]:46651 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1037763AbdDUKNz (ORCPT ); Fri, 21 Apr 2017 06:13:55 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Apr 2017 03:13:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,229,1488873600"; d="scan'208";a="848353373" Received: from ahunter-desktop.fi.intel.com ([10.237.72.168]) by FMSMGA003.fm.intel.com with ESMTP; 21 Apr 2017 03:13:52 -0700 From: Adrian Hunter To: Ulf Hansson Cc: linux-mmc , linux-pm , linux-acpi , "Rafael J. Wysocki" Subject: [PATCH RFC 2/4] mmc: sdio: Add capability to skip SDIO reset at scan Date: Fri, 21 Apr 2017 13:08:06 +0300 Message-Id: <1492769288-7474-3-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492769288-7474-1-git-send-email-adrian.hunter@intel.com> References: <1492769288-7474-1-git-send-email-adrian.hunter@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SDIO card state might be being preserved during hibernation, for example a SDIO wifi card supporting WOWLAN. That state will be lost if an SDIO reset is done. One way to avoid that would be to build mmc core as a module and simply not load it until after attempting to restore the hibernation image. However that won't work if the hibernation image is stored on eMMC which, of course, requires mmc core. It is assumed on such systems that the platform will power cycle the SDIO card or not as necessary so that the SDIO reset is not needed. Add a capability flag to reflect that and use it to skip the SDIO reset at scan time. Signed-off-by: Adrian Hunter --- drivers/mmc/core/core.c | 6 +++++- include/linux/mmc/host.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 6987976252ad..178e23bf0c30 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2639,8 +2639,12 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) * if the card is being re-initialized, just send it. CMD52 * should be ignored by SD/eMMC cards. * Skip it if we already know that we do not support SDIO commands + * Also skip it if we know this host controller has a SDIO card that + * needs to be able to restore from hibernation without losing the card + * state e.g. an SDIO wifi card supporting WOWLAN. */ - if (!(host->caps2 & MMC_CAP2_NO_SDIO)) + if (!(host->caps2 & MMC_CAP2_NO_SDIO) && + !(host->caps2 & MMC_CAP2_NO_SDIO_RESET)) sdio_reset(host); mmc_go_idle(host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 78c544e296cd..187a7ba41364 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -281,6 +281,7 @@ struct mmc_host { u32 caps2; /* More host capabilities */ #define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ +#define MMC_CAP2_NO_SDIO_RESET (1 << 1) /* Do not SDIO reset at scan */ #define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */ #define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ #define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */