From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 04 Jun 2013 17:31:31 -0600 Subject: [U-Boot] [PATCH v2] mmc: Update "mmc->part_num" when performing a partition switch In-Reply-To: References: <1370373446-14025-1-git-send-email-fabio.estevam@freescale.com> <51AE3E2F.9020408@wwwdotorg.org> <51AE41BF.8060206@wwwdotorg.org> <51AE6653.7060807@wwwdotorg.org> Message-ID: <51AE78D3.7020405@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 06/04/2013 05:16 PM, Fabio Estevam wrote: > On Tue, Jun 4, 2013 at 7:12 PM, Stephen Warren wrote: > >> static void fini_mmc_for_env(struct mmc *mmc) >> { >> #ifdef CONFIG_SYS_MMC_ENV_PART >> - if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num) >> + if (mmc->part_num != orig_part_num) >> mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV, >> - mmc->part_num); >> + orig_part_num); > > If I keep the original 'mmc->part_num' here, then it works. It doesn't "work", it just hides the problem. By passing mmc->part_num here, you're passing the partition that's already/currently selected rather than restoring the original value. Selecting it again is a no-op; IIRC the MMC core explicitly checks for this condition and immediately returns without touching the HW.