[U-Boot] [PATCH] SD/MMC: check the card status during erase operation

From: Jerry Huang Chang-Ming.Huang@freescale.com
Use the function 'mmc_send_status' to check the card status. only when the card is ready, driver can send the next erase command to the card, otherwise, the erase will failed: => mmc erase 0 1 MMC erase: dev # 0, block # 0, count 1 ... 1 blocks erase: OK => mmc erase 0 2 MMC erase: dev # 0, block # 0, count 2 ... mmc erase failed 1 blocks erase: ERROR => mmc erase 0 4 MMC erase: dev # 0, block # 0, count 4 ... mmc erase failed 1 blocks erase: ERROR
Signed-off-by: Jerry Huang Chang-Ming.Huang@freescale.com CC: Andy Fleming afleming@gmail.com CC: Marek Vasut marex@denx.de --- drivers/mmc/mmc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 596732e..f92b662 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -333,6 +333,7 @@ mmc_berase(int dev_num, unsigned long start, lbaint_t blkcnt) int err = 0; struct mmc *mmc = find_mmc_device(dev_num); lbaint_t blk = 0, blk_r = 0; + int timeout = 1000;
if (!mmc) return -1; @@ -352,6 +353,10 @@ mmc_berase(int dev_num, unsigned long start, lbaint_t blkcnt) break;
blk += blk_r; + + /* Waiting for the ready status */ + if (mmc_send_status(mmc, timeout)) + return 0; }
return blk;

Hi, Andy, There is not any feedback for very long time. Could it be applied to u-boot?
Best Regards Jerry Huang
-----Original Message----- From: Huang Changming-R66093 Sent: Friday, May 18, 2012 5:01 PM To: u-boot@lists.denx.de Cc: Huang Changming-R66093; Andy Fleming; Marek Vasut Subject: [PATCH] SD/MMC: check the card status during erase operation
From: Jerry Huang Chang-Ming.Huang@freescale.com
Use the function 'mmc_send_status' to check the card status. only when the card is ready, driver can send the next erase command to the card, otherwise, the erase will failed: => mmc erase 0 1 MMC erase: dev # 0, block # 0, count 1 ... 1 blocks erase: OK => mmc erase 0 2 MMC erase: dev # 0, block # 0, count 2 ... mmc erase failed 1 blocks erase: ERROR => mmc erase 0 4 MMC erase: dev # 0, block # 0, count 4 ... mmc erase failed 1 blocks erase: ERROR
Signed-off-by: Jerry Huang Chang-Ming.Huang@freescale.com CC: Andy Fleming afleming@gmail.com CC: Marek Vasut marex@denx.de
drivers/mmc/mmc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 596732e..f92b662 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -333,6 +333,7 @@ mmc_berase(int dev_num, unsigned long start, lbaint_t blkcnt) int err = 0; struct mmc *mmc = find_mmc_device(dev_num); lbaint_t blk = 0, blk_r = 0;
int timeout = 1000;
if (!mmc) return -1;
@@ -352,6 +353,10 @@ mmc_berase(int dev_num, unsigned long start, lbaint_t blkcnt) break;
blk += blk_r;
/* Waiting for the ready status */
if (mmc_send_status(mmc, timeout))
return 0;
}
return blk;
-- 1.7.5.4
participants (2)
-
Chang-Ming.Huang@freescale.com
-
Huang Changming-R66093