Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: imx: define an enum for gpt timer device type

Define an enum for gpt timer device type in include/soc/imx/timer.h to
tell the gpt block differences among SoCs. Update non-DT users (clock
drivers) to pass the device type.

As we now have include/soc/imx/timer.h, the declaration of
mxc_timer_init() is moved into there as the best fit.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Shawn Guo 0931aff7 6dd74782

+41 -13
+5 -1
arch/arm/mach-imx/time.c
··· 32 32 #include <linux/of.h> 33 33 #include <linux/of_address.h> 34 34 #include <linux/of_irq.h> 35 + #include <soc/imx/timer.h> 35 36 36 37 #include <asm/mach/time.h> 37 38 ··· 87 86 static enum clock_event_mode clockevent_mode = CLOCK_EVT_MODE_UNUSED; 88 87 89 88 struct imx_timer { 89 + enum imx_gpt_type type; 90 90 void __iomem *base; 91 91 int irq; 92 92 struct clk *clk_per; ··· 358 356 setup_irq(imxtm->irq, &mxc_timer_irq); 359 357 } 360 358 361 - void __init mxc_timer_init(unsigned long pbase, int irq) 359 + void __init mxc_timer_init(unsigned long pbase, int irq, enum imx_gpt_type type) 362 360 { 363 361 struct imx_timer *imxtm; 364 362 ··· 370 368 371 369 imxtm->base = ioremap(pbase, SZ_4K); 372 370 BUG_ON(!imxtm->base); 371 + 372 + imxtm->type = type; 373 373 374 374 _mxc_timer_init(imxtm); 375 375 }
+2 -1
drivers/clk/imx/clk-imx1.c
··· 23 23 #include <linux/of.h> 24 24 #include <linux/of_address.h> 25 25 #include <dt-bindings/clock/imx1-clock.h> 26 + #include <soc/imx/timer.h> 26 27 #include <asm/irq.h> 27 28 28 29 #include "clk.h" ··· 103 102 clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ipg", "imx1-fb.0"); 104 103 clk_register_clkdev(clk[IMX1_CLK_DUMMY], "ahb", "imx1-fb.0"); 105 104 106 - mxc_timer_init(MX1_TIM1_BASE_ADDR, MX1_TIM1_INT); 105 + mxc_timer_init(MX1_TIM1_BASE_ADDR, MX1_TIM1_INT, GPT_TYPE_IMX1); 107 106 108 107 return 0; 109 108 }
+2 -1
drivers/clk/imx/clk-imx21.c
··· 15 15 #include <linux/of.h> 16 16 #include <linux/of_address.h> 17 17 #include <dt-bindings/clock/imx21-clock.h> 18 + #include <soc/imx/timer.h> 18 19 #include <asm/irq.h> 19 20 20 21 #include "clk.h" ··· 157 156 clk_register_clkdev(clk[IMX21_CLK_I2C_GATE], NULL, "imx21-i2c.0"); 158 157 clk_register_clkdev(clk[IMX21_CLK_OWIRE_GATE], NULL, "mxc_w1.0"); 159 158 160 - mxc_timer_init(MX21_GPT1_BASE_ADDR, MX21_INT_GPT1); 159 + mxc_timer_init(MX21_GPT1_BASE_ADDR, MX21_INT_GPT1, GPT_TYPE_IMX21); 161 160 162 161 return 0; 163 162 }
+2 -1
drivers/clk/imx/clk-imx27.c
··· 6 6 #include <linux/of_address.h> 7 7 #include <dt-bindings/clock/imx27-clock.h> 8 8 #include <soc/imx/revision.h> 9 + #include <soc/imx/timer.h> 9 10 #include <asm/irq.h> 10 11 11 12 #include "clk.h" ··· 234 233 clk_register_clkdev(clk[IMX27_CLK_EMMA_AHB_GATE], "ahb", "m2m-emmaprp.0"); 235 234 clk_register_clkdev(clk[IMX27_CLK_EMMA_IPG_GATE], "ipg", "m2m-emmaprp.0"); 236 235 237 - mxc_timer_init(MX27_GPT1_BASE_ADDR, MX27_INT_GPT1); 236 + mxc_timer_init(MX27_GPT1_BASE_ADDR, MX27_INT_GPT1, GPT_TYPE_IMX21); 238 237 239 238 return 0; 240 239 }
+2 -1
drivers/clk/imx/clk-imx31.c
··· 22 22 #include <linux/err.h> 23 23 #include <linux/of.h> 24 24 #include <soc/imx/revision.h> 25 + #include <soc/imx/timer.h> 25 26 #include <asm/irq.h> 26 27 27 28 #include "clk.h" ··· 199 198 mx31_revision(); 200 199 clk_disable_unprepare(clk[iim_gate]); 201 200 202 - mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT); 201 + mxc_timer_init(MX31_GPT1_BASE_ADDR, MX31_INT_GPT, GPT_TYPE_IMX31); 203 202 204 203 return 0; 205 204 }
+2 -1
drivers/clk/imx/clk-imx35.c
··· 14 14 #include <linux/of.h> 15 15 #include <linux/err.h> 16 16 #include <soc/imx/revision.h> 17 + #include <soc/imx/timer.h> 17 18 #include <asm/irq.h> 18 19 19 20 #include "clk.h" ··· 294 293 295 294 imx_print_silicon_rev("i.MX35", mx35_revision()); 296 295 297 - mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT); 296 + mxc_timer_init(MX35_GPT1_BASE_ADDR, MX35_INT_GPT, GPT_TYPE_IMX31); 298 297 299 298 return 0; 300 299 }
-7
drivers/clk/imx/clk.h
··· 6 6 7 7 extern spinlock_t imx_ccm_lock; 8 8 9 - /* 10 - * This is a stop-gap solution for clock drivers like imx1/imx21 which call 11 - * mxc_timer_init() to initialize timer for non-DT boot. It can be removed 12 - * when these legacy non-DT support is converted or dropped. 13 - */ 14 - void mxc_timer_init(unsigned long pbase, int irq); 15 - 16 9 void imx_check_clocks(struct clk *clks[], unsigned int count); 17 10 18 11 extern void imx_cscmr1_fixup(u32 *val);
+26
include/soc/imx/timer.h
··· 1 + /* 2 + * Copyright 2015 Linaro Ltd. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #ifndef __SOC_IMX_TIMER_H__ 10 + #define __SOC_IMX_TIMER_H__ 11 + 12 + enum imx_gpt_type { 13 + GPT_TYPE_IMX1, /* i.MX1 */ 14 + GPT_TYPE_IMX21, /* i.MX21/27 */ 15 + GPT_TYPE_IMX31, /* i.MX31/35/25/37/51/6Q */ 16 + GPT_TYPE_IMX6DL, /* i.MX6DL/SX/SL */ 17 + }; 18 + 19 + /* 20 + * This is a stop-gap solution for clock drivers like imx1/imx21 which call 21 + * mxc_timer_init() to initialize timer for non-DT boot. It can be removed 22 + * when these legacy non-DT support is converted or dropped. 23 + */ 24 + void mxc_timer_init(unsigned long pbase, int irq, enum imx_gpt_type type); 25 + 26 + #endif /* __SOC_IMX_TIMER_H__ */