diff mbox

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

Message ID 1383632633-27262-5-git-send-email-Haijun.Zhang@freescale.com
State Superseded
Delegated to: Pantelis Antoniou
Headers show

Commit Message

Haijun.Zhang Nov. 5, 2013, 6:23 a.m. UTC
Once mmc initialization was faild has_init should be set to 0,
prepard for the next initialization to recover from error.

Once mmcinfo command failed error should point out instead of print
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@freescale.com>
---
 common/cmd_mmc.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Pantelis Antoniou Dec. 8, 2013, 11:22 a.m. UTC | #1
Hi Haijun,

On Nov 5, 2013, at 8:23 AM, Haijun Zhang wrote:

> Once mmc initialization was faild has_init should be set to 0,
> prepard for the next initialization to recover from error.
> 
> Once mmcinfo command failed error should point out instead of print
> 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@freescale.com>
> ---
> common/cmd_mmc.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> index 15cecb7..6f0e5ff 100644
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
> @@ -115,8 +115,10 @@ 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)) {
> +			puts("Got MMC device infor error\n");

^ Spelling error in the error message.

> +			return 1;
> +		}
> 		print_mmcinfo(mmc);
> 		return 0;
> 	} else {
> @@ -191,9 +193,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
> 
> 

Regards

-- Pantelis
diff mbox

Patch

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 15cecb7..6f0e5ff 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -115,8 +115,10 @@  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)) {
+			puts("Got MMC device infor error\n");
+			return 1;
+		}
 		print_mmcinfo(mmc);
 		return 0;
 	} else {
@@ -191,9 +193,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;