All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: Try other signal levels during power up
@ 2014-04-18 18:58 Tim Kryger
  2014-04-24  8:38 ` Ulf Hansson
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Kryger @ 2014-04-18 18:58 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>
---
 drivers/mmc/core/core.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index acbc3f2..ecdbeae 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1517,6 +1517,8 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type)
  */
 void mmc_power_up(struct mmc_host *host, u32 ocr)
 {
+	int err;
+
 	if (host->ios.power_mode == MMC_POWER_ON)
 		return;
 
@@ -1534,7 +1536,13 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
 	mmc_set_ios(host);
 
 	/* Set signal voltage to 3.3V */
-	__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
+	err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
+
+	/* Since eMMC parts can start at 1.8v or 1.2v try those too */
+	if (err)
+		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
+	if (err)
+		__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
 
 	/*
 	 * This delay should be sufficient to allow the power supply
-- 
1.7.9.5


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

* Re: [PATCH] mmc: core: Try other signal levels during power up
  2014-04-18 18:58 [PATCH] mmc: core: Try other signal levels during power up Tim Kryger
@ 2014-04-24  8:38 ` Ulf Hansson
  2014-04-24 21:42   ` Tim Kryger
  0 siblings, 1 reply; 3+ messages in thread
From: Ulf Hansson @ 2014-04-24  8:38 UTC (permalink / raw)
  To: Tim Kryger; +Cc: Chris Ball, Linux MMC, Linux Kernel Mailing List

On 18 April 2014 20:58, 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>
> ---
>  drivers/mmc/core/core.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index acbc3f2..ecdbeae 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1517,6 +1517,8 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type)
>   */
>  void mmc_power_up(struct mmc_host *host, u32 ocr)
>  {
> +       int err;
> +

The variable err is not needed, since we don't plan on printing it nor
returning it. Please remove and handle the return code directly in the
if statements.

Kind regards
Ulf Hansson

>         if (host->ios.power_mode == MMC_POWER_ON)
>                 return;
>
> @@ -1534,7 +1536,13 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
>         mmc_set_ios(host);
>
>         /* Set signal voltage to 3.3V */
> -       __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
> +       err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
> +
> +       /* Since eMMC parts can start at 1.8v or 1.2v try those too */
> +       if (err)
> +               err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
> +       if (err)
> +               __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
>
>         /*
>          * This delay should be sufficient to allow the power supply
> --
> 1.7.9.5
>

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

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

On Thu, Apr 24, 2014 at 1:38 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 18 April 2014 20:58, Tim Kryger <tim.kryger@linaro.org> wrote:

>>  void mmc_power_up(struct mmc_host *host, u32 ocr)
>>  {
>> +       int err;
>> +
>
> The variable err is not needed, since we don't plan on printing it nor
> returning it. Please remove and handle the return code directly in the
> if statements.

Sure.  I'll send out an updated version shortly.

Thanks,
Tim

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

end of thread, other threads:[~2014-04-24 21:42 UTC | newest]

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.