[PATCH 02/18] ARM: imx: Add the definitions for imx_timer and its versions

Shawn Guo shawnguo at kernel.org
Thu May 14 18:18:55 PDT 2015


On Thu, Apr 30, 2015 at 09:44:17AM -0500, Shenwei Wang wrote:
> A struct was added to describe the imx hardware timers.
> Added four macros to define the imx timer version.
> 
> Signed-off-by: Shenwei Wang <shenwei.wang at freescale.com>
> ---
>  arch/arm/mach-imx/time.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
> index eef6b66..5df3c53 100644
> --- a/arch/arm/mach-imx/time.c
> +++ b/arch/arm/mach-imx/time.c
> @@ -81,6 +81,21 @@
>  #define timer_is_v1()	(cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())
>  #define timer_is_v2()	(!timer_is_v1())
>  
> +#define IMX_TIMER_V0         (0)
> +#define IMX_TIMER_V1         (1)
> +#define IMX_TIMER_V2         (2)
> +#define IMX_TIMER_V3         (3)

I prefer to use an enum type instead of macros. Also I do not like the
versions which are numbered by software arbitrarily.  Instead, I'd like
to use SoC name that firstly integrates the version to code the
type/version.

Shawn

> +
> +struct imx_timer {
> +	void __iomem *timer_base;
> +	int version;
> +	struct clock_event_device evt;
> +	struct irqaction act;
> +	void (*gpt_irq_enable)(struct imx_timer *);
> +	void (*gpt_irq_disable)(struct imx_timer *);
> +	void (*gpt_irq_acknowledge)(struct imx_timer *);
> +};
> +
>  static struct clock_event_device clockevent_mxc;
>  static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED;
>  
> -- 
> 1.9.1
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



More information about the linux-arm-kernel mailing list