[U-Boot] [PATCH v2] mmc: Update "mmc->part_num" when performing a partition switch

Stephen Warren swarren at wwwdotorg.org
Wed Jun 5 01:31:31 CEST 2013


On 06/04/2013 05:16 PM, Fabio Estevam wrote:
> On Tue, Jun 4, 2013 at 7:12 PM, Stephen Warren <swarren at wwwdotorg.org> 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.


More information about the U-Boot mailing list