as3525v2: set_cpu_frequency()
delay a bit after changing pclk/fclk tiny refactoring git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25571 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
31959e78d0
commit
07c08a6d89
1 changed files with 14 additions and 8 deletions
|
@ -433,35 +433,41 @@ void set_cpu_frequency(long frequency)
|
|||
#else /* as3525v2 */
|
||||
void set_cpu_frequency(long frequency)
|
||||
{
|
||||
int oldstatus = disable_irq_save();
|
||||
int delay;
|
||||
|
||||
if(frequency == CPUFREQ_MAX)
|
||||
{
|
||||
int oldstatus = disable_irq_save();
|
||||
/* Change PCLK while FCLK is low, so it doesn't go too high */
|
||||
CGU_PERI = (CGU_PERI & ~(0x1F << 2)) | (AS3525_PCLK_DIV0 << 2);
|
||||
|
||||
delay = 40; while(delay--) ;
|
||||
|
||||
CGU_PROC = ((AS3525_FCLK_POSTDIV << 4) |
|
||||
(AS3525_FCLK_PREDIV << 2) |
|
||||
AS3525_FCLK_SEL);
|
||||
|
||||
restore_irq(oldstatus);
|
||||
delay = 40; while(delay--) ;
|
||||
|
||||
cpu_frequency = CPUFREQ_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
int oldstatus = disable_irq_save();
|
||||
frequency = CPUFREQ_NORMAL; /* We only have 2 settings */
|
||||
|
||||
CGU_PROC = ((AS3525_FCLK_POSTDIV_UNBOOSTED << 4) |
|
||||
(AS3525_FCLK_PREDIV << 2) |
|
||||
AS3525_FCLK_SEL);
|
||||
|
||||
delay = 40; while(delay--) ;
|
||||
|
||||
/* Change PCLK after FCLK is low, so it doesn't go too high */
|
||||
CGU_PERI = (CGU_PERI & ~(0x1F << 2)) | (AS3525_PCLK_DIV0_UNBOOSTED << 2);
|
||||
|
||||
restore_irq(oldstatus);
|
||||
|
||||
cpu_frequency = CPUFREQ_NORMAL;
|
||||
delay = 40; while(delay--) ;
|
||||
}
|
||||
|
||||
cpu_frequency = frequency;
|
||||
|
||||
restore_irq(oldstatus);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue