pxa: fixing get_timer to return time in miliseconds.
PATCH 1/1 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.
--- cpu/pxa/interrupts.c | 25 ++++++++++++++++++------- include/configs/cerf250.h | 2 +- include/configs/cradle.h | 2 +- include/configs/csb226.h | 2 +- include/configs/delta.h | 2 +- include/configs/innokom.h | 2 +- include/configs/logodl.h | 2 +- include/configs/lubbock.h | 2 +- include/configs/pleb2.h | 2 +- include/configs/pxa255_idp.h | 2 +- include/configs/trizepsiv.h | 2 +- include/configs/wepep250.h | 2 +- include/configs/xaeniax.h | 2 +- include/configs/xm250.h | 2 +- include/configs/xsengine.h | 5 +---- include/configs/zylonite.h | 2 +- 16 files changed, 33 insertions(+), 25 deletions(-)
cpu/pxa/interrupts.c +18 -7
@@ -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; }
include/configs/cerf250.h +1 -1
@@ -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/* incrementer freq: 3.6864 MHz */ #define CONFIG_SYS_CPUSPEED 0x141/* set core clock to 400/200/100 MHz */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
include/configs/cradle.h +1 -1
@@ -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 */
include/configs/csb226.h +1 -1
@@ -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 */
include/configs/delta.h +1 -1
@@ -173,7 +173,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 */
include/configs/innokom.h +1 -1
@@ -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 */
include/configs/logodl.h +1 -1
@@ -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 */
include/configs/lubbock.h +1 -1
@@ -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 */
include/configs/pleb2.h +1 -1
@@ -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 */
include/configs/pxa255_idp.h +1 -1
@@ -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 */
include/configs/trizepsiv.h +1 -1
@@ -170,7 +170,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 */
include/configs/wepep250.h +1 -1
@@ -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 }
include/configs/xaeniax.h +1 -1
@@ -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 */ /*
include/configs/xm250.h +1 -1
@@ -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 */
include/configs/xsengine.h +1 -4
@@ -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 */
include/configs/zylonite.h +1 -1
@@ -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 */
Signature · 1 line
1.5.6.4
PATCH 1/1 pxa: fixing get_timer to return time in miliseconds.
Quoted 29 lines · Micha Kalfon
Fixing the
get_timerfunction to return time in miliseconds instead of ticks. Also fixed PXA boards to use the conventional value of 1000 forCONFIG_SYS_HZ.Signed-off-by Micha Kalfon <[email protected]>--- cpu/pxa/interrupts.c | 25 ++++++++++++++++++------- include/configs/cerf250.h | 2 +- include/configs/cradle.h | 2 +- include/configs/csb226.h | 2 +- include/configs/delta.h | 2 +- include/configs/innokom.h | 2 +- include/configs/logodl.h | 2 +- include/configs/lubbock.h | 2 +- include/configs/pleb2.h | 2 +- include/configs/pxa255_idp.h | 2 +- include/configs/trizepsiv.h | 2 +- include/configs/wepep250.h | 2 +- include/configs/xaeniax.h | 2 +- include/configs/xm250.h | 2 +- include/configs/xsengine.h | 5 +---- include/configs/zylonite.h | 2 +- 16 files changed, 33 insertions(+), 25 deletions(-)cpu/pxa/interrupts.c +0
-0
cpu/pxa/interrupts.c line 37
Quoted 5 lines
cpu/pxa/interrupts.c +2
-0@@ -33,6 +33,14 @@#error : interrupts not implemented yet#endif +#if defined(CONFIG_PXA27X ) || defined(CONFIG_CPU_MONAHANS ) +#define TIMER_FREQ_HZ 3250000
^^
whitespace please remove
cpu/pxa/interrupts.c line 40
Quoted 3 lines
cpu/pxa/interrupts.c +3
-0+#elif defined(CONFIG_PXA250 ) +#define TIMER_FREQ_HZ 3686400 +#else
^
whitespace please remove
Quoted 7 lines
cpu/pxa/interrupts.c +3
-0+#error "Timer frequency unknown - please config PXA CPU type" +#endif +int interrupt_init (void ) {/* nothing happens here - we don't setup any IRQs */
cpu/pxa/interrupts.c void reset_timer_masked (void) · line 80
Quoted 7 lines
cpu/pxa/interrupts.c +3
-1@@ -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) +
^
whitespace please remove
Quoted 13 lines
cpu/pxa/interrupts.c +1
-0+ ((ticks % TIMER_FREQ_HZ) * 1000) / TIMER_FREQ_HZ); }void udelay_masked (unsigned long usec)@@ -78,17 +89,17 @@ void udelay_masked (unsigned long usec)return tbclk; }include/configs/cerf250.h +0
-0
include/configs/cerf250.h line 120
Quoted 5 lines
include/configs/cerf250.h +1
-1@@ -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/* incrementer freq: 3.6864 MHz */
please remove the comment
include/configs/cradle.h line 106
Quoted 13 lines
include/configs/cerf250.h +0
-0#define CONFIG_SYS_CPUSPEED 0x141/* set core clock to 400/200/100 MHz */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }include/configs/cradle.h +1
-1@@ -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
please use tab instead of space
include/configs/csb226.h line 134
Quoted 13 lines
include/configs/cradle.h +0
-0#define CONFIG_SYS_CPUSPEED 0x141/* set core clock to 200/200/100 MHz */ /* valid baudrates */ include/configs/csb226.h +1
-1@@ -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
please use tab instead of space on the modified line and so on
Best Regards,
J.