mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] mmc: core: Try other signal levels during power up
@ 2014-04-24 21:44 Tim Kryger
  2014-04-25  8:16 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Kryger @ 2014-04-24 21:44 UTC (permalink / raw)
  To: Chris Ball, Ulf Hansson; +Cc: Tim Kryger, Linux MMC, Linux Kernel Mailing List

The eMMC signalling voltage is determined by VCCQ which is provided to
the card by the host.  Signalling is not required to begin at 3.3v and,
if the host and card both support a particular VCC/VCCQ combination, it
can be used immediately.

In contrast, SD Cards must begin with 3.3v signalling and may switch to
a lower voltage signalling if instructed to do so in CMD11.  A message
is required to coordinate this operation because the card only receives
a 3.3v VDD and must know when to use the 1.8v produced by its internal
regulator.

It makes sense for the core to begin with 3.3v signalling but when that
can't be set, 1.8v and 1.2v signalling also should be attempted.  This
is especially important when an external regulator with a limited range
is used to supply VCCQ to an eMMC part.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
---

Changes since v1:
  - Eliminated temporary err variable and added debug output

 drivers/mmc/core/core.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index acbc3f2..72926a9 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1533,8 +1533,13 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
 	host->ios.timing = MMC_TIMING_LEGACY;
 	mmc_set_ios(host);
 
-	/* Set signal voltage to 3.3V */
-	__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
+	/* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */
+	if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330) == 0)
+		dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n");
+	else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0)
+		dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n");
+	else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120) == 0)
+		dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n");
 
 	/*
 	 * This delay should be sufficient to allow the power supply
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mmc: core: Try other signal levels during power up
  2014-04-24 21:44 [PATCH v2] mmc: core: Try other signal levels during power up Tim Kryger
@ 2014-04-25  8:16 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2014-04-25  8:16 UTC (permalink / raw)
  To: Tim Kryger; +Cc: Chris Ball, Linux MMC, Linux Kernel Mailing List

On 24 April 2014 23:44, Tim Kryger <tim.kryger@linaro.org> wrote:
> The eMMC signalling voltage is determined by VCCQ which is provided to
> the card by the host.  Signalling is not required to begin at 3.3v and,
> if the host and card both support a particular VCC/VCCQ combination, it
> can be used immediately.
>
> In contrast, SD Cards must begin with 3.3v signalling and may switch to
> a lower voltage signalling if instructed to do so in CMD11.  A message
> is required to coordinate this operation because the card only receives
> a 3.3v VDD and must know when to use the 1.8v produced by its internal
> regulator.
>
> It makes sense for the core to begin with 3.3v signalling but when that
> can't be set, 1.8v and 1.2v signalling also should be attempted.  This
> is especially important when an external regulator with a limited range
> is used to supply VCCQ to an eMMC part.
>
> Signed-off-by: Tim Kryger <tim.kryger@linaro.org>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
>
> Changes since v1:
>   - Eliminated temporary err variable and added debug output
>
>  drivers/mmc/core/core.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index acbc3f2..72926a9 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1533,8 +1533,13 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
>         host->ios.timing = MMC_TIMING_LEGACY;
>         mmc_set_ios(host);
>
> -       /* Set signal voltage to 3.3V */
> -       __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
> +       /* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */
> +       if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330) == 0)
> +               dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n");
> +       else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0)
> +               dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n");
> +       else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120) == 0)
> +               dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n");
>
>         /*
>          * This delay should be sufficient to allow the power supply
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-25  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-24 21:44 [PATCH v2] mmc: core: Try other signal levels during power up Tim Kryger
2014-04-25  8:16 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®