]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
pxa: fixing get_timer to return time in miliseconds.
authorMicha Kalfon <smichak.uv@gmail.com>
Wed, 11 Feb 2009 17:50:11 +0000 (19:50 +0200)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Fri, 20 Feb 2009 02:24:08 +0000 (03:24 +0100)
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>
16 files changed:
cpu/pxa/interrupts.c
include/configs/cerf250.h
include/configs/cradle.h
include/configs/csb226.h
include/configs/delta.h
include/configs/innokom.h
include/configs/logodl.h
include/configs/lubbock.h
include/configs/pleb2.h
include/configs/pxa255_idp.h
include/configs/trizepsiv.h
include/configs/wepep250.h
include/configs/xaeniax.h
include/configs/xm250.h
include/configs/xsengine.h
include/configs/zylonite.h

index ec8fb9e3d7dccd3e4f398914b63245ac999e73da..40d8bf251faed579ecc4dfaafa61fb320cfe4f2c 100644 (file)
 #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;
 }
index 71e5b58ddba7ea0f71e5fa45d1c4449fff096cd8..f19374e30cb336c5a625f79502888859916dd365 100644 (file)
 
 #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 }
index e80504a09ffc20bfbd03e074b3220e514cd075e3..5131175045fb98aaa2fb5b179d2188ab29353d29 100644 (file)
 
 #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 */
index 15635288e38d254da55ca9c7c2b2dd42f7e12683..d65c14a672a1fa2213c85feb007eeae53d144ddf 100644 (file)
                                                /* 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 */
index 8cbeb9a5e200ca59bfadc682b970279ce81c58fc..9f7f0ffba3674bc9fc3566a95079ff62f6d58901 100644 (file)
 
 #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 */
index 45e22bfc4902b059a6f5db16b778520f42852f8a..d9b155548a7a9772fdccb243521fc071b6d0fa5d 100644 (file)
 
 #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 */
index 8644cb08a66b072d1302d62dff3e276a056769f3..cd105da313afd49647406d484a3303528c593204 100644 (file)
 
 #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 */
index 208910eb9447f5b06b6eb3ed5a8c85a1d3319955..80cf44fd60deabb8d55651e1d4360ec60adc202b 100644 (file)
 
 #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 */
index 14f8917a97aba0a298117f4141095e07ef248317..23398e36c97ca77a5b9769ceacceaba9e97cbdad 100644 (file)
 
 #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 */
index f81103b795994a4a76eb32d4096b78649dd0b192..fa53cf445376c273e5b2367d02c75c9020d69067 100644 (file)
 
 #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 */
index 0a8e9941232cd75dbe8eb3374e9f61ae38913a1e..e124be433dcacc13198a9635dc97824d5f138ea9 100644 (file)
 
 #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 */
index b70a53139060fdce94badb6edd8eded9bf861ebd..d0afd29c32e15026f091cd4f5701d5d874a4951c 100644 (file)
@@ -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 }
index 324f03e24c51a4bf4d587cfcbe91b0924e431ad2..250247c5ccfdbaef8ed2eea6dc73b333c3482ed9 100644 (file)
 
 #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 */
 
 /*
index 16af845001edf374d5eb83224ee4f9370c3247f7..8e9d5ab7b31e92f61f8a19b9e21d7a69003c0e02 100644 (file)
 
 #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 */
index b72741375349df7c0e2dd747c261cfb6b0ac51f2..2fca956731dbbbb7be71764e3dbf1e509be13eb7 100644 (file)
 #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 */
index 31ea4ca3171cd8663e89688d4ef29259e41743e0..58f35a9dd8d64fdd30affbf6ba6efa17208b35a2 100644 (file)
 
 #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 */