Hi, Do you have any comment about this patch? It can be merge into the next version?
Best Regards Jerry Huang > -----Original Message----- > From: Huang Changming-R66093 > Sent: Tuesday, March 27, 2012 6:25 PM > To: u-boot@lists.denx.de > Cc: Huang Changming-R66093; Andy Fleming > Subject: [PATCH 2/2] SDHC/MMC: remove the member has_init > > From: Jerry Huang <chang-ming.hu...@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. > > Therefore remove this member 'has_init' from 'structure mmc', > 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.hu...@freescale.com> > CC: Andy Fleming <aflem...@gmail.com> > --- > common/cmd_mmc.c | 7 ++----- > drivers/mmc/mmc.c | 9 +-------- > include/mmc.h | 1 - > 3 files changed, 3 insertions(+), 14 deletions(-) > > diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c > index 8f13c22..382ea4e 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); > @@ -172,8 +171,6 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, > char * const argv[]) > return 1; > } > > - mmc->has_init = 0; > - > if (mmc_init(mmc)) > return 1; > else > diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c > index 9055b01..ad0ebc3 100644 > --- a/drivers/mmc/mmc.c > +++ b/drivers/mmc/mmc.c > @@ -1235,14 +1235,10 @@ int mmc_init(struct mmc *mmc) > int err; > > if (mmc_getcd(mmc) == 0) { > - mmc->has_init = 0; > printf("MMC: no card present\n"); > return NO_CARD_ERR; > } > > - if (mmc->has_init) > - return 0; > - > err = mmc->init(mmc); > > if (err) > @@ -1277,10 +1273,7 @@ int mmc_init(struct mmc *mmc) > } > > err = mmc_startup(mmc); > - if (err) > - mmc->has_init = 0; > - else > - mmc->has_init = 1; > + > return err; > } > > diff --git a/include/mmc.h b/include/mmc.h > index 8744604..8e37504 100644 > --- a/include/mmc.h > +++ b/include/mmc.h > @@ -277,7 +277,6 @@ struct mmc { > void *priv; > uint voltages; > uint version; > - uint has_init; > uint f_min; > uint f_max; > int high_capacity; > -- > 1.7.5.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot