Received: by 10.192.165.148 with SMTP id m20csp3254374imm; Mon, 23 Apr 2018 03:27:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx49FSBzA8lkPadRal2G2W3GTe9x0E0hnTLlhPwnjFLjDVPxd/29QnNsPwo8Ri8CCu+2Cz+Il X-Received: by 2002:a17:902:7e05:: with SMTP id b5-v6mr19876354plm.230.1524479242419; Mon, 23 Apr 2018 03:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524479242; cv=none; d=google.com; s=arc-20160816; b=Hf+WXvTvY9DW1xb/gntJ3E27br9Is5tRkwVOPT3YhF51gzgDlMp0jPnACD/htw96tD Hr85NANCwmSqMpp9LeVjZURVKZKCTFd0pecje4NoYIalMzQC1mWTBFpwoaxFpjdzaH5X 7jalnYn+bEnUGeoy2ii4/GPuNNregggsZvn+XeUBEV8X9phQqoZSyAJabIYMZKiR3DJY 7B3t8LwDb/hlNiTnQgHv+JRMgABwzutd95soJd5FPrPSA+fLepKsVoD087YrDdVYqKoP uTuhYOnpkjzJmEQl7jNbI+8X6Ur9szwoX9fNg+th8h+4HW8flPvkCelCCq+P/s8VKsYx oncw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=/Ehv2qxFrhbRhmubIZVT/gi5B9cPIynEmc8KliLd/gw=; b=mjeq+VuHRbWy90wR19GyzUh+wQmE0eJa11L5GaWWKwKTEyNehXGEN6SfnCY2nrKIPL efZLkebstkSPysREJVXJJjMZgPKo27I98UCqVrl0T+Vyj9iaO987UUO+KrhmTa3xFG1o lZOjq+T1MjZq8Y+7thZ86KVSlW/1gk1wM2jiAqN0BDWo5MpvS/dJ5A5ZExS2U6sH5t1z sRRjMypB9YgxU2Uw6VJoZzREtF7XeaSD7R3aP5zvey+YrlBEwRny95NOH4Zq4yrtvNCF qVlLHdSsECVAO/pUiWZ7kOFqTRi2G/hOeNprgBvqtIuKDb23ZZlKf0k2AExiqoY1l4xm fZng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dRuMF1o4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si9292435pgq.333.2018.04.23.03.27.08; Mon, 23 Apr 2018 03:27:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dRuMF1o4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754663AbeDWKYm (ORCPT + 99 others); Mon, 23 Apr 2018 06:24:42 -0400 Received: from mail-io0-f182.google.com ([209.85.223.182]:39393 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754591AbeDWKYj (ORCPT ); Mon, 23 Apr 2018 06:24:39 -0400 Received: by mail-io0-f182.google.com with SMTP id r9-v6so1758167iod.6 for ; Mon, 23 Apr 2018 03:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/Ehv2qxFrhbRhmubIZVT/gi5B9cPIynEmc8KliLd/gw=; b=dRuMF1o4KZF+cVGJb2Ip2cAUksqacKq2Lmzt5GYDHS+1yRHZjihubB8CluCYo72mvu GtaK8sQz2xV/Qkz96cFzqvj0znr22mXXIYjdu1xJ3qejMl7KGrCyOiTmfieXpkKEGglm j/HlQrl9Lv9sWpJyBfcj+QLzRJwOZ/lJ/7ggc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/Ehv2qxFrhbRhmubIZVT/gi5B9cPIynEmc8KliLd/gw=; b=OiSRDtEEQg2xNq3gEMeLNnt7ovWJhYNlTlvN7jyxuDz0rHHM3XtQi87vHXZf8TYtr1 H4qzEBvb5ZSmIGjJzq8/9BsO56sWASiTcogp6uyGyaYpRhC4Zr76/VOVmn/zMSKSN8w0 iZ3lvPOehvqbACmgHD7iaAsQV4mLeoXkC0kMzwqpcehwbQ3MF7w1a993p+/+pBkcPBQN EYRbROSiRvHvO9/nSiLiw7qpY7pFQLT3CkrgmHwMCQiVhH+fUxSt2Fv9/I1l94E+F/vw XU8KRBpgh68z/f6+eC1difSTK9GGZL23MCTjp3G/DhiHIxXSZBASg2kHLCq8NIOJ1KOo RP0A== X-Gm-Message-State: ALQs6tD0naYvm4B6sXZvD7I/X7SKcoUGmPFzPF7ivt3VRoxU+olJoxx6 yTpTNI08WhRmCS5ol/RigLhjiXEz7qw7TlyHWAjRwQ== X-Received: by 2002:a6b:5109:: with SMTP id f9-v6mr13246iob.192.1524479079035; Mon, 23 Apr 2018 03:24:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:734a:0:0:0:0:0 with HTTP; Mon, 23 Apr 2018 03:24:38 -0700 (PDT) In-Reply-To: <20180423113619.6f557d8e@jawa> References: <20180422213126.32756-1-lukma@denx.de> <20180423113619.6f557d8e@jawa> From: Ulf Hansson Date: Mon, 23 Apr 2018 12:24:38 +0200 Message-ID: Subject: Re: [PATCH] mmc: disable card sleep via device-tree To: Lukasz Majewski Cc: Linus Walleij , Linux Kernel Mailing List , Rob Herring , Mark Rutland , Adrian Hunter , Fabio Estevam , Wolfram Sang , Chanho Min , devicetree@vger.kernel.org, "linux-mmc@vger.kernel.org" , Stanislav Meduna Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23 April 2018 at 11:36, Lukasz Majewski wrote: > Hi Ulf, > >> On 22 April 2018 at 23:31, Lukasz Majewski wrote: >> > From: Stanislav Meduna >> > >> > On a TQMa53 module the mmc_sleep leaves the eMMC card in a state >> > that the imx53 rom boot code is unable to probe, resulting in >> > reboot hanging. Add a device tree property to disable sleeping >> > on suspend. >> > >> > For TQMa53 modules the exact commit to cause hang after reboot >> > (v3.10 -> v3.11): >> > commit 486fdbbc1483 ("mmc: core: Add shutdown callback for (e)MMC >> > bus_ops") >> > >> > [The exact discussion can be found here: >> > https://patchwork.kernel.org/patch/8881401/ >> > "i.MX53 restart via watchdog does not work" >> > >> > Signed-off-by: Stanislav Meduna >> > Signed-off-by: Lukasz Majewski >> > --- >> > Documentation/devicetree/bindings/mmc/mmc-card.txt | 4 ++++ >> > drivers/mmc/core/mmc.c | 7 +++++-- >> > include/linux/mmc/card.h | 2 +- >> > 3 files changed, 10 insertions(+), 3 deletions(-) >> > >> > diff --git a/Documentation/devicetree/bindings/mmc/mmc-card.txt >> > b/Documentation/devicetree/bindings/mmc/mmc-card.txt index >> > 8d2d71758907..c3ee151edd7c 100644 --- >> > a/Documentation/devicetree/bindings/mmc/mmc-card.txt +++ >> > b/Documentation/devicetree/bindings/mmc/mmc-card.txt @@ -12,6 +12,9 >> > @@ Required properties: Optional properties: >> > -broken-hpi : Use this to indicate that the mmc-card has a broken >> > hpi implementation, and that hpi should not be used >> > +-no-sleep-on-suspend : Do not put the card to sleep when >> > suspending. >> > + There are boards with bootloaders that are unable >> > + to probe such card when rebooting. >> > >> > Example: >> > >> > @@ -26,5 +29,6 @@ Example: >> > reg = <0>; >> > compatible = "mmc-card"; >> > broken-hpi; >> > + no-sleep-on-suspend; >> > }; >> > }; >> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c >> > index 208a762b87ef..a3b74b5c8893 100644 >> > --- a/drivers/mmc/core/mmc.c >> > +++ b/drivers/mmc/core/mmc.c >> > @@ -381,8 +381,11 @@ static int mmc_decode_ext_csd(struct mmc_card >> > *card, u8 *ext_csd) } >> > >> > np = mmc_of_find_child_device(card->host, 0); >> > - if (np && of_device_is_compatible(np, "mmc-card")) >> > + if (np && of_device_is_compatible(np, "mmc-card")) { >> > broken_hpi = of_property_read_bool(np, >> > "broken-hpi"); >> > + card->no_sleep_on_suspend = >> > + of_property_read_bool(np, >> > "no-sleep-on-suspend"); >> > + } >> > of_node_put(np); >> > >> > /* >> > @@ -1990,7 +1993,7 @@ static int _mmc_suspend(struct mmc_host >> > *host, bool is_suspend) if (mmc_can_poweroff_notify(host->card) && >> > ((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) >> > || !is_suspend)) err = mmc_poweroff_notify(host->card, notify_type); >> > - else if (mmc_can_sleep(host->card)) >> > + else if (mmc_can_sleep(host->card) >> > && !host->card->no_sleep_on_suspend) >> >> No, this is wrong. >> >> This means that the mmc_power_off() a few lines below would start to >> violate the eMMC spec. >> That via powering off the card, without first >> sending the sleep or power-off-notify command. >> You are probably just lucky, as your particular eMMC card still copes >> with this in-correct sequence (I know there are these kind of cards). >> >> Well, what is also interesting in this regards, is what is happening >> during mmc_power_off(). > > The mmc_power_off() -> mmc_pwrseq_power_off() -> here the *pwrseq is > null, so we do nothing with the power. > > In mmc_power_off() function we call mmc_set_initial_state(host); > >> Does your host driver cut power to VMMC and/or >> VQMMC? > > The esdhci3 controller uses 'vmm-supply' which is a 'regulator-fixed' > with 'regulator-always-on' attribute. Assume you mean vmmc-supply. Anyway, it seems a bit weird to have this regulator as fixed and always on. Of course it's possible, but it's more common to have vqmmc fixed and always on. Maybe double check the schematics. > > It seems like the eMMC is always powered with 3.3V. What about vqmmc then? > > Considering the above it seems like the card is still powered - the HW > design also supports some backup powering (so the voltage from the > board is not took immediately). I think you need to verify that the CMD5 (sleep) is actually sent and successfully completed. In regards to that, do your host support MMC_CAP_WAIT_WHILE_BUSY? If not, there is a delay (specific to the card) after the CMD5. So the support in your host driver for MMC_CAP_WAIT_WHILE_BUSY could be broken, or the delay may be too short. Perhaps forcing to use the delay and use a delay that for sure should work is worth to test. > > > To be even more strange the suspend to mem works without any issues > (without this patch). > With "reboot -f" it seems like we hang in imx53 BootROM (as I can read > it from my JTAG debugger). So clearly there is a difference during reboot. A wild guess... Probably vmmc supply is turned on/off in this path, while perhaps the CMD5 support has failed when the kernel issued it... > > As written in the commit message - problems started after sending > suspend sequence of eMMC commands to the eMMC device. > > > [The eMMC memory itself is Micron 4GiB - 4.4.1] [...] Kind regards Uffe