summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/clocksource.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-05-13 16:01:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-13 16:01:58 +0200
commita3c3f66abc2b9a3a8636468097fe7afd22360974 (patch)
treee128c58c17bcbf81b86fc2c3ff5e9285e17b4130 /arch/arm/mach-imx/clocksource.c
parent06a20b38f884a0de11781c2da07e794bf3f08ee6 (diff)
downloadbarebox-a3c3f66abc2b9a3a8636468097fe7afd22360974.tar.gz
barebox-a3c3f66abc2b9a3a8636468097fe7afd22360974.tar.xz
imx clocksource: add frequency change support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/clocksource.c')
-rw-r--r--arch/arm/mach-imx/clocksource.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c
index 1abe65ebde..6c5cc11410 100644
--- a/arch/arm/mach-imx/clocksource.c
+++ b/arch/arm/mach-imx/clocksource.c
@@ -32,6 +32,7 @@
#include <common.h>
#include <init.h>
#include <clock.h>
+#include <notifier.h>
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
@@ -48,6 +49,16 @@ static struct clocksource cs = {
.shift = 10,
};
+static int imx_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data)
+{
+ cs.mult = clocksource_hz2mult(imx_get_gptclk(), cs.shift);
+ return 0;
+}
+
+static struct notifier_block imx_clock_notifier = {
+ .notifier_call = imx_clocksource_clock_change,
+};
+
static int clocksource_init (void)
{
int i;
@@ -74,6 +85,8 @@ static int clocksource_init (void)
init_clock(&cs);
+ clock_register_client(&imx_clock_notifier);
+
return 0;
}