[U-Boot] [PATCH 5/7 V5] mmc: Enhance mmcinfo command

Haijun Zhang haijun.zhang at freescale.com
Mon Dec 30 09:20:56 CET 2013


Once mmc initialization was failed has_init should be cleared to 0,
prepare for the next initialization.

Once mmcinfo command failed, error should be reported instead of printing
incorrect mmc device information.

Error log:
=> mmcinfo
Device: FSL_SDHC
Manufacturer ID: 0
OEM: 0
Name: Tran Speed: 0
Rd Block Len: 0
MMC version 0.0
High Capacity: No
Capacity: 0 Bytes
Bus Width: 1-bit
=> mmcinfo
Device: FSL_SDHC
Manufacturer ID: 0
OEM: 0
Name: Tran Speed: 0
Rd Block Len: 0
MMC version 0.0
High Capacity: No
Capacity: 0 Bytes
Bus Width: 1-bit

Signed-off-by: Haijun Zhang <haijun.zhang at freescale.com>
---
changes for V5
	- no changes

 common/cmd_mmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index d83d1e2..94eb4a0 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -115,7 +115,8 @@ static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	mmc = find_mmc_device(curr_device);
 
 	if (mmc) {
-		mmc_init(mmc);
+		if (mmc_init(mmc))
+			return 1;
 
 		print_mmcinfo(mmc);
 		return 0;
@@ -191,9 +192,10 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 		mmc->has_init = 0;
 
-		if (mmc_init(mmc))
+		if (mmc_init(mmc)) {
+			mmc->has_init = 0;
 			return 1;
-		else
+		} else
 			return 0;
 	} else if (strncmp(argv[1], "part", 4) == 0) {
 		block_dev_desc_t *mmc_dev;
-- 
1.8.4.1




More information about the U-Boot mailing list