diff mbox

[03/18] ARM: imx: Add an array of timer IP block versions

Message ID 1430405073-13106-4-git-send-email-shenwei.wang@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shenwei Wang April 30, 2015, 2:44 p.m. UTC
Added an array to record the relationship between the
compatible string and the version of timer IP block.

Signed-off-by: Shenwei Wang <shenwei.wang@freescale.com>
---
 arch/arm/mach-imx/time.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Shawn Guo May 15, 2015, 1:33 a.m. UTC | #1
On Thu, Apr 30, 2015 at 09:44:18AM -0500, Shenwei Wang wrote:
> Added an array to record the relationship between the
> compatible string and the version of timer IP block.
> 
> Signed-off-by: Shenwei Wang <shenwei.wang@freescale.com>
> ---
>  arch/arm/mach-imx/time.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
> index 5df3c53..f44c2aa 100644
> --- a/arch/arm/mach-imx/time.c
> +++ b/arch/arm/mach-imx/time.c
> @@ -372,6 +372,23 @@ void __init mxc_timer_init(unsigned long pbase, int irq, int ver)
>  	_mxc_timer_init(irq, clk_per, clk_ipg);
>  }
>  
> +struct imx_timer_ip_combo {
> +	const char      *compat;
> +	int             version;
> +};
> +
> +static const struct imx_timer_ip_combo imx_timer_tables[] = {
> +	{"fsl,imx1-gpt",        IMX_TIMER_V0},
> +	{"fsl,imx25-gpt",       IMX_TIMER_V2},
> +	{"fsl,imx25-gpt",       IMX_TIMER_V2},
> +	{"fsl,imx50-gpt",       IMX_TIMER_V2},
> +	{"fsl,imx51-gpt",       IMX_TIMER_V2},
> +	{"fsl,imx53-gpt",       IMX_TIMER_V2},
> +	{"fsl,imx6q-gpt",       IMX_TIMER_V2},
> +	{"fsl,imx6sl-gpt",      IMX_TIMER_V3},
> +	{"fsl,imx6sx-gpt",      IMX_TIMER_V3},
> +};
> +

I do not like this and the for-loop in mxc_timer_init_dt() to find
version number per compatible string.  I'd rather to have different init
function for different compatible string.

CLOCKSOURCE_OF_DECLARE(mx1_timer, "fsl,imx1-gpt", imx1_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx25_timer, "fsl,imx25-gpt", imx25_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx50_timer, "fsl,imx50-gpt", imx25_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx51_timer, "fsl,imx51-gpt", imx25_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx53_timer, "fsl,imx53-gpt", imx25_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx6q_timer, "fsl,imx6q-gpt", imx25_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx6sl_timer, "fsl,imx6sl-gpt", imx6sl_timer_init_dt);
CLOCKSOURCE_OF_DECLARE(mx6sx_timer, "fsl,imx6sx-gpt", imx6sl_timer_init_dt);

Do not take that <soc>_timer_init_dt is a timer init function for <soc>,
but this an init time for <soc> type of timer.  In this case, we can
read it from above CLOCKSOURCE_OF_DECLAREs that imx25/50/51/53/6q are
all using imx25 type of gpt, and imx6sx is using the imx6sl type.

Shawn


>  static void __init mxc_timer_init_dt(struct device_node *np)
>  {
>  	struct clk *clk_per, *clk_ipg;
> -- 
> 1.9.1
> 
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox

Patch

diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index 5df3c53..f44c2aa 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -372,6 +372,23 @@  void __init mxc_timer_init(unsigned long pbase, int irq, int ver)
 	_mxc_timer_init(irq, clk_per, clk_ipg);
 }
 
+struct imx_timer_ip_combo {
+	const char      *compat;
+	int             version;
+};
+
+static const struct imx_timer_ip_combo imx_timer_tables[] = {
+	{"fsl,imx1-gpt",        IMX_TIMER_V0},
+	{"fsl,imx25-gpt",       IMX_TIMER_V2},
+	{"fsl,imx25-gpt",       IMX_TIMER_V2},
+	{"fsl,imx50-gpt",       IMX_TIMER_V2},
+	{"fsl,imx51-gpt",       IMX_TIMER_V2},
+	{"fsl,imx53-gpt",       IMX_TIMER_V2},
+	{"fsl,imx6q-gpt",       IMX_TIMER_V2},
+	{"fsl,imx6sl-gpt",      IMX_TIMER_V3},
+	{"fsl,imx6sx-gpt",      IMX_TIMER_V3},
+};
+
 static void __init mxc_timer_init_dt(struct device_node *np)
 {
 	struct clk *clk_per, *clk_ipg;