diff options
author | Avri Altman <avri.altman@wdc.com> | 2023-09-28 21:06:58 +0300 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2023-10-10 16:30:03 +0200 |
commit | b5ca140312d279ad2f22068fd72a6230eea13436 (patch) | |
tree | 98fbe0a48e83c2d6c5f64f5031bda17a7147c5fb | |
parent | d1d8a05eeb4bc88178705aaf86e6e636c6038928 (diff) | |
download | mmc-utils-b5ca140312d279ad2f22068fd72a6230eea13436.tar.gz |
mmc-utils: lsmmc: Fix emmc capacity calculation
When the device capacity is larger than 2GB, it shouldn't use c_size but
instead it follows a different calculation using the SEC_COUNT field of
the ext-csd[215:212] - see eMMC spec JESD84-B51 paragraph 7.3.12.
This bug was already in lsmmc when it got merged into mmc-utils, hence
the fixes tag.
Fixes: 4af1749d2350 (mmc-utils: Merge the lsmmc tool into mmc-utils)
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20230928180658.1795491-5-avri.altman@wdc.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | lsmmc.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1826,6 +1826,9 @@ static void print_mmc_csd_capacity(unsigned int c_size, unsigned int c_size_mult int block_len = 1 << read_bl_len; unsigned long long memory_capacity; + if (c_size == 0xfff) + return; + printf("\tC_SIZE: 0x%03x\n", c_size); printf("\tC_SIZE_MULT: 0x%01x\n", c_size_mult); |