From e9cd0f1c7aaa0443a3a2a33161fadf838862eda2 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Sun, 21 Feb 2010 22:01:37 +0000 Subject: sd-as3525v2: no limits on the amount of sectors to transfer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24832 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/sd-as3525v2.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index 96c615a2be..27c73720b6 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c @@ -651,25 +651,19 @@ static int sd_transfer_sectors(unsigned long start, int count, void* buf, bool w dma_retain(); - while(count) - { - /* Interrupt handler might set this to true during transfer */ - retry = false; - /* 128 * 512 = 2^16, and doesn't fit in the 16 bits of DATA_LENGTH - * register, so we have to transfer maximum 127 sectors at a time. */ - //unsigned int transfer = (count >= 128) ? 127 : count; /* sectors */ - unsigned int transfer = count; - - const int cmd = - write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK; + const int cmd = write ? SD_WRITE_MULTIPLE_BLOCK : SD_READ_MULTIPLE_BLOCK; + /* Interrupt handler might set this to true during transfer */ + retry = false; + do + { MCI_CTRL |= FIFO_RESET; while(MCI_CTRL & FIFO_RESET) ; //MCI_BLKSIZ = 512; - MCI_BYTCNT = transfer * 512; + MCI_BYTCNT = count * 512; MCI_CTRL |= FIFO_RESET; while(MCI_CTRL & FIFO_RESET) @@ -708,13 +702,6 @@ static int sd_transfer_sectors(unsigned long start, int count, void* buf, bool w printf("dma <-"); int delay = 0x1000000; while(delay--) ; - if(!retry) - { - buf += transfer * SECTOR_SIZE; - start += transfer; - count -= transfer; - } - last_disk_activity = current_tick; if(!send_cmd(SD_STOP_TRANSMISSION, 0, MCI_NO_RESP, NULL)) @@ -730,7 +717,7 @@ static int sd_transfer_sectors(unsigned long start, int count, void* buf, bool w panicf(" wait for state TRAN failed (%d)", ret); goto sd_transfer_error; } - } + } while(retry); dma_release(); -- cgit v1.2.3