public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arend.vanspriel@broadcom.com (Arend Van Spriel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: core: Fix power sequence ordering in mmc_power_up
Date: Wed, 1 Mar 2017 10:53:46 +0100	[thread overview]
Message-ID: <ef8580d1-989f-c9ab-abc7-034eb8cad7d0@broadcom.com> (raw)
In-Reply-To: <20170301085902.7388-1-romain.perier@collabora.com>

On 1-3-2017 9:59, Romain Perier wrote:
> Currently, mmc_power_up calls the pre_power_on callback, enables the
> power supply of the mmc by calling mmc_set_ios() and then call
> post_power_on. WiFi chipsets like the AP6335 require a specific power
> sequence ordering before being used. You must enable the power supply
> and wait until it reaches its minimum voltage, gate the clock and wait
> at least two cycles and then assert the reset line.

Hi Romain,

You have to be more clear. What power supply, ie. vmmc or the supply for
the wifi chipset. Without knowing much of the details to me this sounds
like a new powerseq variant.

> This commit prevents regulators to be enabled in the middle of or after
> the power sequencing. We this fix, mmc_set_ios is first call, the
> underlying regulators are enabled, then pre_power_on and post_power_on
> are called, so clock and reset line are enabled in the right order,
> after the regulator.

It feels counter intuitive and maybe even wrong to change a setup
pattern like this. Can you be sure this will not cause any regressions?

Regards,
Arend

> Signed-off-by: Romain Perier <romain.perier@collabora.com>
> ---
>  drivers/mmc/core/core.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 1076b9d..36df24f 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1798,8 +1798,6 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
>  	if (host->ios.power_mode == MMC_POWER_ON)
>  		return;
>  
> -	mmc_pwrseq_pre_power_on(host);
> -
>  	host->ios.vdd = fls(ocr) - 1;
>  	host->ios.power_mode = MMC_POWER_UP;
>  	/* Set initial state and call mmc_set_ios */
> @@ -1819,13 +1817,20 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
>  	 */
>  	mmc_delay(10);
>  
> -	mmc_pwrseq_post_power_on(host);
> -
>  	host->ios.clock = host->f_init;
>  
>  	host->ios.power_mode = MMC_POWER_ON;
>  	mmc_set_ios(host);
>  
> +	mmc_pwrseq_pre_power_on(host);
> +
> +	/*
> +	 * This delay should be sufficient to wait at least two cycles of clock
> +	 * gated by pre_power_on
> +	 */
> +	mmc_delay(1);
> +	mmc_pwrseq_post_power_on(host);
> +
>  	/*
>  	 * This delay must be at least 74 clock sizes, or 1 ms, or the
>  	 * time required to reach a stable voltage.
> 

  reply	other threads:[~2017-03-01  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01  8:59 [PATCH] mmc: core: Fix power sequence ordering in mmc_power_up Romain Perier
2017-03-01  9:53 ` Arend Van Spriel [this message]
2017-03-01 10:00   ` Romain Perier

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=ef8580d1-989f-c9ab-abc7-034eb8cad7d0@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.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