forked from len0rd/rockbox
Implement udelay() for S5L870x. Exchange sleep() with udelay() during CPU voltage scaling. Voltage scaling was measured stable with 50us delay, to have some headroom we use 100us.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28606 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d1302940b9
commit
e464656b88
2 changed files with 8 additions and 1 deletions
|
@ -22,6 +22,7 @@
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
#include "system-target.h"
|
||||||
#ifdef IPOD_NANO2G
|
#ifdef IPOD_NANO2G
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
#include "pmu-target.h"
|
#include "pmu-target.h"
|
||||||
|
@ -208,7 +209,7 @@ void set_cpu_frequency(long frequency)
|
||||||
/* Vcore = 1.000V */
|
/* Vcore = 1.000V */
|
||||||
pmu_write(0x1e, 0xf);
|
pmu_write(0x1e, 0xf);
|
||||||
/* Allow for voltage to stabilize */
|
/* Allow for voltage to stabilize */
|
||||||
sleep(HZ / 100);
|
udelay(100);
|
||||||
/* FCLK_CPU = PLL0, HCLK = PLL0 / 2 */
|
/* FCLK_CPU = PLL0, HCLK = PLL0 / 2 */
|
||||||
CLKCON = (CLKCON & ~0xFF00FF00) | 0x20003100;
|
CLKCON = (CLKCON & ~0xFF00FF00) | 0x20003100;
|
||||||
/* PCLK = HCLK / 2 */
|
/* PCLK = HCLK / 2 */
|
||||||
|
|
|
@ -38,4 +38,10 @@
|
||||||
#define inw(a) (*(volatile unsigned short *) (a))
|
#define inw(a) (*(volatile unsigned short *) (a))
|
||||||
#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
|
#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
|
||||||
|
|
||||||
|
static inline void udelay(unsigned usecs)
|
||||||
|
{
|
||||||
|
unsigned stop = USEC_TIMER + usecs;
|
||||||
|
while (TIME_BEFORE(USEC_TIMER, stop));
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* SYSTEM_TARGET_H */
|
#endif /* SYSTEM_TARGET_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue