When running the "save" command several times on a mx6qsabresd we see:

U-Boot > save
Saving Environment to MMC...
Writing to MMC(1)... done
U-Boot > save
Saving Environment to MMC...
MMC partition switch failed
U-Boot > save
Saving Environment to MMC...
Writing to MMC(1)... done
U-Boot > save
Saving Environment to MMC...
MMC partition switch failed
U-Boot > save
Saving Environment to MMC...
Writing to MMC(1)... done
U-Boot > save
Saving Environment to MMC...
MMC partition switch failed

Fix this by making mmc->part_num to be in sync with CONFIG_SYS_MMC_ENV_PART
after the partition has been changed in mmc_switch_part().

After this fix, we no longer see the error after the "save" command on a 
mx6qsabresd. Also tested on a mx53loco.

Reported-by: Jason Liu <r64...@freescale.com>
Signed-off-by: Fabio Estevam <fabio.este...@freescale.com>
---
 common/env_mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/env_mmc.c b/common/env_mmc.c
index 9ca098f..8020fc5 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -89,6 +89,7 @@ static int init_mmc_for_env(struct mmc *mmc)
                        puts("MMC partition switch failed\n");
                        return -1;
                }
+               mmc->part_num = CONFIG_SYS_MMC_ENV_PART;
        }
 #endif
 
-- 
1.8.1.2


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

Reply via email to