summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorJack Halpin <jack.halpin@gmail.com>2009-06-30 17:56:21 +0000
committerJack Halpin <jack.halpin@gmail.com>2009-06-30 17:56:21 +0000
commite905ca61d4a2d90d9a2fac0ae1b70c55451eaf88 (patch)
tree206e7e775ea159e466322202293d87ae9842a770 /firmware/target/arm
parent8c22a60290bb9727a48c2bde94ab38f18c7e847d (diff)
downloadrockbox-e905ca61d4a2d90d9a2fac0ae1b70c55451eaf88.tar.gz
rockbox-e905ca61d4a2d90d9a2fac0ae1b70c55451eaf88.zip
FS#10344 - AMSSansa Dynamically adjust core voltage to extend playtime.
Lower CVDD core voltage to 1.10 volts when the frequency is less than 200 MHz. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21577 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/ascodec-target.h14
-rw-r--r--firmware/target/arm/as3525/debug-as3525.c6
-rw-r--r--firmware/target/arm/as3525/system-as3525.c17
3 files changed, 30 insertions, 7 deletions
diff --git a/firmware/target/arm/as3525/ascodec-target.h b/firmware/target/arm/as3525/ascodec-target.h
index c31a1bab0c..3464bbaa51 100644
--- a/firmware/target/arm/as3525/ascodec-target.h
+++ b/firmware/target/arm/as3525/ascodec-target.h
@@ -27,6 +27,20 @@
#include "as3514.h"
+/* Charge Pump and Power management Settings */
+#define AS314_CP_DCDC3_SETTING \
+ ((0<<7) | /* CP_SW Auto-Switch Margin 0=200/300 1=150/255 */ \
+ (0<<6) | /* CP_on 0=Normal op 1=Chg Pump Always On */ \
+ (0<<5) | /* LREG_CPnot Always write 0 */ \
+ (0<<3) | /* DCDC3p BVDD setting 3.6/3.2/3.1/3.0 */ \
+ (1<<2) | /* LREG_off 1=Auto mode switching 0=Length Reg only*/\
+ (0<<0) ) /* CVDDp Core Voltage Setting 1.2/1.15/1.10/1.05*/
+
+#define CVDD_1_20 0
+#define CVDD_1_15 1
+#define CVDD_1_10 2
+#define CVDD_1_05 3
+
void ascodec_init(void);
int ascodec_write(unsigned int index, unsigned int value);
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c
index 39f590302d..aade54ca38 100644
--- a/firmware/target/arm/as3525/debug-as3525.c
+++ b/firmware/target/arm/as3525/debug-as3525.c
@@ -28,6 +28,7 @@
#include "sprintf.h"
#include "cpu.h"
#include "pl180.h"
+#include "ascodec-target.h"
#define _DEBUG_PRINTF(a,varargs...) do { \
snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf); \
@@ -280,7 +281,10 @@ bool __dbg_hw_info(void)
_DEBUG_PRINTF("SD :%3dkHz %3dkHz", AS3525_SD_IDENT_FREQ/1000,calc_freq(CLK_SD_IDENT_NAND)/1000);
_DEBUG_PRINTF("MSD :%3dkHz %3dkHz", AS3525_SD_IDENT_FREQ/1000,calc_freq(CLK_SD_IDENT_MSD)/1000);
_DEBUG_PRINTF("USB: %3dMHz", calc_freq(CLK_USB)/1000000);
- _DEBUG_PRINTF("MMU: %s", (read_cp15() & CP15_MMU) ? " op" : "nop");
+ ascodec_write(AS3514_ADC_0, 4<<4); /* ADC Source = CVDD */
+ _DEBUG_PRINTF("MMU: %s CVDDP:%4d", (read_cp15() & CP15_MMU) ? " op" : "nop",
+ ((ascodec_read(AS3514_ADC_1) |
+ ((ascodec_read(AS3514_ADC_0) & 3)<<8)) * 25));
_DEBUG_PRINTF("Icache:%s Dcache:%s",(read_cp15() & CP15_IC) ? " op" : "nop",
(read_cp15() & CP15_DC) ? " op" : "nop");
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index ecb9736f78..b77f3dee9b 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -271,7 +271,6 @@ void system_init(void)
AS3525_PCLK_SEL);
asm volatile(
- "mov r0, #0 \n"
"mrc p15, 0, r0, c1, c0 \n" /* control register */
"bic r0, r0, #3<<30 \n" /* clears bus bits : sets fastbus */
"mcr p15, 0, r0, c1, c0 \n"
@@ -295,10 +294,8 @@ void system_init(void)
ascodec_init();
#ifndef BOOTLOADER
- /* Disable fast hardware power-off, to use power button normally
- * We don't need the power button in the bootloader. */
- ascodec_write(AS3514_CVDD_DCDC3, ascodec_read(AS3514_CVDD_DCDC3) & (1<<2));
-
+ /* Initialize power management settings */
+ ascodec_write(AS3514_CVDD_DCDC3, AS314_CP_DCDC3_SETTING);
#ifdef CONFIG_TUNER
fmradio_i2c_init();
#endif
@@ -331,7 +328,12 @@ void set_cpu_frequency(long frequency)
{
if(frequency == CPUFREQ_MAX)
{
-
+ /* Increasing frequency so boost voltage before change */
+ ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_20));
+ /* Confirm voltage is at least 1.20v before making fclk > 200 MHz */
+ ascodec_write(AS3514_ADC_0, 4<<4); /* ADC Source = CVDD */
+ while (ascodec_read(AS3514_ADC_1) < 0xe0); /* 0x1e0 *.0025 = 1.20 */
+ /* e0 = 8LSB's of 0x1e0 */
asm volatile(
"mrc p15, 0, r0, c1, c0 \n"
@@ -355,6 +357,9 @@ void set_cpu_frequency(long frequency)
"mcr p15, 0, r0, c1, c0 \n"
: : : "r0" );
+ /* Decreasing frequency so reduce voltage after change */
+ ascodec_write(AS3514_CVDD_DCDC3, (AS314_CP_DCDC3_SETTING | CVDD_1_10));
+
cpu_frequency = CPUFREQ_NORMAL;
}
}