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.ch...@samsung.com>
Sent: Wednesday, March 29, 2017 9:49 PM
To: york sun
Cc: u-boot@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@lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to