public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] common: env_mmc: Make mmc->part_num in sync after a partition switch
@ 2013-06-04 18:23 Fabio Estevam
  2013-06-04 18:28 ` Stephen Warren
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2013-06-04 18:23 UTC (permalink / raw)
  To: u-boot

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 <r64343@freescale.com>
Signed-off-by: Fabio Estevam <fabio.estevam@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

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

* [U-Boot] [PATCH] common: env_mmc: Make mmc->part_num in sync after a partition switch
  2013-06-04 18:23 [U-Boot] [PATCH] common: env_mmc: Make mmc->part_num in sync after a partition switch Fabio Estevam
@ 2013-06-04 18:28 ` Stephen Warren
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Warren @ 2013-06-04 18:28 UTC (permalink / raw)
  To: u-boot

On 06/04/2013 12:23 PM, Fabio Estevam wrote:
> 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
...
> 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().

I deliberately didn't do this, because fini_mmc_for_env() passes the
value of mmc->part_num to call mmc_switch_part() in order to put things
back the way they were. This fix would break that. Can you investigate
why you're seeing the "MMC partition switch failed" message?

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

end of thread, other threads:[~2013-06-04 18:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04 18:23 [U-Boot] [PATCH] common: env_mmc: Make mmc->part_num in sync after a partition switch Fabio Estevam
2013-06-04 18:28 ` Stephen Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox