Index: firmware/target/arm/as3525/system-as3525.c =================================================================== --- firmware/target/arm/as3525/system-as3525.c (revision 21563) +++ firmware/target/arm/as3525/system-as3525.c (working copy) @@ -35,6 +35,20 @@ #define default_interrupt(name) \ extern __attribute__((weak,alias("UIRQ"))) void name (void) + +#define AS3525_POWER \ + ((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 V_1_20 0 +#define V_1_15 1 +#define V_1_10 2 +#define V_1_05 3 + void irq_handler(void) __attribute__((interrupt ("IRQ"), naked)); void fiq_handler(void) __attribute__((interrupt ("FIQ"), naked)); @@ -271,7 +285,6 @@ 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,9 +308,8 @@ 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, AS3525_POWER); #ifdef CONFIG_TUNER fmradio_i2c_init(); @@ -331,6 +343,11 @@ { if(frequency == CPUFREQ_MAX) { + /* Increasing frequency so boost voltage before change */ + ascodec_write(AS3514_CVDD_DCDC3, (AS3525_POWER | V_1_20)); + /* Confirm voltage is at least 1.20v before making fclk > 200 MHz */ + while (ascodec_read(AS3514_ADC_1) < 224); /* 480 *.0025 = 1.20 */ + /* 224 is value for 8LSB's of 480 */ asm volatile( "mrc p15, 0, r0, c1, c0 \n" @@ -355,6 +372,9 @@ "mcr p15, 0, r0, c1, c0 \n" : : : "r0" ); + /* Decreasing frequency so reduce voltage after change */ + ascodec_write(AS3514_CVDD_DCDC3, (AS3525_POWER | V_1_10)); + cpu_frequency = CPUFREQ_NORMAL; } }