diff options
author | Jack Halpin <jack.halpin@gmail.com> | 2010-03-24 05:41:25 +0000 |
---|---|---|
committer | Jack Halpin <jack.halpin@gmail.com> | 2010-03-24 05:41:25 +0000 |
commit | 0466a110287b7133e4a3ea60ee68ed009a9e4079 (patch) | |
tree | 381923d4350391958057b8310cc5b8b39e7b3522 /firmware/target/arm/as3525/sd-as3525v2.c | |
parent | 66f011e8c14a416a167e293dc91767ae6eda818c (diff) |
sd-as3525v2.c Don't reset controller on every pass through the transfer loop.
The controller only needs to be reset if we had an error to clean up any leftover trash...
Move comment pertaining to retry variable so it's actually nearby.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25315 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525v2.c')
-rw-r--r-- | firmware/target/arm/as3525/sd-as3525v2.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 1546bcbd30..5db63eef10 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c @@ -758,7 +758,6 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, const int cmd = write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK; - /* Interrupt handler might set this to true during transfer */ do { void *dma_buf = aligned_buffer; @@ -769,15 +768,12 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, if(write) memcpy(uncached_buffer, buf, transfer * SD_BLOCK_SIZE); + /* Interrupt handler might set this to true during transfer */ retry = false; MCI_BLKSIZ = SD_BLOCK_SIZE; MCI_BYTCNT = transfer * SD_BLOCK_SIZE; - MCI_CTRL |= (FIFO_RESET|DMA_RESET); - while(MCI_CTRL & (FIFO_RESET|DMA_RESET)) - ; - ret = sd_wait_for_state(drive, SD_TRAN); if (ret < 0) { @@ -833,6 +829,13 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, start += transfer; count -= transfer; } + else /* reset controller if we had an error */ + { + MCI_CTRL |= (FIFO_RESET|DMA_RESET); + while(MCI_CTRL & (FIFO_RESET|DMA_RESET)) + ; + } + } while(retry || count); dma_release(); |