aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/time.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 14:14:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-08 14:14:29 -0400
commitb3345d7c57d70e6cb6749af25cdbe80515582e99 (patch)
tree04cce706bc7e944ad1fb257108a8ae735948f97f /arch/arm/mach-imx/time.c
parent44c916d58b9ef1f2c4aec2def57fa8289c716a60 (diff)
parentc2fff85e21818952aa0ee5778926beee6c03e579 (diff)
Merge tag 'soc-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC platform changes from Olof Johansson: "This is the bulk of new SoC enablement and other platform changes for 3.17: - Samsung S5PV210 has been converted to DT and multiplatform - Clock drivers and bindings for some of the lower-end i.MX 1/2 platforms - Kirkwood, one of the popular Marvell platforms, is folded into the mvebu platform code, removing mach-kirkwood - Hwmod data for TI AM43xx and DRA7 platforms - More additions of Renesas shmobile platform support - Removal of plat-samsung contents that can be removed with S5PV210 being multiplatform/DT-enabled and the other two old platforms being removed New platforms (most with only basic support right now): - Hisilicon X5HD2 settop box chipset is introduced - Mediatek MT6589 (mobile chipset) is introduced - Broadcom BCM7xxx settop box chipset is introduced + as usual a lot other pieces all over the platform code" * tag 'soc-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (240 commits) ARM: hisi: remove smp from machine descriptor power: reset: move hisilicon reboot code ARM: dts: Add hix5hd2-dkb dts file. ARM: debug: Rename Hi3716 to HIX5HD2 ARM: hisi: enable hix5hd2 SoC ARM: hisi: add ARCH_HISI MAINTAINERS: add entry for Broadcom ARM STB architecture ARM: brcmstb: select GISB arbiter and interrupt drivers ARM: brcmstb: add infrastructure for ARM-based Broadcom STB SoCs ARM: configs: enable SMP in bcm_defconfig ARM: add SMP support for Broadcom mobile SoCs Documentation: arm: misc updates to Marvell EBU SoC status Documentation: arm: add URLs to public datasheets for the Marvell Armada XP SoC ARM: mvebu: fix build without platforms selected ARM: mvebu: add cpuidle support for Armada 38x ARM: mvebu: add cpuidle support for Armada 370 cpuidle: mvebu: add Armada 38x support cpuidle: mvebu: add Armada 370 support cpuidle: mvebu: rename the driver from armada-370-xp to mvebu-v7 ARM: mvebu: export the SCU address ...
Diffstat (limited to 'arch/arm/mach-imx/time.c')
-rw-r--r--arch/arm/mach-imx/time.c55
1 files changed, 37 insertions, 18 deletions
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index bed081e58262..bf92e5a351c0 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -290,25 +290,20 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
290 return 0; 290 return 0;
291} 291}
292 292
293void __init mxc_timer_init(void __iomem *base, int irq) 293static void __init _mxc_timer_init(int irq,
294 struct clk *clk_per, struct clk *clk_ipg)
294{ 295{
295 uint32_t tctl_val; 296 uint32_t tctl_val;
296 struct clk *timer_clk;
297 struct clk *timer_ipg_clk;
298 297
299 timer_clk = clk_get_sys("imx-gpt.0", "per"); 298 if (IS_ERR(clk_per)) {
300 if (IS_ERR(timer_clk)) {
301 pr_err("i.MX timer: unable to get clk\n"); 299 pr_err("i.MX timer: unable to get clk\n");
302 return; 300 return;
303 } 301 }
304 302
305 timer_ipg_clk = clk_get_sys("imx-gpt.0", "ipg"); 303 if (!IS_ERR(clk_ipg))
306 if (!IS_ERR(timer_ipg_clk)) 304 clk_prepare_enable(clk_ipg);
307 clk_prepare_enable(timer_ipg_clk);
308
309 clk_prepare_enable(timer_clk);
310 305
311 timer_base = base; 306 clk_prepare_enable(clk_per);
312 307
313 /* 308 /*
314 * Initialise to a known state (all timers off, and timing reset) 309 * Initialise to a known state (all timers off, and timing reset)
@@ -325,21 +320,45 @@ void __init mxc_timer_init(void __iomem *base, int irq)
325 __raw_writel(tctl_val, timer_base + MXC_TCTL); 320 __raw_writel(tctl_val, timer_base + MXC_TCTL);
326 321
327 /* init and register the timer to the framework */ 322 /* init and register the timer to the framework */
328 mxc_clocksource_init(timer_clk); 323 mxc_clocksource_init(clk_per);
329 mxc_clockevent_init(timer_clk); 324 mxc_clockevent_init(clk_per);
330 325
331 /* Make irqs happen */ 326 /* Make irqs happen */
332 setup_irq(irq, &mxc_timer_irq); 327 setup_irq(irq, &mxc_timer_irq);
333} 328}
334 329
335void __init mxc_timer_init_dt(struct device_node *np) 330void __init mxc_timer_init(void __iomem *base, int irq)
336{ 331{
337 void __iomem *base; 332 struct clk *clk_per = clk_get_sys("imx-gpt.0", "per");
333 struct clk *clk_ipg = clk_get_sys("imx-gpt.0", "ipg");
334
335 timer_base = base;
336
337 _mxc_timer_init(irq, clk_per, clk_ipg);
338}
339
340static void __init mxc_timer_init_dt(struct device_node *np)
341{
342 struct clk *clk_per, *clk_ipg;
338 int irq; 343 int irq;
339 344
340 base = of_iomap(np, 0); 345 if (timer_base)
341 WARN_ON(!base); 346 return;
347
348 timer_base = of_iomap(np, 0);
349 WARN_ON(!timer_base);
342 irq = irq_of_parse_and_map(np, 0); 350 irq = irq_of_parse_and_map(np, 0);
343 351
344 mxc_timer_init(base, irq); 352 clk_per = of_clk_get_by_name(np, "per");
353 clk_ipg = of_clk_get_by_name(np, "ipg");
354
355 _mxc_timer_init(irq, clk_per, clk_ipg);
345} 356}
357CLOCKSOURCE_OF_DECLARE(mx1_timer, "fsl,imx1-gpt", mxc_timer_init_dt);
358CLOCKSOURCE_OF_DECLARE(mx25_timer, "fsl,imx25-gpt", mxc_timer_init_dt);
359CLOCKSOURCE_OF_DECLARE(mx50_timer, "fsl,imx50-gpt", mxc_timer_init_dt);
360CLOCKSOURCE_OF_DECLARE(mx51_timer, "fsl,imx51-gpt", mxc_timer_init_dt);
361CLOCKSOURCE_OF_DECLARE(mx53_timer, "fsl,imx53-gpt", mxc_timer_init_dt);
362CLOCKSOURCE_OF_DECLARE(mx6q_timer, "fsl,imx6q-gpt", mxc_timer_init_dt);
363CLOCKSOURCE_OF_DECLARE(mx6sl_timer, "fsl,imx6sl-gpt", mxc_timer_init_dt);
364CLOCKSOURCE_OF_DECLARE(mx6sx_timer, "fsl,imx6sx-gpt", mxc_timer_init_dt);