diff options
Diffstat (limited to 'commands/mmc_extcsd.c')
-rw-r--r-- | commands/mmc_extcsd.c | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c index 4f566bc805..f67c48404a 100644 --- a/commands/mmc_extcsd.c +++ b/commands/mmc_extcsd.c @@ -1,19 +1,7 @@ -/* - * - * (C) Copyright 2015 Phytec Messtechnik GmbH - * Author: Daniel Schultz <d.schultz@phytec.de> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: © 2015 Phytec Messtechnik GmbH + +/* Author: Daniel Schultz <d.schultz@phytec.de> */ #include <common.h> #include <command.h> @@ -23,6 +11,7 @@ #include <mci.h> #include <getopt.h> #include <fs.h> +#include <linux/sizes.h> #define EXT_CSD_BLOCKSIZE 512 @@ -1154,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; @@ -1244,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 @@ -1354,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; @@ -1362,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; @@ -1433,8 +1427,9 @@ 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; + tmp = tmp * get_field_val(EXT_CSD_HC_ERASE_GRP_SIZE, 0, 0xFF); + tmp64 *= tmp; + tmp64 *= SZ_512K; printf("\tMax Enhanced Area: %llu B\n", tmp64); return 1; @@ -2168,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: |