forked from len0rd/rockbox
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
This commit is contained in:
parent
66f011e8c1
commit
0466a11028
1 changed files with 8 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue