diff mbox

[U-Boot,v2] mmc: mmc-uclass: Add mmc_init() in mmc preinit phrase

Message ID 1473733897-17634-1-git-send-email-wenyou.yang@atmel.com
State Deferred
Delegated to: Jaehoon Chung
Headers show

Commit Message

Wenyou Yang Sept. 13, 2016, 2:31 a.m. UTC
Add mmc_init() in the mmc preinit phrase to get the device's
information. Otherwise, if the environment variables are from
the mmc device, it will fail with "** Bad device size - mmc 1 **".

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
---

Changes in v2:
 - Add the bracket for #if defined.

 drivers/mmc/mmc-uclass.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Simon Glass Sept. 23, 2016, 4:16 a.m. UTC | #1
Hi,

On 12 September 2016 at 20:31, Wenyou Yang <wenyou.yang@atmel.com> wrote:
> Add mmc_init() in the mmc preinit phrase to get the device's
> information. Otherwise, if the environment variables are from
> the mmc device, it will fail with "** Bad device size - mmc 1 **".
>
> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
> ---
>
> Changes in v2:
>  - Add the bracket for #if defined.
>
>  drivers/mmc/mmc-uclass.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 425abb1..61dd3be 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -152,11 +152,15 @@ void mmc_do_preinit(void)
>
>                 if (!m)
>                         continue;
> -#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
> +#if defined(CONFIG_FSL_ESDHC_ADAPTER_IDENT) || defined(CONFIG_ATMEL_SDHCI)
>                 mmc_set_preinit(m, 1);
>  #endif
> -               if (m->preinit)
> +               if (m->preinit) {
>                         mmc_start_init(m);
> +
> +                       mmc_init(m);
> +               }
> +

This makes it out of sync with mmc_do_preinit() in mmc_legacy.c. How come?

>         }
>  }
>
> --
> 2.7.4
>

Regards,
Simon
diff mbox

Patch

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 425abb1..61dd3be 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -152,11 +152,15 @@  void mmc_do_preinit(void)
 
 		if (!m)
 			continue;
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
+#if defined(CONFIG_FSL_ESDHC_ADAPTER_IDENT) || defined(CONFIG_ATMEL_SDHCI)
 		mmc_set_preinit(m, 1);
 #endif
-		if (m->preinit)
+		if (m->preinit) {
 			mmc_start_init(m);
+
+			mmc_init(m);
+		}
+
 	}
 }