diff options
author | Xinyu Chen <b03824@freescale.com> | 2012-03-05 16:15:20 +0800 |
---|---|---|
committer | Xinyu Chen <b03824@freescale.com> | 2012-03-07 11:58:53 +0800 |
commit | 339df93d8c52a54a470cc36e744d7ac815104bc5 (patch) | |
tree | 6197c5d58446f1e27c0481a2fc833c0a112610e1 /arch | |
parent | 48a2d31295a83c23733b0bf05a49c752cc1fc09c (diff) |
ENGR00176068-1 mx6q: add smp_twd clock for localtimer
Add a smp_twd system clock which is simple clock
from parent of cpu_clk, and it's rate is half
of the cpu_clk.
This is used for reprograming the twd clock event
after cpu freq is changed.
Also disable local timer setup when wait mode enabled.
Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mx6/clock.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-mx6/localtimer.c | 13 |
2 files changed, 21 insertions, 4 deletions
diff --git a/arch/arm/mach-mx6/clock.c b/arch/arm/mach-mx6/clock.c index 169bbbef750a..89d4810e4376 100644 --- a/arch/arm/mach-mx6/clock.c +++ b/arch/arm/mach-mx6/clock.c @@ -1181,6 +1181,17 @@ static struct clk cpu_clk = { .get_rate = _clk_arm_get_rate, }; +static unsigned long _clk_twd_get_rate(struct clk *clk) +{ + return clk_get_rate(clk->parent) / 2; +} + +static struct clk twd_clk = { + __INIT_CLK_DEBUG(twd_clk) + .parent = &cpu_clk, + .get_rate = _clk_twd_get_rate, +}; + static int _clk_periph_set_parent(struct clk *clk, struct clk *parent) { u32 reg; @@ -4991,6 +5002,7 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK(NULL, "pll3", pll7_usb_host_main_clk), _REGISTER_CLOCK(NULL, "pll4", pll8_enet_main_clk), _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk), + _REGISTER_CLOCK("smp_twd", NULL, twd_clk), _REGISTER_CLOCK(NULL, "periph_clk", periph_clk), _REGISTER_CLOCK(NULL, "axi_clk", axi_clk), _REGISTER_CLOCK(NULL, "mmdc_ch0_axi", mmdc_ch0_axi_clk[0]), diff --git a/arch/arm/mach-mx6/localtimer.c b/arch/arm/mach-mx6/localtimer.c index d72fa9312fc2..b8bfdaba0de1 100644 --- a/arch/arm/mach-mx6/localtimer.c +++ b/arch/arm/mach-mx6/localtimer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,13 +25,18 @@ #include <mach/hardware.h> +extern bool enable_wait_mode; /* * Setup the local clock events for a CPU. */ -void __cpuinit local_timer_setup(struct clock_event_device *evt) +int __cpuinit local_timer_setup(struct clock_event_device *evt) { #ifdef CONFIG_LOCAL_TIMERS - evt->irq = IRQ_LOCALTIMER; - twd_timer_setup(evt); + if (!enable_wait_mode) { + evt->irq = IRQ_LOCALTIMER; + twd_timer_setup(evt); + return 0; + } #endif + return -1; } |