Received: by 10.192.165.148 with SMTP id m20csp3213411imm; Mon, 23 Apr 2018 02:37:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+EY42vdRfI1LGH7muhaNHiRvEudtfZzQHJRwTbe+fNXIPRKKQ30Or/tRliPuPJ2v2xem8m X-Received: by 10.101.65.77 with SMTP id x13mr6543299pgp.223.1524476276118; Mon, 23 Apr 2018 02:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524476276; cv=none; d=google.com; s=arc-20160816; b=JhPW9wL9AwR4uc7VSOCi37/i6QW2gb5TewJJZAOVAdwQnUlOQNSkZiiKrUld9DKzau sP+VEAeLTrxCs5fh98aFLPT1aIpmf2gAISM2oAZFPo1S1rTeELtDj1DqWqYOuYBleLtS MERAD9K7TZVhAubgzO2W2hC6eO7q71k4ILLkBxdLxu18i7oGWa4GUYQIUaEN4i3RedcO 06vyK5E4HlZBx9Ffz09A3y8DSm5uRFLZDER54MgHGPUJ9i5tq1oL7ly6dpy0t4N6crj/ ri3jniuAuGodVysWe6TsrW9WaXYP+lhb3cB0UB8/MbDFuCzUFPVm4EB5x6iKO7OmwxfD 39+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=kUUyIMBZxrvCE1rcnzqpQCA60BNOmWTLjDHCmgh0aZQ=; b=lo9HD0nnxf9nWLobw48tjokwSqxSyQhuQiEwu/YSQefa2shuao4EAQGKe5ZZbohK/q 0wRvUTudxKOMNkxw/4V+b7OkXsBf5n4qHVxT9VdbnjunmMV6l+hLJJB+ekj0Ef22uk9+ g9qad5mGvlkmTewNy8XmGQUfbIP1ZKvZS0m4wrDRAa31mX0fQUPrBPmcFxsrYtk6MHsl 6ghyWNSWVzkf+moj8B/5IczTnPFccBizqXq6HafVXUwBdsgigIYl2CX2dDBNS3R6AFzE xC1FKV+Vbrvj/feW546qdz/uGbJLYPvpRUvxz9GU9SMPSXI1Bd1PleewUWwUfH/g+0VZ iVyQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t198si9468014pgc.600.2018.04.23.02.37.41; Mon, 23 Apr 2018 02:37:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754568AbeDWJgg (ORCPT + 99 others); Mon, 23 Apr 2018 05:36:36 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:51890 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754456AbeDWJgb (ORCPT ); Mon, 23 Apr 2018 05:36:31 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 40V1Yn0P72z1qtdh; Mon, 23 Apr 2018 11:36:28 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 40V1Ym4vYsz1qql3; Mon, 23 Apr 2018 11:36:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id vJ4Efu_8clom; Mon, 23 Apr 2018 11:36:26 +0200 (CEST) X-Auth-Info: WmZDeMQ7TTqURgFnZPOw48naY8KMML2u4+4olfMg0xA= Received: from jawa (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 23 Apr 2018 11:36:26 +0200 (CEST) Date: Mon, 23 Apr 2018 11:36:19 +0200 From: Lukasz Majewski To: Ulf Hansson 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 Subject: Re: [PATCH] mmc: disable card sleep via device-tree Message-ID: <20180423113619.6f557d8e@jawa> In-Reply-To: References: <20180422213126.32756-1-lukma@denx.de> Organization: denx.de X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/IF+H5faWthBKBtwH87VFZRl"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/IF+H5faWthBKBtwH87VFZRl Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 =3D <0>; > > compatible =3D "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 =3D 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 =3D of_property_read_bool(np, > > "broken-hpi"); > > + card->no_sleep_on_suspend =3D > > + 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 =3D 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) =20 >=20 > No, this is wrong. >=20 > This means that the mmc_power_off() a few lines below would start to > violate the eMMC spec.=20 > 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). >=20 > 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. It seems like the eMMC is always powered with 3.3V. 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). 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). 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] >=20 > > err =3D mmc_sleep(host); > > else if (!mmc_host_is_spi(host)) > > err =3D mmc_deselect_cards(host); > > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h > > index 279b39008a33..c64d88e6de3b 100644 > > --- a/include/linux/mmc/card.h > > +++ b/include/linux/mmc/card.h > > @@ -304,8 +304,8 @@ struct mmc_card { > > struct dentry *debugfs_root; > > struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical > > partitions */ unsigned int nr_parts; > > - > > unsigned int bouncesz; /* Bounce buffer > > size */ > > + bool no_sleep_on_suspend; > > }; > > > > static inline bool mmc_large_sector(struct mmc_card *card) > > -- > > 2.11.0 > > =20 >=20 > My impression is that it seems like there are still some uncertainties > around what actually happens when the failure occurs during re-boot. I > am guessing this boils done to how VMMC and VQMMC are being managed. >=20 > BTW, in the the pwrseq_emmc, we register a restart handler to pull the > reset GPIO for the eMMC. Perhaps that can help to fix this problem as > well!? >=20 > Kind regards > Uffe Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de --Sig_/IF+H5faWthBKBtwH87VFZRl Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAlrdqRMACgkQAR8vZIA0 zr016gf/U3BMmug4/3JHoJvLnmWsn9Q/uhjNGsQb+5QKjnS5K3SWIGGYKraSStG/ A9sv3YR7x/WFE+GAB//u9g0zhkAPd6b+fTDxmbWnn2PmaY4JpRp1M/aTXg+oHIQm qZcBUKYpgkTxaxybEmdzjZryupVv/X8Nojoxftmx3OrZ2dMQVk1FveR8avVlG3/5 RnCHesIqhBZNxv90j0bn5B5kVae+PyLyDg3w4pNmiaHZEaVbVvlMz8lI4+bcJNoM pHSuW01yPos6FTXIQgO8BWIr1obUR8YYi8fqnQF9gBWqPpvXp0Sxy9rhJk91N5Ec TvyTBn0TCZezMQR5rFEjHxlZDEmEag== =rntX -----END PGP SIGNATURE----- --Sig_/IF+H5faWthBKBtwH87VFZRl--