mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-22 14:41:42 +00:00
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 <peng.fan@nxp.com> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Clemens Gruber <clemens.gruber@pqgruber.com> Cc: Kever Yang <kever.yang@rock-chips.com> Cc: Eric Nelson <eric@nelint.com> Cc: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
3697e5992f
commit
e492dbb41e
1 changed files with 7 additions and 2 deletions
|
@ -100,8 +100,13 @@ unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
|
||||||
& ~(mmc->erase_grp_size - 1)) - 1);
|
& ~(mmc->erase_grp_size - 1)) - 1);
|
||||||
|
|
||||||
while (blk < blkcnt) {
|
while (blk < blkcnt) {
|
||||||
|
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) ?
|
blk_r = ((blkcnt - blk) > mmc->erase_grp_size) ?
|
||||||
mmc->erase_grp_size : (blkcnt - blk);
|
mmc->erase_grp_size : (blkcnt - blk);
|
||||||
|
}
|
||||||
err = mmc_erase_t(mmc, start + blk, blk_r);
|
err = mmc_erase_t(mmc, start + blk, blk_r);
|
||||||
if (err)
|
if (err)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue