devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Jun Nie <jun.nie@linaro.org>,
	ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 1/4] mmc: sdhci: Add delay after power off
Date: Tue, 3 Dec 2019 09:26:52 +0200	[thread overview]
Message-ID: <7f95d66f-9d40-93ae-828d-ecae88463a9b@intel.com> (raw)
In-Reply-To: <20191202144104.5069-2-jun.nie@linaro.org>

On 2/12/19 4:41 pm, Jun Nie wrote:
> Add delay after power off to ensure that full power cycle is
> successful. Otherwise, some controllers, at lease for Hisilicon
> eMMC controller, may not be unstable sometimes for full power
> cycle operation.
> 
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  drivers/mmc/host/sdhci.c | 7 +++++++
>  drivers/mmc/host/sdhci.h | 2 ++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3140fe2e5dba..a654f0aeb438 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1761,6 +1761,13 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
>  		sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
>  		if (host->quirks2 & SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON)
>  			sdhci_runtime_pm_bus_off(host);
> +
> +		/*
> +		 * Some controllers need an extra 100ms delay to secure
> +		 * full power cycle is successful.
> +		 */
> +		if (host->quirks2 & SDHCI_QUIRK2_DELAY_AFTER_POWER_OFF)
> +			msleep(100);

Please use the ->set_power() callback and do this in your own driver.

>  	} else {
>  		/*
>  		 * Spec says that we should clear the power reg before setting
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index 0ed3e0eaef5f..0e6f97eaa796 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -482,6 +482,8 @@ struct sdhci_host {
>   * block count.
>   */
>  #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT			(1<<18)
> +/* Controllers need an extra 100ms delay to make sure power off completely */
> +#define SDHCI_QUIRK2_DELAY_AFTER_POWER_OFF		(1<<19)
>  
>  	int irq;		/* Device IRQ */
>  	void __iomem *ioaddr;	/* Mapped address */
> 


  reply	other threads:[~2019-12-03  7:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02 14:41 [PATCH 0/4] mmc: Add sdhci workaround stability enhencement Jun Nie
2019-12-02 14:41 ` [PATCH 1/4] mmc: sdhci: Add delay after power off Jun Nie
2019-12-03  7:26   ` Adrian Hunter [this message]
2019-12-02 14:41 ` [PATCH 2/4] mmc: sdhci: dt: Add DMA boundary and HS400 properties Jun Nie
2019-12-13 23:01   ` Rob Herring
2019-12-17 14:56     ` Jun Nie
2019-12-02 14:41 ` [PATCH 3/4] mmc: sdhci: Set ctrl_hs400 value in dts Jun Nie
2019-12-03  7:52   ` Adrian Hunter
2019-12-02 14:41 ` [PATCH 4/4] mmc: sdhci: Add DMA memory boundary workaround Jun Nie
2019-12-02 17:52   ` Christoph Hellwig
2019-12-03  3:29     ` Jun Nie
2019-12-03  7:36       ` Christoph Hellwig
2019-12-04  6:00         ` Jun Nie
2019-12-04  7:14           ` Jisheng Zhang
2019-12-10  9:36             ` Ulf Hansson
2019-12-03  2:47   ` Jisheng Zhang
2019-12-03  3:33     ` Jun Nie
2019-12-03  9:05       ` Jisheng Zhang
2019-12-03  9:18         ` Christoph Hellwig
2019-12-03  9:49           ` Jisheng Zhang
2019-12-03 13:06             ` Christoph Hellwig
2019-12-04  7:11               ` Jisheng Zhang
2019-12-03  9:49         ` Jisheng Zhang
2019-12-03 13:04           ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f95d66f-9d40-93ae-828d-ecae88463a9b@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jun.nie@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).