All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] env_init() for mmc
@ 2017-03-22 22:58 ` york sun
  2017-03-30  4:49   ` Jaehoon Chung
  0 siblings, 1 reply; 5+ messages in thread
From: york sun @ 2017-03-22 22:58 UTC (permalink / raw)
  To: u-boot

Jaehoon,

I noticed the env_init() returns default environmental variable for SPL 
build. I wonder if you can make some change to use the actual variables? 
I am having some trouble to get the saved variable during SPL boot.

York

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

* [U-Boot] env_init() for mmc
  2017-03-22 22:58 ` [U-Boot] env_init() for mmc york sun
@ 2017-03-30  4:49   ` Jaehoon Chung
  2017-03-30  4:57     ` york sun
  0 siblings, 1 reply; 5+ messages in thread
From: Jaehoon Chung @ 2017-03-30  4:49 UTC (permalink / raw)
  To: u-boot

Hi York,

On 03/23/2017 07:58 AM, york sun wrote:
> Jaehoon,
> 
> I noticed the env_init() returns default environmental variable for SPL 
> build. I wonder if you can make some change to use the actual variables? 
> I am having some trouble to get the saved variable during SPL boot.

Which trouble do you have for getting saved variable?
If you can share in more detail, it's helpful to me. And I'm finding the solution for it.
Now, i have a more free time than before.. :)

Best Regards,
Jaehoon Chung

> 
> York
> 
> 
> 

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

* [U-Boot] env_init() for mmc
  2017-03-30  4:49   ` Jaehoon Chung
@ 2017-03-30  4:57     ` york sun
  2017-03-30  9:06       ` Jean-Jacques Hiblot
  0 siblings, 1 reply; 5+ messages in thread
From: york sun @ 2017-03-30  4:57 UTC (permalink / raw)
  To: u-boot

Sorry for top posting. I am using OWA which doesn't do inline reply.

Jaehoon,

The trouble is the env_init() returns the default environment for SPL part. It means whatever variables I saved doesn't get loaded during the SPL part. It is only available after the SPL loads the RAM version. For example, we have hwconfig variable to control how we want to do DDR interleaving. It is saved. For NOR flash boot, it has no issue. But for eMMC/SD/QSPI boot, the env_init() doesn't use the real variable and ignore what I saved. After U-Boot fully comes up, I can see the correct variable.

York

________________________________________
From: Jaehoon Chung <jh80.chung@samsung.com>
Sent: Wednesday, March 29, 2017 9:49 PM
To: york sun
Cc: u-boot at lists.denx.de
Subject: Re: env_init() for mmc

Hi York,

On 03/23/2017 07:58 AM, york sun wrote:
> Jaehoon,
>
> I noticed the env_init() returns default environmental variable for SPL
> build. I wonder if you can make some change to use the actual variables?
> I am having some trouble to get the saved variable during SPL boot.

Which trouble do you have for getting saved variable?
If you can share in more detail, it's helpful to me. And I'm finding the solution for it.
Now, i have a more free time than before.. :)

Best Regards,
Jaehoon Chung

>
> York
>
>
>

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

* [U-Boot] env_init() for mmc
  2017-03-30  4:57     ` york sun
@ 2017-03-30  9:06       ` Jean-Jacques Hiblot
  2017-03-30 15:19         ` york sun
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Jacques Hiblot @ 2017-03-30  9:06 UTC (permalink / raw)
  To: u-boot



On 30/03/2017 06:57, york sun wrote:
> Sorry for top posting. I am using OWA which doesn't do inline reply.
>
> Jaehoon,
>
> The trouble is the env_init() returns the default environment for SPL part. It means whatever variables I saved doesn't get loaded during the SPL part. It is only available after the SPL loads the RAM version. For example, we have hwconfig variable to control how we want to do DDR interleaving. It is saved. For NOR flash boot, it has no issue. But for eMMC/SD/QSPI boot, the env_init() doesn't use the real variable and ignore what I saved. After U-Boot fully comes up, I can see the correct variable.
Hi York,

  Without more details it's difficult to conclude I had the same issue, 
but I ran into something similar.
My problem was that the device were the env is stored wasn't not 
initialized before accessing the environment because the boot device is 
not where the env is stored.
The solution in my case was to call mmc_initialize() in the env_init(). 
I haven't submitted a proper patch yet by lack of time but here is what 
it looks like:

diff --git a/common/env_ext4.c b/common/env_ext4.c
index ce748ed..54d8972 100644
--- a/common/env_ext4.c
+++ b/common/env_ext4.c
@@ -42,6 +42,10 @@ int env_init(void)
         gd->env_addr = (ulong)&default_environment[0];
         gd->env_valid = 1;

+       /* intialize the MMC sub-system if env is stored on a MMC*/
+       if (!strcmp(EXT4_ENV_INTERFACE, "mmc"))
+               mmc_initialize(NULL);
+
         return 0;
  }

diff --git a/common/env_fat.c b/common/env_fat.c
index 75616d4..1ed1ff6 100644
--- a/common/env_fat.c
+++ b/common/env_fat.c
@@ -31,6 +31,10 @@ int env_init(void)
         gd->env_addr = (ulong)&default_environment[0];
         gd->env_valid = 1;

+       /* intialize the MMC sub-system if env is stored on a MMC*/
+       if (!strcmp(FAT_ENV_INTERFACE, "mmc"))
+               mmc_initialize(NULL);
+
         return 0;
  }

diff --git a/common/env_mmc.c b/common/env_mmc.c
index af932a4..d2b1a29 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -64,6 +64,11 @@ int env_init(void)
         /* use default */
         gd->env_addr    = (ulong)&default_environment[0];
         gd->env_valid   = 1;
+       /*
+        * intialize the MMC sub-system. This will probe the
+        * MMC controllers if not already done
+        */
+       mmc_initialize(NULL);

         return 0;
  }


>
> York
>
> ________________________________________
> From: Jaehoon Chung <jh80.chung@samsung.com>
> Sent: Wednesday, March 29, 2017 9:49 PM
> To: york sun
> Cc: u-boot at lists.denx.de
> Subject: Re: env_init() for mmc
>
> Hi York,
>
> On 03/23/2017 07:58 AM, york sun wrote:
>> Jaehoon,
>>
>> I noticed the env_init() returns default environmental variable for SPL
>> build. I wonder if you can make some change to use the actual variables?
>> I am having some trouble to get the saved variable during SPL boot.
> Which trouble do you have for getting saved variable?
> If you can share in more detail, it's helpful to me. And I'm finding the solution for it.
> Now, i have a more free time than before.. :)
>
> Best Regards,
> Jaehoon Chung
>
>> York
>>
>>
>>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] env_init() for mmc
  2017-03-30  9:06       ` Jean-Jacques Hiblot
@ 2017-03-30 15:19         ` york sun
  0 siblings, 0 replies; 5+ messages in thread
From: york sun @ 2017-03-30 15:19 UTC (permalink / raw)
  To: u-boot

On 03/30/2017 02:06 AM, Jean-Jacques Hiblot wrote:
>
>
> On 30/03/2017 06:57, york sun wrote:
>> Sorry for top posting. I am using OWA which doesn't do inline reply.
>>
>> Jaehoon,
>>
>> The trouble is the env_init() returns the default environment for SPL part. It means whatever variables I saved doesn't get loaded during the SPL part. It is only available after the SPL loads the RAM version. For example, we have hwconfig variable to control how we want to do DDR interleaving. It is saved. For NOR flash boot, it has no issue. But for eMMC/SD/QSPI boot, the env_init() doesn't use the real variable and ignore what I saved. After U-Boot fully comes up, I can see the correct variable.
> Hi York,
>
>   Without more details it's difficult to conclude I had the same issue,
> but I ran into something similar.
> My problem was that the device were the env is stored wasn't not
> initialized before accessing the environment because the boot device is
> not where the env is stored.
> The solution in my case was to call mmc_initialize() in the env_init().
> I haven't submitted a proper patch yet by lack of time but here is what
> it looks like:
>
> diff --git a/common/env_ext4.c b/common/env_ext4.c
> index ce748ed..54d8972 100644
> --- a/common/env_ext4.c
> +++ b/common/env_ext4.c
> @@ -42,6 +42,10 @@ int env_init(void)
>          gd->env_addr = (ulong)&default_environment[0];
>          gd->env_valid = 1;
>
> +       /* intialize the MMC sub-system if env is stored on a MMC*/
> +       if (!strcmp(EXT4_ENV_INTERFACE, "mmc"))
> +               mmc_initialize(NULL);
> +
>          return 0;
>   }
>
> diff --git a/common/env_fat.c b/common/env_fat.c
> index 75616d4..1ed1ff6 100644
> --- a/common/env_fat.c
> +++ b/common/env_fat.c
> @@ -31,6 +31,10 @@ int env_init(void)
>          gd->env_addr = (ulong)&default_environment[0];
>          gd->env_valid = 1;
>
> +       /* intialize the MMC sub-system if env is stored on a MMC*/
> +       if (!strcmp(FAT_ENV_INTERFACE, "mmc"))
> +               mmc_initialize(NULL);
> +
>          return 0;
>   }
>
> diff --git a/common/env_mmc.c b/common/env_mmc.c
> index af932a4..d2b1a29 100644
> --- a/common/env_mmc.c
> +++ b/common/env_mmc.c
> @@ -64,6 +64,11 @@ int env_init(void)
>          /* use default */
>          gd->env_addr    = (ulong)&default_environment[0];
>          gd->env_valid   = 1;
> +       /*
> +        * intialize the MMC sub-system. This will probe the
> +        * MMC controllers if not already done
> +        */
> +       mmc_initialize(NULL);
>
>          return 0;
>   }
>
>

That may be it. When I check env_init() in common/env_mmc.c, it simply has

gd->env_addr    = (ulong)&default_environment[0];

So before initializing mmc, there is no actual environmental variable 
loaded. Same thing happens to common/env_ext4.c, common/env_fat.c, 
common/env_sf.c, etc. I don't know if this was intentional.

York

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

end of thread, other threads:[~2017-03-30 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170322225851epcas2p49448ead802833d6abef2cc3e527be0c3@epcas2p4.samsung.com>
2017-03-22 22:58 ` [U-Boot] env_init() for mmc york sun
2017-03-30  4:49   ` Jaehoon Chung
2017-03-30  4:57     ` york sun
2017-03-30  9:06       ` Jean-Jacques Hiblot
2017-03-30 15:19         ` york sun

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.