summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicha Kalfon <smichak.uv@gmail.com>2009-02-11 19:50:11 +0200
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2009-02-20 03:24:08 +0100
commit94a3312920b6f9b5da27309549fb73650718c10a (patch)
tree9999ba7c12e606405953d549c842130044322c9f
parente5e88c3614b79b54719905f66aefb51f9494bc1f (diff)
downloadu-boot-imx-94a3312920b6f9b5da27309549fb73650718c10a.zip
u-boot-imx-94a3312920b6f9b5da27309549fb73650718c10a.tar.gz
u-boot-imx-94a3312920b6f9b5da27309549fb73650718c10a.tar.bz2
pxa: fixing get_timer to return time in miliseconds.
Fixing the get_timer function to return time in miliseconds instead of ticks. Also fixed PXA boards to use the conventional value of 1000 for CONFIG_SYS_HZ. Signed-off-by: Micha Kalfon <smichak.uv@gmail.com>
-rw-r--r--cpu/pxa/interrupts.c25
-rw-r--r--include/configs/cerf250.h2
-rw-r--r--include/configs/cradle.h2
-rw-r--r--include/configs/csb226.h2
-rw-r--r--include/configs/delta.h2
-rw-r--r--include/configs/innokom.h2
-rw-r--r--include/configs/logodl.h2
-rw-r--r--include/configs/lubbock.h2
-rw-r--r--include/configs/pleb2.h2
-rw-r--r--include/configs/pxa255_idp.h2
-rw-r--r--include/configs/trizepsiv.h2
-rw-r--r--include/configs/wepep250.h2
-rw-r--r--include/configs/xaeniax.h2
-rw-r--r--include/configs/xm250.h2
-rw-r--r--include/configs/xsengine.h5
-rw-r--r--include/configs/zylonite.h2
16 files changed, 33 insertions, 25 deletions
diff --git a/cpu/pxa/interrupts.c b/cpu/pxa/interrupts.c
index ec8fb9e..40d8bf2 100644
--- a/cpu/pxa/interrupts.c
+++ b/cpu/pxa/interrupts.c
@@ -33,6 +33,14 @@
#error: interrupts not implemented yet
#endif
+#if defined(CONFIG_PXA27X) || defined(CONFIG_CPU_MONAHANS)
+#define TIMER_FREQ_HZ 3250000
+#elif defined(CONFIG_PXA250)
+#define TIMER_FREQ_HZ 3686400
+#else
+#error "Timer frequency unknown - please config PXA CPU type"
+#endif
+
int interrupt_init (void)
{
/* nothing happens here - we don't setup any IRQs */
@@ -67,7 +75,10 @@ void reset_timer_masked (void)
ulong get_timer_masked (void)
{
- return OSCR;
+ unsigned long long ticks = get_ticks();
+
+ return (((ticks / TIMER_FREQ_HZ) * 1000) +
+ ((ticks % TIMER_FREQ_HZ) * 1000) / TIMER_FREQ_HZ);
}
void udelay_masked (unsigned long usec)
@@ -78,17 +89,17 @@ void udelay_masked (unsigned long usec)
if (usec >= 1000) {
tmo = usec / 1000;
- tmo *= CONFIG_SYS_HZ;
+ tmo *= TIMER_FREQ_HZ;
tmo /= 1000;
} else {
- tmo = usec * CONFIG_SYS_HZ;
+ tmo = usec * TIMER_FREQ_HZ;
tmo /= (1000*1000);
}
- endtime = get_timer_masked () + tmo;
+ endtime = get_ticks() + tmo;
do {
- ulong now = get_timer_masked ();
+ ulong now = get_ticks();
diff = endtime - now;
} while (diff >= 0);
}
@@ -99,7 +110,7 @@ void udelay_masked (unsigned long usec)
*/
unsigned long long get_ticks(void)
{
- return get_timer(0);
+ return OSCR;
}
/*
@@ -109,6 +120,6 @@ unsigned long long get_ticks(void)
ulong get_tbclk (void)
{
ulong tbclk;
- tbclk = CONFIG_SYS_HZ;
+ tbclk = TIMER_FREQ_HZ;
return tbclk;
}
diff --git a/include/configs/cerf250.h b/include/configs/cerf250.h
index 71e5b58..f19374e 100644
--- a/include/configs/cerf250.h
+++ b/include/configs/cerf250.h
@@ -117,7 +117,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa2000000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 400/200/100 MHz */
#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
diff --git a/include/configs/cradle.h b/include/configs/cradle.h
index e80504a..5131175 100644
--- a/include/configs/cradle.h
+++ b/include/configs/cradle.h
@@ -103,7 +103,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa2000000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 200/200/100 MHz */
/* valid baudrates */
diff --git a/include/configs/csb226.h b/include/configs/csb226.h
index 1563528..d65c14a 100644
--- a/include/configs/csb226.h
+++ b/include/configs/csb226.h
@@ -131,7 +131,7 @@
/* RS: is this where U-Boot is */
/* RS: relocated to in RAM? */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
/* RS: the oscillator is actually 3680130?? */
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 200/200/100 MHz */
/* 0101000001 */
diff --git a/include/configs/delta.h b/include/configs/delta.h
index 8cbeb9a..9f7f0ff 100644
--- a/include/configs/delta.h
+++ b/include/configs/delta.h
@@ -171,7 +171,7 @@
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_DRAM_BASE + 0x8000) /* default load address */
-#define CONFIG_SYS_HZ 3250000 /* incrementer freq: 3.25 MHz */
+#define CONFIG_SYS_HZ 1000
/* Monahans Core Frequency */
#define CONFIG_SYS_MONAHANS_RUN_MODE_OSC_RATIO 16 /* valid values: 8, 16, 24, 31 */
diff --git a/include/configs/innokom.h b/include/configs/innokom.h
index 45e22bf..d9b1555 100644
--- a/include/configs/innokom.h
+++ b/include/configs/innokom.h
@@ -119,7 +119,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa3000000 /* load kernel to this address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
/* RS: the oscillator is actually 3680130?? */
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 200/200/100 MHz */
diff --git a/include/configs/logodl.h b/include/configs/logodl.h
index 8644cb0..cd105da 100644
--- a/include/configs/logodl.h
+++ b/include/configs/logodl.h
@@ -112,7 +112,7 @@
#define CONFIG_SYS_LOAD_ADDR 0x08000000 /* load kernel to this address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
/* RS: the oscillator is actually 3680130?? */
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 200/200/100 MHz */
diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h
index 208910e..80cf44f 100644
--- a/include/configs/lubbock.h
+++ b/include/configs/lubbock.h
@@ -127,7 +127,7 @@
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_DRAM_BASE + 0x8000) /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x161 /* set core clock to 400/200/100 MHz */
/* valid baudrates */
diff --git a/include/configs/pleb2.h b/include/configs/pleb2.h
index 14f8917..23398e3 100644
--- a/include/configs/pleb2.h
+++ b/include/configs/pleb2.h
@@ -126,7 +126,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa2000000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 200/200/100 MHz */
/* valid baudrates */
diff --git a/include/configs/pxa255_idp.h b/include/configs/pxa255_idp.h
index f81103b..fa53cf4 100644
--- a/include/configs/pxa255_idp.h
+++ b/include/configs/pxa255_idp.h
@@ -241,7 +241,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa0800000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x161 /* set core clock to 400/200/100 MHz */
#define RTC 1 /* enable 32KHz osc */
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 0a8e994..e124be4 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -168,7 +168,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa1000000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x207 /* need to look more closely, I think this is Turbo = 2x, L=91Mhz */
/* valid baudrates */
diff --git a/include/configs/wepep250.h b/include/configs/wepep250.h
index b70a531..d0afd29 100644
--- a/include/configs/wepep250.h
+++ b/include/configs/wepep250.h
@@ -81,7 +81,7 @@
#undef CONFIG_SYS_CLKS_IN_HZ /* use HZ for freq. display */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x141 /* core clock - register value */
#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
diff --git a/include/configs/xaeniax.h b/include/configs/xaeniax.h
index 324f03e..250247c 100644
--- a/include/configs/xaeniax.h
+++ b/include/configs/xaeniax.h
@@ -138,7 +138,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa1000000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x141 /* set core clock to 400/200/100 MHz */
/*
diff --git a/include/configs/xm250.h b/include/configs/xm250.h
index 16af845..8e9d5ab 100644
--- a/include/configs/xm250.h
+++ b/include/configs/xm250.h
@@ -121,7 +121,7 @@
#define CONFIG_SYS_LOAD_ADDR 0xa3000000 /* default load address */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x161 /* set core clock to 400/400/100 MHz */
/* valid baudrates */
diff --git a/include/configs/xsengine.h b/include/configs/xsengine.h
index b727413..2fca956 100644
--- a/include/configs/xsengine.h
+++ b/include/configs/xsengine.h
@@ -35,10 +35,7 @@
#define CONFIG_DOS_PARTITION 1
#define BOARD_LATE_INIT 1
#undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
-
-#undef CONFIG_USE_IRQ /* we don't need IRQ/FIQ stuff */
-#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */
+#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_CPUSPEED 0x161 /* set core clock to 400/200/100 MHz */
#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */
diff --git a/include/configs/zylonite.h b/include/configs/zylonite.h
index 31ea4ca..58f35a9 100644
--- a/include/configs/zylonite.h
+++ b/include/configs/zylonite.h
@@ -143,7 +143,7 @@
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_DRAM_BASE + 0x8000) /* default load address */
-#define CONFIG_SYS_HZ 3250000 /* incrementer freq: 3.25 MHz */
+#define CONFIG_SYS_HZ 1000
/* Monahans Core Frequency */
#define CONFIG_SYS_MONAHANS_RUN_MODE_OSC_RATIO 16 /* valid values: 8, 16, 24, 31 */