summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-09-25 08:06:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-25 08:06:22 +0200
commit1ab2e649dc0ccef7ee990b999e1d8f8c32e7cd24 (patch)
tree66f02471e811228f4da2580109b7d26c68ebe90a /commands
parent39bdcdfb814a22c8143c04938268378e9994b7dd (diff)
parent94c0b6c798f619bd45aa1411a2ffedba86cad063 (diff)
downloadbarebox-1ab2e649dc0ccef7ee990b999e1d8f8c32e7cd24.tar.gz
barebox-1ab2e649dc0ccef7ee990b999e1d8f8c32e7cd24.tar.xz
Merge branch 'for-next/mmc' into master
Diffstat (limited to 'commands')
-rw-r--r--commands/mmc_extcsd.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c
index c9a28fb1fe..7ae068348d 100644
--- a/commands/mmc_extcsd.c
+++ b/commands/mmc_extcsd.c
@@ -11,6 +11,7 @@
#include <mci.h>
#include <getopt.h>
#include <fs.h>
+#include <linux/sizes.h>
#define EXT_CSD_BLOCKSIZE 512
@@ -1142,7 +1143,7 @@ static int print_field(u8 *reg, int index)
return 1;
case EXT_CSD_SEC_COUNT:
- tmp64 = val * 512;
+ tmp64 *= 512;
printf("\tDevice density: %llu B\n", tmp64);
return 1;
@@ -1232,7 +1233,7 @@ static int print_field(u8 *reg, int index)
case EXT_CSD_HC_ERASE_GRP_SIZE:
val = get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- val = val * 524288;
+ val = val * SZ_512K;
if (val)
str = basprintf("Erase-unit size: %u", val);
else
@@ -1342,7 +1343,8 @@ static int print_field(u8 *reg, int index)
case EXT_CSD_ENH_SIZE_MULT:
tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- tmp64 = val * tmp * 524288;
+ tmp64 *= tmp;
+ tmp64 *= SZ_512K;
printf("\tEnhanced User Data Area %i Size: %llu B\n",
index - EXT_CSD_ENH_SIZE_MULT, tmp64);
return 1;
@@ -1350,28 +1352,32 @@ static int print_field(u8 *reg, int index)
case EXT_CSD_GP_SIZE_MULT3:
tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- tmp64 = val * tmp * 524288;
+ tmp64 *= tmp;
+ tmp64 *= SZ_512K;
printf("\tGeneral_Purpose_Partition_3 Size: %llu B\n", tmp64);
return 1;
case EXT_CSD_GP_SIZE_MULT2:
tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- tmp64 = val * tmp * 524288;
+ tmp64 *= tmp;
+ tmp64 *= SZ_512K;
printf("\tGeneral_Purpose_Partition_2 Size: %llu B\n", tmp64);
return 1;
case EXT_CSD_GP_SIZE_MULT1:
tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- tmp64 = val * tmp * 524288;
+ tmp64 *= tmp;
+ tmp64 *= SZ_512K;
printf("\tGeneral_Purpose_Partition_1 Size: %llu B\n", tmp64);
return 1;
case EXT_CSD_GP_SIZE_MULT0:
tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- tmp64 = val * tmp * 524288;
+ tmp64 *= tmp;
+ tmp64 *= SZ_512K;
printf("\tGeneral_Purpose_Partition_0 Size: %llu B\n", tmp64);
return 1;
@@ -1422,7 +1428,8 @@ static int print_field(u8 *reg, int index)
case EXT_CSD_MAX_ENH_SIZE_MULT:
tmp = get_field_val(EXT_CSD_HC_WP_GRP_SIZE, 0, 0xFF);
tmp = tmp + get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF);
- tmp64 = val * tmp * 524288;
+ tmp64 *= tmp;
+ tmp64 *= SZ_512K;
printf("\tMax Enhanced Area: %llu B\n", tmp64);
return 1;
@@ -2156,7 +2163,7 @@ static int print_field(u8 *reg, int index)
str = "FIFO policy for cache";
else
str = "not provided";
- printf("\t[0] Device flushing: %s", str);
+ printf("\t[0] Device flushing: %s\n", str);
return 1;
case EXT_CSD_OPTIMAL_READ_SIZE: