From patchwork Tue Jun 18 15:34:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 167177 Delivered-To: patches@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4375382ilk; Tue, 18 Jun 2019 08:35:06 -0700 (PDT) X-Received: by 2002:a2e:9b81:: with SMTP id z1mr173482lji.101.1560872106562; Tue, 18 Jun 2019 08:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560872106; cv=none; d=google.com; s=arc-20160816; b=s2ggR9DJ3bJ54TIkZRAqSI9iUQkDh1RU32NAYoE8aHEz75YBHQ1DVbYZuNJuNT6DNA giLXBUGPliZnyY2n/i3yRjqWyT1XtLRZnxFAcP/AebkOM0amevwF3M0uIO0LhAwSE8bt Dz3/CpcJO3mERQ4/BmfEsLpIm5lEFU/aPDH70dv1lNw98ZFSBEeFPDCfntZz5hnBrXqY odovuZ3wMOErEbO9F+2JKj2al/kElYwl6JQtTI1x9aIs1RTBZMGt5gsfVyRajo0AgLub ncc1dtQ+9H8v5Aygx5jvPjIAC1QvQ0sIMm2kAbm9etQlhPYN5k0Q2bJ43K4s2yFdaTnR PVCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Eio1rBJiXbAWHfP/5yZZpxExzsuzz/VQXaABMKwUz1s=; b=EYkHZaQJ/XIVdYfkMjpbPDVi8dOIMOHb+Ab4Fa8cZAgb9JiM8CS6q0m3tsDbZujq7c YwwUuX4SFLe9cG/v1DuAQXH+hJrpXSFHrSOxHn5gxax+xx/MZmiP26GZMlMLqspbqqp0 jcKWysTMKw3c5u2sEhv4Nz/Oysu76paSs70eRpwrR37MiI5++AiMxdlRSjJK2Yng1Omq HMqWS4SzadSXg2tLPoFEPGLNJ0ZTc9FOxb63zQnOK038MEh6FhyGW1zSy7DQWUsXAuN1 cUp0zuoreIS+PC9sE/cIBppk2LMPFjO1oc+4clXqk/cLx18sLnvbjB4mDTJzazBs49VE z9fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CiqtmVs1; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v9sor8388868ljh.19.2019.06.18.08.35.06 for (Google Transport Security); Tue, 18 Jun 2019 08:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CiqtmVs1; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Eio1rBJiXbAWHfP/5yZZpxExzsuzz/VQXaABMKwUz1s=; b=CiqtmVs1O7WUxp0c8LA8vVFi4qYer4R0mJQ/igwJV1BCqNCUcI3fnHmGOwSWK2B8DO 3LPIA5GtovHe+mPAlWVq5UPetkOcLnPBbJIq5Jeh1H5reB9bsKo5XVhFeMF3jjMMDwRz TcxXSwb0sUixM+eACxy+1EYpLJcuO51RPho+zAgWk1vmY+U8mXukv09+lEwH/gZmpTRd 2NAfdT36kfBdwVhrRcBF+OsP7iWKNGeOW/Lv40rY+/75NrUEU79o5AT5CYQ/vHpOeoWd sj8ARY1ChBP2ul/qBWMT0A2yRbHl+jZx9biXecU1Hp1A5uXlWqq5nznZFHH0yY+zmGks FB9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Eio1rBJiXbAWHfP/5yZZpxExzsuzz/VQXaABMKwUz1s=; b=FvccijNlub+SGcLtJmB67CKJ0EZ7T8BGJ1GTqjfl4uvBtViprfU95rvK9BeO15OULx pWHCldd5vN0u7+H5y5DKx6vhC70NMi3jmUfvR0TTf2gGAVCvkNqQbzj3UrF0mFNAOK8z CkLB5HfB0kZOqljOVTXFV6UTQlyul6H1abjuqPzZQeAp5nqIQOVsxiL6nq5nhccl+M6B HnC6dSOveJ5U1kuLYV/ysGgoiBCCxol+kSiWH7pLvum8Ot4JeWJoY/ebi6dNcruHbLKE vEG4iIAOJIg4+dL7hIQS+K6dyeMy1+qZEpMMZ8kuLA3dgg6jyONttShUhf89jLRnavn2 VoJQ== X-Gm-Message-State: APjAAAUI/KVBC9ucuOzawOcmhLgTsHS9FJiaHWB2/POH68V7QPxnkHRi rCYBgdnyw9ZzTMIy2pFr6ZIBNktT X-Google-Smtp-Source: APXvYqzDLTL4QE/CEhY3P6VAQOmWh2YCo3YYWY667+/MrWCmuTWHUVHLgfW4j2uiZywQJ56lw5myFA== X-Received: by 2002:a2e:9997:: with SMTP id w23mr30443359lji.45.1560872105883; Tue, 18 Jun 2019 08:35:05 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id d15sm2203121lfq.76.2019.06.18.08.35.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jun 2019 08:35:05 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Adrian Hunter , Douglas Anderson Cc: Brian Norris , Shawn Lin , Guenter Roeck , Heiko Stuebner , Kalle Valo , Arend Van Spriel , linux-wireless@vger.kernel.org Subject: [PATCH 5/7] mmc: sdio: Don't re-initialize powered-on removable SDIO cards at resume Date: Tue, 18 Jun 2019 17:34:46 +0200 Message-Id: <20190618153448.27145-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190618153448.27145-1-ulf.hansson@linaro.org> References: <20190618153448.27145-1-ulf.hansson@linaro.org> It looks like the original idea behind always doing a re-initialization of a removable SDIO card during system resume in mmc_sdio_resume(), is to try to play safe to detect whether the card has been removed. However, this seems like a really a bad idea as it will most likely screw things up, especially when the card is expected to remain powered on during system suspend by the SDIO func driver. Let's fix this, simply by trusting that the detect work checks if the card is alive and inserted, which is being scheduled at the PM_POST_SUSPEND notification anyway. Signed-off-by: Ulf Hansson --- drivers/mmc/core/sdio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.17.1 Tested-by: Douglas Anderson Reviewed-by: Douglas Anderson diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index a9bfcae8db5b..945416c53b56 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -982,7 +982,11 @@ static int mmc_sdio_resume(struct mmc_host *host) /* Basic card reinitialization. */ mmc_claim_host(host); - /* Restore power if needed */ + /* + * Restore power and reinitialize the card when needed. Note that a + * removable card is checked from a detect work later on in the resume + * process. + */ if (!mmc_card_keep_power(host)) { mmc_power_up(host, host->card->ocr); /* @@ -996,12 +1000,8 @@ static int mmc_sdio_resume(struct mmc_host *host) pm_runtime_set_active(&host->card->dev); pm_runtime_enable(&host->card->dev); } - } - - /* No need to reinitialize powered-resumed nonremovable cards */ - if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) { - err = mmc_sdio_reinit_card(host, mmc_card_keep_power(host)); - } else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) { + err = mmc_sdio_reinit_card(host, 0); + } else if (mmc_card_wake_sdio_irq(host)) { /* We may have switched to 1-bit mode during suspend */ err = sdio_enable_4bit_bus(host->card); }