diff options
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/as3525/ata_sd_as3525.c | 21 | ||||
-rw-r--r-- | firmware/target/arm/as3525/system-as3525.c | 7 |
2 files changed, 24 insertions, 4 deletions
diff --git a/firmware/target/arm/as3525/ata_sd_as3525.c b/firmware/target/arm/as3525/ata_sd_as3525.c index 92dc0b746b..57dc307e7f 100644 --- a/firmware/target/arm/as3525/ata_sd_as3525.c +++ b/firmware/target/arm/as3525/ata_sd_as3525.c | |||
@@ -812,6 +812,11 @@ void sd_enable(bool on) | |||
812 | #if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE) | 812 | #if defined(HAVE_BUTTON_LIGHT) && defined(HAVE_MULTIDRIVE) |
813 | extern int buttonlight_is_on; | 813 | extern int buttonlight_is_on; |
814 | #endif | 814 | #endif |
815 | |||
816 | #ifdef HAVE_HOTSWAP | ||
817 | static bool cpu_boosted = false; | ||
818 | #endif | ||
819 | |||
815 | if (sd_enabled == on) | 820 | if (sd_enabled == on) |
816 | return; /* nothing to do */ | 821 | return; /* nothing to do */ |
817 | if(on) | 822 | if(on) |
@@ -830,6 +835,14 @@ void sd_enable(bool on) | |||
830 | CGU_IDE |= (1<<7) /* AHB interface enable */ | | 835 | CGU_IDE |= (1<<7) /* AHB interface enable */ | |
831 | (1<<6) /* interface enable */; | 836 | (1<<6) /* interface enable */; |
832 | sd_enabled = true; | 837 | sd_enabled = true; |
838 | |||
839 | #ifdef HAVE_HOTSWAP | ||
840 | if(card_detect_target()) /* If SD card present Boost cpu for voltage */ | ||
841 | { | ||
842 | cpu_boosted = true; | ||
843 | cpu_boost(true); | ||
844 | } | ||
845 | #endif | ||
833 | } | 846 | } |
834 | else | 847 | else |
835 | { | 848 | { |
@@ -844,6 +857,14 @@ void sd_enable(bool on) | |||
844 | #endif /* HAVE_MULTIDRIVE */ | 857 | #endif /* HAVE_MULTIDRIVE */ |
845 | CGU_IDE &= ~((1<<7)|(1<<6)); | 858 | CGU_IDE &= ~((1<<7)|(1<<6)); |
846 | sd_enabled = false; | 859 | sd_enabled = false; |
860 | |||
861 | #ifdef HAVE_HOTSWAP | ||
862 | if(cpu_boosted) | ||
863 | { | ||
864 | cpu_boost(false); | ||
865 | cpu_boosted = false; | ||
866 | } | ||
867 | #endif | ||
847 | } | 868 | } |
848 | } | 869 | } |
849 | 870 | ||
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index d68f2c4f00..ba817b4ad3 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -335,14 +335,13 @@ void set_cpu_frequency(long frequency) | |||
335 | { | 335 | { |
336 | if(frequency == CPUFREQ_MAX) | 336 | if(frequency == CPUFREQ_MAX) |
337 | { | 337 | { |
338 | #ifdef HAVE_ADJUSTABLE_CPU_VOLTAGE | ||
339 | /* Increasing frequency so boost voltage before change */ | 338 | /* Increasing frequency so boost voltage before change */ |
340 | ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_20)); | 339 | ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_20)); |
341 | 340 | ||
342 | /* Wait for voltage to be at least 1.20v before making fclk > 200 MHz */ | 341 | /* Wait for voltage to be at least 1.20v before making fclk > 200 MHz */ |
343 | while(adc_read(ADC_CVDD) < 480) /* 480 * .0025 = 1.20V */ | 342 | while(adc_read(ADC_CVDD) < 480) /* 480 * .0025 = 1.20V */ |
344 | ; | 343 | ; |
345 | #endif | 344 | |
346 | asm volatile( | 345 | asm volatile( |
347 | "mrc p15, 0, r0, c1, c0 \n" | 346 | "mrc p15, 0, r0, c1, c0 \n" |
348 | 347 | ||
@@ -365,10 +364,10 @@ void set_cpu_frequency(long frequency) | |||
365 | "bic r0, r0, #3<<30 \n" /* fastbus clocking */ | 364 | "bic r0, r0, #3<<30 \n" /* fastbus clocking */ |
366 | "mcr p15, 0, r0, c1, c0 \n" | 365 | "mcr p15, 0, r0, c1, c0 \n" |
367 | : : : "r0" ); | 366 | : : : "r0" ); |
368 | #ifdef HAVE_ADJUSTABLE_CPU_VOLTAGE | 367 | |
369 | /* Decreasing frequency so reduce voltage after change */ | 368 | /* Decreasing frequency so reduce voltage after change */ |
370 | ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_10)); | 369 | ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_10)); |
371 | #endif | 370 | |
372 | cpu_frequency = CPUFREQ_NORMAL; | 371 | cpu_frequency = CPUFREQ_NORMAL; |
373 | } | 372 | } |
374 | } | 373 | } |