From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chang-Ming.Huang at freescale.com Date: Fri, 18 May 2012 17:57:01 +0800 Subject: [U-Boot] [PATCH 1/2 v2] SDHC/MMC: fix the wrong infomation after change SD card Message-ID: <1337335022-18501-1-git-send-email-Chang-Ming.Huang@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Jerry Huang 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 CC: Andy Fleming CC: Marek Vasut --- 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