public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2 v2] SDHC/MMC: fix the wrong infomation after change SD card
@ 2012-05-18  9:57 Chang-Ming.Huang at freescale.com
  2012-05-18  9:57 ` [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to detect the " Chang-Ming.Huang at freescale.com
  2012-07-11  9:29 ` [U-Boot] [PATCH 1/2 v2] SDHC/MMC: fix the wrong infomation after change " Huang Changming-R66093
  0 siblings, 2 replies; 12+ messages in thread
From: Chang-Ming.Huang at freescale.com @ 2012-05-18  9:57 UTC (permalink / raw)
  To: u-boot

From: Jerry Huang <Chang-Ming.Huang@freescale.com>

When first inserting the SD card to slot, the command "mmcinfo" can
display the card information correctly.
But, then removing the SD card or inserting another SD card to slot,
the command "mmcinfo" can't display the information correctly.

when we use command "mmcinfo" every time, the driver must initialize the
SD card again, instead of assuming the card has been initialized.

Therefore remove the detect codes from mmc_init function.
And add the codes to check the mmc_init, only when mmc_init return
the right value, driver will print the information.

Below is the error log (SD card removed):
=> mmcinfo
MMC: no card present
Device: FSL_SDHC
Manufacturer ID: 3
OEM: 5344
Name: SD02G
Tran Speed: 25000000
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 1.8 GiB
Bus Width: 4-bit

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com>
CC: Andy Fleming <afleming@gmail.com>
CC: Marek Vasut <marex@denx.de>
---
changes for v2:
	- keep the member has_init
	- only remove the detect code

 common/cmd_mmc.c  |    5 ++---
 drivers/mmc/mmc.c |    3 ---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 750509d..e73ce03 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -131,9 +131,8 @@ 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);
-
-		print_mmcinfo(mmc);
+		if (!mmc_init(mmc))
+			print_mmcinfo(mmc);
 		return 0;
 	} else {
 		printf("no mmc device at slot %x\n", curr_device);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index f92b662..af644bb 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1323,9 +1323,6 @@ int mmc_init(struct mmc *mmc)
 		return NO_CARD_ERR;
 	}
 
-	if (mmc->has_init)
-		return 0;
-
 	err = mmc->init(mmc);
 
 	if (err)
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-07-30  7:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-18  9:57 [U-Boot] [PATCH 1/2 v2] SDHC/MMC: fix the wrong infomation after change SD card Chang-Ming.Huang at freescale.com
2012-05-18  9:57 ` [U-Boot] [PATCH 2/2 v3] FSL/eSDHC: enable the clock to detect the " Chang-Ming.Huang at freescale.com
2012-05-18 15:55   ` Scott Wood
2012-05-21  2:34     ` Huang Changming-R66093
2012-07-11  9:31       ` Huang Changming-R66093
2012-07-13 10:36         ` Marek Vasut
2012-05-18 16:03   ` Marek Vasut
2012-05-21  2:19     ` Huang Changming-R66093
2012-07-11  9:29 ` [U-Boot] [PATCH 1/2 v2] SDHC/MMC: fix the wrong infomation after change " Huang Changming-R66093
2012-07-13 21:32   ` Andy Fleming
2012-07-14  5:00     ` Marek Vasut
2012-07-30  7:00     ` Huang Changming-R66093

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox