summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-11-15 21:13:58 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-11-15 21:13:58 +0000
commite464656b8867850bb0bf152e3c9911296e494831 (patch)
treeea31ecf361ae924105f4eef08815041b8e1d0e86
parentd1302940b9b173a37d89c4651d9ddf8495bb8131 (diff)
downloadrockbox-e464656b8867850bb0bf152e3c9911296e494831.tar.gz
rockbox-e464656b8867850bb0bf152e3c9911296e494831.zip
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
-rw-r--r--firmware/target/arm/s5l8700/system-s5l8700.c3
-rw-r--r--firmware/target/arm/s5l8700/system-target.h6
2 files changed, 8 insertions, 1 deletions
diff --git a/firmware/target/arm/s5l8700/system-s5l8700.c b/firmware/target/arm/s5l8700/system-s5l8700.c
index e35da90617..72b0caf6db 100644
--- a/firmware/target/arm/s5l8700/system-s5l8700.c
+++ b/firmware/target/arm/s5l8700/system-s5l8700.c
@@ -22,6 +22,7 @@
#include "kernel.h"
#include "system.h"
#include "panic.h"
+#include "system-target.h"
#ifdef IPOD_NANO2G
#include "storage.h"
#include "pmu-target.h"
@@ -208,7 +209,7 @@ void set_cpu_frequency(long frequency)
/* Vcore = 1.000V */
pmu_write(0x1e, 0xf);
/* Allow for voltage to stabilize */
- sleep(HZ / 100);
+ udelay(100);
/* FCLK_CPU = PLL0, HCLK = PLL0 / 2 */
CLKCON = (CLKCON & ~0xFF00FF00) | 0x20003100;
/* PCLK = HCLK / 2 */
diff --git a/firmware/target/arm/s5l8700/system-target.h b/firmware/target/arm/s5l8700/system-target.h
index 774b53ac23..adc0eb6bfe 100644
--- a/firmware/target/arm/s5l8700/system-target.h
+++ b/firmware/target/arm/s5l8700/system-target.h
@@ -38,4 +38,10 @@
#define inw(a) (*(volatile unsigned short *) (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 */