diff options
| author | Peng Fan <[email protected]> | 2016-09-01 11:13:39 +0800 |
|---|---|---|
| committer | Jaehoon Chung <[email protected]> | 2016-09-20 06:46:01 +0900 |
| commit | e492dbb41e025ac1a7d7934b1df52b2f0485f8dd (patch) | |
| tree | 21f35aa012b3badd17d5651063e4ead052d0d23d /drivers | |
| parent | 3697e5992f89c923aca17d7d9174739da28cb3cd (diff) | |
mmc: sd: optimize erase
To SD, there is no erase group, then the value erase_grp_size
will be default 1. When erasing SD blocks, the blocks will be
erased one by one, which is time consuming.
We use AU_SIZE as a group to speed up the erasing.
Erasing 4MB with a SD2.0 Card with AU_SIZE 4MB.
`time mmc erase 0x100000 0x2000`
time: 44.856 seconds (before optimization)
time: 0.335 seconds (after optimization)
Signed-off-by: Peng Fan <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Stefan Wahren <[email protected]>
Cc: Clemens Gruber <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Eric Nelson <[email protected]>
Cc: Stephen Warren <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/mmc/mmc_write.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c index 0f8b5c79d7c..22896403754 100644 --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c @@ -100,8 +100,13 @@ unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start, & ~(mmc->erase_grp_size - 1)) - 1); while (blk < blkcnt) { - blk_r = ((blkcnt - blk) > mmc->erase_grp_size) ? - mmc->erase_grp_size : (blkcnt - blk); + if (IS_SD(mmc) && mmc->ssr.au) { + blk_r = ((blkcnt - blk) > mmc->ssr.au) ? + mmc->ssr.au : (blkcnt - blk); + } else { + blk_r = ((blkcnt - blk) > mmc->erase_grp_size) ? + mmc->erase_grp_size : (blkcnt - blk); + } err = mmc_erase_t(mmc, start + blk, blk_r); if (err) break; |
