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