* [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
@ 2022-04-10 4:46 Marek Vasut
2022-04-10 11:54 ` Felix.Vietmeyer
2022-04-10 15:20 ` Tom Rini
0 siblings, 2 replies; 6+ messages in thread
From: Marek Vasut @ 2022-04-10 4:46 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Felix . Vietmeyer @ jila . colorado . edu, Tom Rini
This reverts commit 8d61237edbf6314a701cf78da2c5893a73ff5438.
This commit broke environment on literally every board I have access
to, with this revert in place, environment works as it should again.
The problem I observe with this patch is that saved environment in
either SPI NOR or eMMC is never used, the system always falls back
to default environment. The 'saveenv' command does succeed, but then
after reset, the default env is again used.
Furthermore, the commit introduced duplicate code in env_init(), this:
"
if (!prio) {
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = ENV_INVALID;
return 0;
}
if (ret == -ENOENT) {
gd->env_addr = (ulong)&default_environment[0];
gd->env_valid = ENV_INVALID;
return 0;
}
"
Furthermore, the commit is missing DCO SoB line.
Also note that upstream does not support UltraZed EG board, so
this might have been a patch pulled from downstream which did
depend on some other downstream behavior.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Felix.Vietmeyer@jila.colorado.edu <felix.vietmeyer@jila.colorado.edu>
Cc: Tom Rini <trini@konsulko.com>
---
env/env.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/env/env.c b/env/env.c
index 7168cb9d318..e4dfb92e154 100644
--- a/env/env.c
+++ b/env/env.c
@@ -322,18 +322,17 @@ int env_init(void)
debug("%s: Environment %s init done (ret=%d)\n", __func__,
drv->name, ret);
- }
-
- if (!prio) {
- gd->env_addr = (ulong)&default_environment[0];
- gd->env_valid = ENV_INVALID;
- return 0;
+ if (gd->env_valid == ENV_INVALID)
+ ret = -ENOENT;
}
+ if (!prio)
+ return -ENODEV;
+
if (ret == -ENOENT) {
gd->env_addr = (ulong)&default_environment[0];
- gd->env_valid = ENV_INVALID;
+ gd->env_valid = ENV_VALID;
return 0;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
2022-04-10 4:46 [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected" Marek Vasut
@ 2022-04-10 11:54 ` Felix.Vietmeyer
2022-04-10 22:20 ` Marek Vasut
2022-04-10 15:20 ` Tom Rini
1 sibling, 1 reply; 6+ messages in thread
From: Felix.Vietmeyer @ 2022-04-10 11:54 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Felix . Vietmeyer @ jila . colorado . edu, Tom Rini
From your description it seems like the board I was working on must have
had an environment on NOR or eMMC which could be loaded but did not allow
the board to come up.
Then, the patch forces u-boot to use the default environment despite an
existing env on NOR or eMMC.
> This reverts commit 8d61237edbf6314a701cf78da2c5893a73ff5438.
>
> This commit broke environment on literally every board I have access
> to, with this revert in place, environment works as it should again.
> The problem I observe with this patch is that saved environment in
> either SPI NOR or eMMC is never used, the system always falls back
> to default environment. The 'saveenv' command does succeed, but then
> after reset, the default env is again used.
>
> Furthermore, the commit introduced duplicate code in env_init(), this:
> "
> if (!prio) {
> gd->env_addr = (ulong)&default_environment[0];
> gd->env_valid = ENV_INVALID;
>
> return 0;
> }
>
> if (ret == -ENOENT) {
> gd->env_addr = (ulong)&default_environment[0];
> gd->env_valid = ENV_INVALID;
>
> return 0;
> }
> "
>
> Furthermore, the commit is missing DCO SoB line.
>
> Also note that upstream does not support UltraZed EG board, so
> this might have been a patch pulled from downstream which did
> depend on some other downstream behavior.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Felix.Vietmeyer@jila.colorado.edu <felix.vietmeyer@jila.colorado.edu>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> env/env.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/env/env.c b/env/env.c
> index 7168cb9d318..e4dfb92e154 100644
> --- a/env/env.c
> +++ b/env/env.c
> @@ -322,18 +322,17 @@ int env_init(void)
>
> debug("%s: Environment %s init done (ret=%d)\n", __func__,
> drv->name, ret);
> - }
> -
> - if (!prio) {
> - gd->env_addr = (ulong)&default_environment[0];
> - gd->env_valid = ENV_INVALID;
>
> - return 0;
> + if (gd->env_valid == ENV_INVALID)
> + ret = -ENOENT;
> }
>
> + if (!prio)
> + return -ENODEV;
> +
> if (ret == -ENOENT) {
> gd->env_addr = (ulong)&default_environment[0];
> - gd->env_valid = ENV_INVALID;
> + gd->env_valid = ENV_VALID;
>
> return 0;
> }
> --
> 2.35.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
2022-04-10 4:46 [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected" Marek Vasut
2022-04-10 11:54 ` Felix.Vietmeyer
@ 2022-04-10 15:20 ` Tom Rini
1 sibling, 0 replies; 6+ messages in thread
From: Tom Rini @ 2022-04-10 15:20 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Felix . Vietmeyer @ jila . colorado . edu
[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]
On Sun, Apr 10, 2022 at 06:46:52AM +0200, Marek Vasut wrote:
> This reverts commit 8d61237edbf6314a701cf78da2c5893a73ff5438.
>
> This commit broke environment on literally every board I have access
> to, with this revert in place, environment works as it should again.
> The problem I observe with this patch is that saved environment in
> either SPI NOR or eMMC is never used, the system always falls back
> to default environment. The 'saveenv' command does succeed, but then
> after reset, the default env is again used.
>
> Furthermore, the commit introduced duplicate code in env_init(), this:
> "
> if (!prio) {
> gd->env_addr = (ulong)&default_environment[0];
> gd->env_valid = ENV_INVALID;
>
> return 0;
> }
>
> if (ret == -ENOENT) {
> gd->env_addr = (ulong)&default_environment[0];
> gd->env_valid = ENV_INVALID;
>
> return 0;
> }
> "
>
> Furthermore, the commit is missing DCO SoB line.
>
> Also note that upstream does not support UltraZed EG board, so
> this might have been a patch pulled from downstream which did
> depend on some other downstream behavior.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Felix.Vietmeyer@jila.colorado.edu <felix.vietmeyer@jila.colorado.edu>
> Cc: Tom Rini <trini@konsulko.com>
Applied to u-boot/master, thanks!
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
2022-04-10 11:54 ` Felix.Vietmeyer
@ 2022-04-10 22:20 ` Marek Vasut
2022-04-13 0:49 ` Felix.Vietmeyer
0 siblings, 1 reply; 6+ messages in thread
From: Marek Vasut @ 2022-04-10 22:20 UTC (permalink / raw)
To: Felix.Vietmeyer; +Cc: u-boot, Tom Rini
On 4/10/22 13:54, Felix.Vietmeyer@jila.colorado.edu wrote:
>>From your description it seems like the board I was working on must have
> had an environment on NOR or eMMC which could be loaded but did not allow
> the board to come up.
> Then, the patch forces u-boot to use the default environment despite an
> existing env on NOR or eMMC.
I suspect the board must have some other problem with the environment.
I just cannot tell what it is. This is using some downstream U-Boot
fork, right ? Can you reproduce the problem in mainline too ? How ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
2022-04-10 22:20 ` Marek Vasut
@ 2022-04-13 0:49 ` Felix.Vietmeyer
2022-04-13 1:09 ` Marek Vasut
0 siblings, 1 reply; 6+ messages in thread
From: Felix.Vietmeyer @ 2022-04-13 0:49 UTC (permalink / raw)
To: Marek Vasut; +Cc: felix.vietmeyer, u-boot, Tom Rini
I am not exactly sure to be honest. We were running with this patched
version for a while and it worked from what I remember.
But we have since updated u-boot and the Kernel and the latest version
does not depend on this patch.
Nevertheless, I can try to recreate the problem and see if I can figure it
out now. I feel like I might pick up on a few more things now that went
unnoticed by me when I created the patch.
> On 4/10/22 13:54, Felix.Vietmeyer@jila.colorado.edu wrote:
>>>From your description it seems like the board I was working on must have
>> had an environment on NOR or eMMC which could be loaded but did not
>> allow
>> the board to come up.
>> Then, the patch forces u-boot to use the default environment despite an
>> existing env on NOR or eMMC.
>
> I suspect the board must have some other problem with the environment.
> I just cannot tell what it is. This is using some downstream U-Boot
> fork, right ? Can you reproduce the problem in mainline too ? How ?
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected"
2022-04-13 0:49 ` Felix.Vietmeyer
@ 2022-04-13 1:09 ` Marek Vasut
0 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2022-04-13 1:09 UTC (permalink / raw)
To: Felix.Vietmeyer; +Cc: u-boot, Tom Rini
On 4/13/22 02:49, Felix.Vietmeyer@jila.colorado.edu wrote:
> I am not exactly sure to be honest. We were running with this patched
> version for a while and it worked from what I remember.
>
> But we have since updated u-boot and the Kernel and the latest version
> does not depend on this patch.
>
> Nevertheless, I can try to recreate the problem and see if I can figure it
> out now. I feel like I might pick up on a few more things now that went
> unnoticed by me when I created the patch.
Thanks. Please CC me if you have a V2.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-13 2:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-10 4:46 [PATCH] Revert "env: Load env when ENV_IS_NOWHERE is only location selected" Marek Vasut
2022-04-10 11:54 ` Felix.Vietmeyer
2022-04-10 22:20 ` Marek Vasut
2022-04-13 0:49 ` Felix.Vietmeyer
2022-04-13 1:09 ` Marek Vasut
2022-04-10 15:20 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox