mbox series

[0/5] Revamp CSD register parsing

Message ID 20230926100006.1789276-1-avri.altman@wdc.com
Headers show
Series Revamp CSD register parsing | expand

Message

Avri Altman Sept. 26, 2023, 10 a.m. UTC
Dust-up this old code that practically left untouched since lsmmc got
merged into mmc-utils.

The first 4 patches are mostly cleanups, where the 5fth is fixing a
capacity calculation bug.

Avri Altman (4):
  mmc-utils: lsmmc: Reuse do_read_reg
  mmc-utils: lsmmc: Simplify prinitng manufacturer name
  mmc-utils: lsmmc: Simplify interface processing functions
  mmc-utils: lsmmc: Disintegrade print_mmc_csd

wanggang26 (1):
  mmc-utils: lsmmc: Fix emmc capacity calculation

 lsmmc.c | 1585 +++++++++++++++++++++++++------------------------------
 1 file changed, 727 insertions(+), 858 deletions(-)

Comments

Ulf Hansson Sept. 27, 2023, 10:55 a.m. UTC | #1
On Tue, 26 Sept 2023 at 12:02, Avri Altman <avri.altman@wdc.com> wrote:
>
> From: wanggang26 <wanggang26@xiaomi.com>
>
> 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>

I didn't quite see Gang's "Signed-off-by" at the original patch that
was posted (maybe you discussed offlist). Anyway, just to be sure, I
think we need his confirmation that patch is okay, before I can apply
it.

Gang?

Kind regards
Uffe

> ---
>  lsmmc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lsmmc.c b/lsmmc.c
> index ef8fab1..b7d1c58 100644
> --- a/lsmmc.c
> +++ b/lsmmc.c
> @@ -1819,6 +1819,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);
>
> --
> 2.42.0
>