Improve read performance of generic mmc.
PATCH 1/1 Improve read performance of generic mmc.
In drivers/mmc/mmc.c, mmc_bread will do aligned read. So we don't need to use single block read.
We can use multiblock read to improve the performance.
Signed-off-by Terry Lv <[email protected]>
--- drivers/mmc/mmc.c | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 40 insertions(+), 11 deletions(-)
drivers/mmc/mmc.c +40 -11
@@ -205,27 +205,56 @@ free_buffer:static ulong mmc_bread (int dev_num,ulong start,lbaint_t blkcnt,void *dst) { +struct mmc_cmd cmd; +struct mmc_data data;int err; -int i; +int stoperr =0 ;struct mmc *mmc =find_mmc_device (dev_num); +int blklen;if (!mmc) -return 0 ; +return -1 ; -/* We always do full block reads from the card */ - err =mmc_set_blocklen (mmc, mmc->read_bl_len); + blklen = mmc->read_bl_len; + + err =mmc_set_blocklen (mmc, blklen);if (err) { -return 0 ; +printf ("set read bl len failed\n\r" ); +return err; } -for (i = start; i < start + blkcnt; i++, dst += mmc->read_bl_len) { - err =mmc_read_block (mmc, dst, i); +if (blkcnt >1 ) + cmd.cmdidx =MMC_CMD_READ_MULTIPLE_BLOCK ; +else + cmd.cmdidx =MMC_CMD_READ_SINGLE_BLOCK ; -if (err) { -printf ("block read failed: %d\n" , err); -return i - start; - } +if (mmc->high_capacity) + cmd.cmdarg = start; +else + cmd.cmdarg = start * blklen; + + cmd.resp_type =MMC_RSP_R1 ; + cmd.flags =0 ; + + data.dest = dst; + data.blocks = blkcnt; + data.blocksize = blklen; + data.flags =MMC_DATA_READ ; + + err =mmc_send_cmd (mmc, &cmd, &data); + +if (err) { +printf ("mmc read failed\n\r" ); +return err; + } + +if (blkcnt >1 ) { + cmd.cmdidx =MMC_CMD_STOP_TRANSMISSION ; + cmd.cmdarg =0 ; + cmd.resp_type = MMC_RSP_R1b; + cmd.flags =0 ; + stoperr =mmc_send_cmd (mmc, &cmd,NULL ); }return blkcnt;
Signature · 1 line
1.6.0.4
PATCH 1/1 Improve read performance of generic mmc.
Dear Andy,
Quoted 8 lines · In message <[email protected]> Terry Lv wrote:
In
drivers/mmc/mmc.c,mmc_breadwill do aligned read. So we don't need to use single block read.
We can use multiblock read to improve the performance.Signed-off-by Terry Lv <[email protected]>--- drivers/mmc/mmc.c | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 40 insertions(+), 11 deletions(-)
What's the state of this?
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is is no reason for any individual to have a computer in their
home. -- Ken Olsen (President of Digital Equipment Corporation),
Convention of the World Future Society, in Boston, 1977