[U-Boot] [PATCH v3] mxs: timrot: Add support to i.MX23

Marek Vasut marex at denx.de
Mon Feb 25 01:14:08 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>

Boring nits below, fix them and add my ack in the next version:

Acked-by: Marek Vasut <marex at denx.de>

btw. if you don't want to add --cc="" to the git send-email command line, just 
put lines in format of:

Cc: Us Er <e at ma.il>

in the git commit message just below the "Signed-off-by:". Just run git log on 
most of the mxs-related files and you'll see how it's done.

> ---
> v2 - Updated the struct mxs_timrot_regs so the mapping works for all
> registers v3 - Revert macro MX28_INCREMENTER_HZ,
> MX28_HW_DIGCTL_MICROSECONDS and fix whitespaces
> 
>  arch/arm/cpu/arm926ejs/mxs/timer.c          |   23 +++++-
>  arch/arm/include/asm/arch-mxs/regs-timrot.h |  101
> +++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 2
> deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c
> b/arch/arm/cpu/arm926ejs/mxs/timer.c index 4ed75e6..f41ad1c 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;
> 
> @@ -69,7 +73,11 @@ int timer_init(void)
>  	mxs_reset_block(&timrot_regs->hw_timrot_rotctrl_reg);
> 
>  	/* Set fixed_count to 0 */
> +#if defined(CONFIG_MX23)
> +	writel(0, &timrot_regs->hw_timrot_timcount0);
> +#elif defined(CONFIG_MX28)
>  	writel(0, &timrot_regs->hw_timrot_fixed_count0);
> +#endif
> 
>  	/* Set UPDATE bit and 1Khz frequency */
>  	writel(TIMROT_TIMCTRLn_UPDATE | TIMROT_TIMCTRLn_RELOAD |
> @@ -77,7 +85,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, &timrot_regs->hw_timrot_timcount0);

Put a space here ... 'TIMER_LOAD_VAL - 1'

> +#elif defined(CONFIG_MX28)
>  	writel(TIMER_LOAD_VAL, &timrot_regs->hw_timrot_fixed_count0);
> +#endif
> 
>  	return 0;
>  }
> @@ -86,9 +98,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 */

/* Upper bits are the valid ones. */

> +	now = readl(&timrot_regs->hw_timrot_timcount0) >>
> +		TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET;
> +#elif defined(CONFIG_MX28)
> +	now = readl(&timrot_regs->hw_timrot_running_count0);
> +#endif
> 
>  	if (lastdec >= now) {
>  		/*

[...]


More information about the U-Boot mailing list