From: Oliver Metz Date: Tue, 1 Oct 2013 20:32:05 +0200 Subject: [U-Boot] [PATCH 0/2] mmc: Fix capacity calculation and erase_group_size Message-ID: <1380652327-8688-1-git-send-email-oliver@freetz.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de These patches are addressing two issues that I had after activating enhanced user area feature for a 4GB card so the capacity was less than 2 GB afterwards. 1. The capacity for a high density device is calculated in a wrong way. I was not able to find any hints for this implementation in JEDEC 4.41. Anyhow, if we have ext_csd revision >= 2 we can use SEC_COUNT field to calculate the size. 2. If we have a partitioned device, e.g. enhanced user area, the ERASE_GROUP_DEF bit in ext_csd shall be set (see JEDEC 4.41, chapter 7.2.3 Configure partitions). This bit defaults to "0" on power on. Oliver Metz (2): When using a high capacity card with a density less than 2 GB a wrong size is shown. According to JEDEC 4.41 there is no differentiation for C_SIZE register between low and high capacity cards EXT_CSD_ERASE_GROUP_DEF is lost every time after a reset or reboot. Set it if device has enhanced partitions. drivers/mmc/mmc.c | 49 +++++++++++++++++++++++-------------------------- include/mmc.h | 2 ++ 2 files changed, 25 insertions(+), 26 deletions(-) -- 1.8.4