summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/ata_sd_as3525.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/ata_sd_as3525.c')
-rw-r--r--firmware/target/arm/as3525/ata_sd_as3525.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c
index 7567ac498d..65df027c30 100644
--- a/firmware/target/arm/as3525/ata_sd_as3525.c
+++ b/firmware/target/arm/as3525/ata_sd_as3525.c
@@ -103,17 +103,9 @@ static void init_pl180_controller(const int drive);
103 103
104static tCardInfo card_info[NUM_DRIVES]; 104static tCardInfo card_info[NUM_DRIVES];
105 105
106#ifdef HAVE_MULTIDRIVE 106/* maximum timeouts recommanded in the SD Specification v2.00 */
107/* maximum timeouts recommended in the SD Specification v2.00 */ 107#define SD_MAX_READ_TIMEOUT ((AS3525_PCLK_FREQ) / 1000 * 100) /* 100 ms */
108#define SD_MAX_READ_TIMEOUT (((drive == SD_SLOT_AS3525)? (AS3525_PCLK_FREQ): \ 108#define SD_MAX_WRITE_TIMEOUT ((AS3525_PCLK_FREQ) / 1000 * 250) /* 250 ms */
109 (AS3525_IDE_FREQ)) / 1000 * 100) /* 100 ms */
110#define SD_MAX_WRITE_TIMEOUT (((drive == SD_SLOT_AS3525)? (AS3525_PCLK_FREQ): \
111 (AS3525_IDE_FREQ)) / 1000 * 250) /* 250 ms */
112#else
113/* maximum timeouts recommended in the SD Specification v2.00 */
114#define SD_MAX_READ_TIMEOUT ((AS3525_IDE_FREQ) / 1000 * 100) /* 100 ms */
115#define SD_MAX_WRITE_TIMEOUT ((AS3525_IDE_FREQ) / 1000 * 250) /* 250 ms */
116#endif
117 109
118/* for compatibility */ 110/* for compatibility */
119static long last_disk_activity = -1; 111static long last_disk_activity = -1;
@@ -314,7 +306,7 @@ static int sd_init_card(const int drive)
314 /* End of Card Identification Mode ************************************/ 306 /* End of Card Identification Mode ************************************/
315 307
316 308
317 /* full speed for controller clock MCICLK = MCLK = PCLK = IDECLK = 62 MHz */ 309 /* full speed for controller clock MCICLK = MCLK = PCLK = 62 MHz */
318 MCI_CLOCK(drive) |= MCI_CLOCK_BYPASS; /* FIXME: 50 MHz is spec limit */ 310 MCI_CLOCK(drive) |= MCI_CLOCK_BYPASS; /* FIXME: 50 MHz is spec limit */
319 mci_delay(); 311 mci_delay();
320 312
@@ -620,7 +612,7 @@ static int sd_select_bank(signed char bank)
620 DMA_PERI_SD, DMAC_FLOWCTRL_PERI_MEM_TO_PERI, true, false, 0, DMA_S8, 612 DMA_PERI_SD, DMAC_FLOWCTRL_PERI_MEM_TO_PERI, true, false, 0, DMA_S8,
621 NULL); 613 NULL);
622 614
623 MCI_DATA_TIMER(INTERNAL_AS3525) = ((AS3525_IDE_FREQ) / 1000 * 250) /* 250 ms */; 615 MCI_DATA_TIMER(INTERNAL_AS3525) = SD_MAX_WRITE_TIMEOUT;
624 MCI_DATA_LENGTH(INTERNAL_AS3525) = 512; 616 MCI_DATA_LENGTH(INTERNAL_AS3525) = 512;
625 MCI_DATA_CTRL(INTERNAL_AS3525) = (1<<0) /* enable */ | 617 MCI_DATA_CTRL(INTERNAL_AS3525) = (1<<0) /* enable */ |
626 (0<<1) /* transfer direction */ | 618 (0<<1) /* transfer direction */ |