From eabeb928ddfdbe5fc6379efb87d9522803310649 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Fri, 3 Jul 2009 21:34:40 +0000 Subject: Ingenic Jz4740: add basic frequency switching git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21625 a1c6a512-1295-4272-9138-f99709370657 --- .../target/mips/ingenic_jz47xx/system-jz4740.c | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'firmware/target/mips/ingenic_jz47xx/system-jz4740.c') diff --git a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c index c0a9bf19aa..978675825c 100644 --- a/firmware/target/mips/ingenic_jz47xx/system-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/system-jz4740.c @@ -541,10 +541,11 @@ void system_reboot(void) void system_exception_wait(void) { /* check for power button without including any .h file */ - while (1) + while(1) { - if( ~REG_GPIO_PXPIN(3) & (1 << 29) ) - break; + if( (~REG_GPIO_PXPIN(3)) & (1 << 29) ) + return; + asm volatile("nop"); } } @@ -574,3 +575,19 @@ int system_memory_guard(int newmode) (void)newmode; return 0; } + +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +void set_cpu_frequency(long frequency) +{ + unsigned long cfcr = REG_CPM_CPCCR; + cfcr &= ~CPM_CPCCR_CDIV_MASK; + + if(frequency == CPUFREQ_NORMAL) + cfcr |= (0 << CPM_CPCCR_CDIV_BIT); + else + cfcr |= (2 << CPM_CPCCR_CDIV_BIT); + + REG_CPM_CPCCR = cfcr; + cpu_frequency = frequency; +} +#endif -- cgit v1.2.2