1
From cb5fbe17dacaf5f6ac03cce23e207e6fd8fc42bd Mon Sep 17 00:00:00 2001
2
From: Peter Maydell <peter.maydell@linaro.org>
3
Date: Mon, 18 Feb 2013 16:58:24 +0000
4
Subject: [PATCH 10/70] omap_gptimer: Add omap_gp_timer_change_clk()
6
Add omap_gp_timer_change_clk() functions to inform the gptimer code when
7
the clock source for a timer has been changed.
9
TODO: is this the best way to do this??
11
hw/timer/omap_gptimer.c | 6 ++++++
12
include/hw/arm/omap.h | 1 +
13
2 files changed, 7 insertions(+)
15
diff --git a/hw/timer/omap_gptimer.c b/hw/timer/omap_gptimer.c
16
index 259f5c4..769a8e5 100644
17
--- a/hw/timer/omap_gptimer.c
18
+++ b/hw/timer/omap_gptimer.c
19
@@ -75,6 +75,12 @@ struct omap_gp_timer_s {
20
#define GPT_OVF_IT (1 << 1)
21
#define GPT_MAT_IT (1 << 0)
23
+/*if the clock source of gptimer changes, rate must be regenerated*/
24
+void omap_gp_timer_change_clk(struct omap_gp_timer_s *timer)
26
+ timer->rate = omap_clk_getrate(timer->clk);
29
static inline void omap_gp_timer_intr(struct omap_gp_timer_s *timer, int it)
31
if (timer->it_ena & it) {
32
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
33
index 086692f..5e9d41d 100644
34
--- a/include/hw/arm/omap.h
35
+++ b/include/hw/arm/omap.h
36
@@ -844,6 +844,7 @@ struct omap_gp_timer_s;
37
struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
38
qemu_irq irq, omap_clk fclk, omap_clk iclk);
39
void omap_gp_timer_reset(struct omap_gp_timer_s *s);
40
+void omap_gp_timer_change_clk(struct omap_gp_timer_s *timer);
43
struct omap_synctimer_s;