diff options
author | Peng Fan <van.freenix@gmail.com> | 2016-09-01 11:13:39 +0800 |
---|---|---|
committer | Robby Cai <robby.cai@nxp.com> | 2016-11-16 16:58:55 +0800 |
commit | d1e51f24fa8ea07c0554c02a1c4113c5d32e671a (patch) | |
tree | acd8e4a740d98e80fdf7a92f0280a2ef816f4d11 | |
parent | a9f2abd24d4184d2862b98a5826e84a29a53eb56 (diff) | |
download | u-boot-imx-d1e51f24fa8ea07c0554c02a1c4113c5d32e671a.zip u-boot-imx-d1e51f24fa8ea07c0554c02a1c4113c5d32e671a.tar.gz u-boot-imx-d1e51f24fa8ea07c0554c02a1c4113c5d32e671a.tar.bz2 |
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>
(cherry picked from commit e492dbb41e025ac1a7d7934b1df52b2f0485f8dd)
(cherry picked from commit a9beae5f9be6358036ef328c75bf5b40eaf94581)
-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 79b8c4d..d26c25f 100644 --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c @@ -98,8 +98,13 @@ unsigned long mmc_berase(block_dev_desc_t *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; |