From d414b0a02712f2a591fda47e9f892763b77114b9 Mon Sep 17 00:00:00 2001 From: Jack Halpin Date: Thu, 3 Dec 2009 20:06:40 +0000 Subject: Sansa AMS: Reduce MCICLK speed on SD cards to 31 MHz. This is within the SD Spec for v2 High Speed cards but still over the 25 MHz limit for v1 and non-HS v2 cards. Test_disk write & verify passes on both internal and uSD. The v1 cards still need to be lowered to 15 MHz but that causes data crc failures at this point. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23835 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/ata_sd_as3525.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'firmware/target/arm/as3525') diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index 17f7583f44..e04e439964 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c @@ -312,8 +312,8 @@ static int sd_init_card(const int drive) /* End of Card Identification Mode ************************************/ - /* Boost MCICLK to operating speed */ /* FIXME: 50 MHz is spec limit */ - MCI_CLOCK(drive) = (sd_v2 ? MCI_FULLSPEED : MCI_FULLSPEED); + /* Boost MCICLK to operating speed */ /*FIXME: v1 at 31 MHz still too high*/ + MCI_CLOCK(drive) = (sd_v2 ? MCI_HALFSPEED : MCI_HALFSPEED); #ifdef HAVE_MULTIDRIVE /* The internal SDs are v1 */ @@ -741,12 +741,19 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, (1<<3) /* DMA */ | (9<<4) /* 2^9 = 512 */ ; - wakeup_wait(&transfer_completion_signal, TIMEOUT_BLOCK); /* Wait for FIFO to empty, card may still be in PRG state for writes */ while(MCI_STATUS(drive) & MCI_TX_ACTIVE); + last_disk_activity = current_tick; + + if(!send_cmd(drive, SD_STOP_TRANSMISSION, 0, MCI_NO_FLAGS, NULL)) + { + ret = -4*20; + goto sd_transfer_error; + } + if(!transfer_error[drive]) { if(!write) @@ -759,14 +766,6 @@ static int sd_transfer_sectors(IF_MD2(int drive,) unsigned long start, else if(loops++ > PL180_MAX_TRANSFER_ERRORS) panicf("SD Xfer %s err:0x%x Disk%d", (write? "write": "read"), transfer_error[drive], drive); - - last_disk_activity = current_tick; - - if(!send_cmd(drive, SD_STOP_TRANSMISSION, 0, MCI_NO_FLAGS, NULL)) - { - ret = -4*20; - goto sd_transfer_error; - } } ret = 0; /* success */ -- cgit v1.2.3