Skip to content

fix issue with mmc partition management

Tom Rini u-boot 1 version New

Get series with b4
b4 am 20140911155723.GV25506@bill-the-cat

Versions newest first

  1. v1 Latest1 of 2 patches 0 repliesNew

1 of 2 patches is in this archive. The cover letter announces 2.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/2mmc: restore capacity when switching to partition 0+0 -01 reply

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchTom RiniPantelis Antoniou
2/2T-b T-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/2] fix issue with mmc partition management
Quoted 5 lines · Peter A. Bigot

This series aims at addressing an issue discovered with SPL mode when the MMC device being used lacks an environment partition.
http://www.mail-archive.com/meta-ti at yoctoproject.org/msg04320.html includes details on the original failure with this diagnosis:

Quoted 8 lines

This is a bug in handling mmc_switch_part: what's happening is that the code reconfigures the mmc device to look at the partition on which the environment is to be found, but fails to restore it to reflect the state of the whole device. I.e., the mmc capacity and lba are zero in my case (I have no partition 2 on the uSD card), but mmc_switch_part() returns -ENODEV on the attempt to switch back in fini_mmc_for_env() without also resetting the capacity to what the rest of the system expects.

1/2 has been superseded and there's some questions about 2/2. I'm going to take 2/2 as it fixes a real problem. But Stephen brings up some good questions that do need to be answered. The first thing is that SPL today assumes that it only has one MMC device registered with the subsystem, not 2. This may be reworkable (and maybe not have a big size change) but it's a bit late in this release cycle for that. So what this means is that on some hardware like say Beaglebone Black we either have an SD card (which lacks physical partitions) or we have an eMMC which means the 2 boot partitions and the user partition.

The next part of the problem is that we have some cases where we say "environment is on eMMC, in one of the boot partitions" and we say "SPL needs to look at the environment". This situation works fine when we boot from eMMC. Things fail when we use this same binary to boot from SD card. We don't have env and somewhere along the line what fails is that we tried to switch physical partition, noticed a failure, tried to correct said failure but instead end up with our internal representation of the SD/MMC device being invalid. Peter's patch 2/2 corrects this so that when we hit a failure it goes and re-sets that representation.

But the next question is "wait, why did it get set _wrong_ to start with?". I'm not sure actually. The fini_mmc_for_env call isn't making us be restored to what the physical partition was before, if that's what it was intended to do, it's making sure that we're still on the env partition. Which I'm not sure why it needs to do since we've already read a copy into memory at this point.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140911/46421755/attachment.pgp>