summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sd-as3525v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sd-as3525v2.c')
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index b512cc2ea4..d27df5289c 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -488,7 +488,7 @@ static int sd_init_card(const int drive)
488 card_info[drive].initialized = 0; 488 card_info[drive].initialized = 0;
489 card_info[drive].rca = 0; 489 card_info[drive].rca = 0;
490 490
491 /* assume 24 MHz clock / 60 = 400 kHz */ 491 /* assume 24 MHz clock / (2x)60 = 200 kHz */
492 MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */ 492 MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */
493 493
494 /* 100 - 400kHz clock required for Identification Mode */ 494 /* 100 - 400kHz clock required for Identification Mode */
@@ -957,3 +957,27 @@ int sd_event(long id, intptr_t data)
957 957
958 return rc; 958 return rc;
959} 959}
960
961#if defined(CONFIG_POWER_SAVING) && (CONFIG_POWER_SAVING & POWERSV_DISK)
962/* declared in system-as3525.c */
963void ams_sd_set_low_speed(bool slow)
964{
965 /* block access while speed is changed */
966 mutex_lock(&sd_mtx);
967 enable_controller(true);
968 if (slow)
969 {
970 CGU_SDSLOT = (CGU_SDSLOT & ~(0xF << 2)) | (AS3525_SDSLOT_DIV_MAX << 2);
971 /* power save is enabled for the sd card(s) ASSUMES CRD0 is int drive! */
972 MCI_CLKENA |= (CCLK_LP_CRD1 | CCLK_LP_CRD2 | CCLK_LP_CRD3);
973 }
974 else
975 {
976 /* Full Speed */
977 CGU_SDSLOT = (CGU_SDSLOT & ~(0xF << 2)) | (AS3525_SDSLOT_DIV << 2);
978 MCI_CLKENA = (MCI_CLKENA & ~(CCLK_LP_CRD1 | CCLK_LP_CRD2 | CCLK_LP_CRD3));
979 }
980 enable_controller(false);
981 mutex_unlock(&sd_mtx);
982}
983#endif