1
From 035fa7975e7b02bfae963e90a5c149f1f3cd2e0d 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 11/77] 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??
12
hw/omap_gptimer.c | 6 ++++++
13
2 files changed, 7 insertions(+)
15
diff --git a/hw/omap.h b/hw/omap.h
16
index 086692f..5e9d41d 100644
19
@@ -844,6 +844,7 @@ struct omap_gp_timer_s;
20
struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
21
qemu_irq irq, omap_clk fclk, omap_clk iclk);
22
void omap_gp_timer_reset(struct omap_gp_timer_s *s);
23
+void omap_gp_timer_change_clk(struct omap_gp_timer_s *timer);
26
struct omap_synctimer_s;
27
diff --git a/hw/omap_gptimer.c b/hw/omap_gptimer.c
28
index e500884..b019295 100644
29
--- a/hw/omap_gptimer.c
30
+++ b/hw/omap_gptimer.c
31
@@ -75,6 +75,12 @@ struct omap_gp_timer_s {
32
#define GPT_OVF_IT (1 << 1)
33
#define GPT_MAT_IT (1 << 0)
35
+/*if the clock source of gptimer changes, rate must be regenerated*/
36
+void omap_gp_timer_change_clk(struct omap_gp_timer_s *timer)
38
+ timer->rate = omap_clk_getrate(timer->clk);
41
static inline void omap_gp_timer_intr(struct omap_gp_timer_s *timer, int it)
43
if (timer->it_ena & it) {