[U-Boot] [PATCH] pxa: fixing get_timer to return time in miliseconds.
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Sun Jan 4 09:14:38 CET 2009
On 21:13 Wed 17 Dec , Micha Kalfon wrote:
> 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 at gmail.com>
> ---
> 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(-)
>
> diff --git a/cpu/pxa/interrupts.c b/cpu/pxa/interrupts.c
> index ec8fb9e..38af850 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
^^
whitespace please remove
> +#elif defined(CONFIG_PXA250)
> +#define TIMER_FREQ_HZ 3686400
> +#else
^
whitespace please remove
> +#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) +
^
whitespace please remove
> + ((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;
> }
> diff --git a/include/configs/cerf250.h b/include/configs/cerf250.h
> index 71e5b58..376d3bf 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 /* incrementer freq: 3.6864 MHz */
please remove the comment
> #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..c15d13c 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
please use tab instead of space
> #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 a24e34a..2e39925 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
please use tab instead of space on the modified line and so on
Best Regards,
J.
More information about the U-Boot
mailing list