[U-Boot] [PATCH] mxs: timrot: Add support to i.MX23
Marek Vasut
marex at denx.de
Fri Feb 22 23:53:59 CET 2013
Dear Fadil Berisha,
> From: Fadil Berisha <f.koliqi at gmail.com>
>
> This patch add timer support to i.MX23 and complete bit fields and values
> on regs-timrot.h.
> Testet on imx23-olinuxino board.
>
> Signed-off-by: Fadil Berisha <f.koliqi at gmail.com>
Please always CC me, Fabio, Stefano on the MXS patches.
> ---
> arch/arm/cpu/arm926ejs/mxs/timer.c | 19 +++++-
> arch/arm/include/asm/arch-mxs/regs-timrot.h | 91
> +++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 2
> deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c
> b/arch/arm/cpu/arm926ejs/mxs/timer.c index 4ed75e6..a99b122 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/timer.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
> @@ -32,7 +32,11 @@
> #include <asm/arch/sys_proto.h>
>
> /* Maximum fixed count */
> -#define TIMER_LOAD_VAL 0xffffffff
> +#if defined(CONFIG_MX23)
> +#define TIMER_LOAD_VAL 0xffff
> +#elif defined(CONFIG_MX28)
> +#define TIMER_LOAD_VAL 0xffffffff
> +#endif
>
> DECLARE_GLOBAL_DATA_PTR;
>
> @@ -77,7 +81,11 @@ int timer_init(void)
> &timrot_regs->hw_timrot_timctrl0);
>
> /* Set fixed_count to maximal value */
> +#if defined(CONFIG_MX23)
> + writel(TIMER_LOAD_VAL-1, HW_TIMROT_TIMCOUNT0);
NAK, this cannot work. Fix timrot_regs in regs-timrot.h
> +#elif defined(CONFIG_MX28)
> writel(TIMER_LOAD_VAL, &timrot_regs->hw_timrot_fixed_count0);
> +#endif
>
> return 0;
> }
> @@ -86,9 +94,16 @@ unsigned long long get_ticks(void)
> {
> struct mxs_timrot_regs *timrot_regs =
> (struct mxs_timrot_regs *)MXS_TIMROT_BASE;
> + uint32_t now;
>
> /* Current tick value */
> - uint32_t now = readl(&timrot_regs->hw_timrot_running_count0);
> +#if defined(CONFIG_MX23)
> + /* upper bits are the valid */
> + now = (readl(HW_TIMROT_TIMCOUNT0) >>
> + TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET);
The outer braces are superfluous.
> +#elif defined(CONFIG_MX28)
> + now = readl(&timrot_regs->hw_timrot_running_count0);
> +#endif
>
> if (lastdec >= now) {
> /*
[...]
> @@ -131,15 +160,29 @@ struct mxs_timrot_regs {
> #define TIMROT_TIMCTRLn_SELECT_4KHZ_XTAL 0xd
> #define TIMROT_TIMCTRLn_SELECT_1KHZ_XTAL 0xe
> #define TIMROT_TIMCTRLn_SELECT_TICK_ALWAYS 0xf
> +#endif
>
> +#if defined(CONFIG_MX23)
> +#define HW_TIMROT_TIMCOUNT0 0x80068030
Remove the above, use timrot_regs please.
> +#define TIMROT_RUNNING_COUNTn_RUNNING_COUNT_MASK (0xffff << 16)
> +#define TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET 16
> +#elif defined(CONFIG_MX28)
> #define TIMROT_RUNNING_COUNTn_RUNNING_COUNT_MASK 0xffffffff
> #define TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET 0
> +#endif
[...]
More information about the U-Boot
mailing list