]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0013-omap2-Reserve-clocksource-and-timesource-and-initial.patch
da63459ca434888dcd9c5d1029a0b08a2dcdd312
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0013-omap2-Reserve-clocksource-and-timesource-and-initial.patch
1 From c3c0bfa5bf8ccbea4189cb76b842c51b8e3756c7 Mon Sep 17 00:00:00 2001
2 From: Tony Lindgren <tony@atomide.com>
3 Date: Tue, 29 Mar 2011 15:54:49 -0700
4 Subject: [PATCH 013/149] omap2+: Reserve clocksource and timesource and initialize dmtimer later
6 There's no need to initialize the dmtimer framework early.
7 Just mark the clocksource and timesource as reserved, and
8 initialize dmtimer with an arch_initcall.
10 Signed-off-by: Tony Lindgren <tony@atomide.com>
11 Reviewed-by: Kevin Hilman <khilman@ti.com>
12 ---
13  arch/arm/mach-omap1/timer32k.c            |    4 ----
14  arch/arm/mach-omap2/timer-gp.c            |    6 ++++--
15  arch/arm/plat-omap/dmtimer.c              |   10 +++++++++-
16  arch/arm/plat-omap/include/plat/dmtimer.h |    3 +--
17  4 files changed, 14 insertions(+), 9 deletions(-)
19 diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
20 index 13d7b8f..96604a5 100644
21 --- a/arch/arm/mach-omap1/timer32k.c
22 +++ b/arch/arm/mach-omap1/timer32k.c
23 @@ -183,10 +183,6 @@ static __init void omap_init_32k_timer(void)
24  bool __init omap_32k_timer_init(void)
25  {
26         omap_init_clocksource_32k();
27 -
28 -#ifdef CONFIG_OMAP_DM_TIMER
29 -       omap_dm_timer_init();
30 -#endif
31         omap_init_32k_timer();
32  
33         return true;
34 diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
35 index 578e9df..cf2ec85 100644
36 --- a/arch/arm/mach-omap2/timer-gp.c
37 +++ b/arch/arm/mach-omap2/timer-gp.c
38 @@ -69,6 +69,8 @@
39  /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
40  #define MAX_GPTIMER_ID         12
41  
42 +u32 sys_timer_reserved;
43 +
44  /* Clockevent code */
45  
46  static struct omap_dm_timer clkev;
47 @@ -195,6 +197,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
48  
49         omap_hwmod_enable(oh);
50  
51 +       sys_timer_reserved |= (1 << (gptimer_id - 1));
52 +
53         if (gptimer_id != 12) {
54                 struct clk *src;
55  
56 @@ -321,7 +325,6 @@ static void __init omap2_gp_clocksource_init(void)
57  #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)                 \
58  static void __init omap##name##_timer_init(void)                       \
59  {                                                                      \
60 -       omap_dm_timer_init();                                           \
61         omap2_gp_clockevent_init((clkev_nr), clkev_src);                \
62         omap2_gp_clocksource_init();                                    \
63  }
64 @@ -350,7 +353,6 @@ static void __init omap4_timer_init(void)
65         twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
66         BUG_ON(!twd_base);
67  #endif
68 -       omap_dm_timer_init();
69         omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
70         omap2_gp_clocksource_init();
71  }
72 diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
73 index 7c5cb4e..8dfb818 100644
74 --- a/arch/arm/plat-omap/dmtimer.c
75 +++ b/arch/arm/plat-omap/dmtimer.c
76 @@ -572,7 +572,7 @@ int omap_dm_timers_active(void)
77  }
78  EXPORT_SYMBOL_GPL(omap_dm_timers_active);
79  
80 -int __init omap_dm_timer_init(void)
81 +static int __init omap_dm_timer_init(void)
82  {
83         struct omap_dm_timer *timer;
84         int i, map_size = SZ_8K;        /* Module 4KB + L4 4KB except on omap1 */
85 @@ -625,8 +625,16 @@ int __init omap_dm_timer_init(void)
86                         sprintf(clk_name, "gpt%d_fck", i + 1);
87                         timer->fclk = clk_get(NULL, clk_name);
88                 }
89 +
90 +               /* One or two timers may be set up early for sys_timer */
91 +               if (sys_timer_reserved & (1  << i)) {
92 +                       timer->reserved = 1;
93 +                       timer->posted = 1;
94 +               }
95  #endif
96         }
97  
98         return 0;
99  }
101 +arch_initcall(omap_dm_timer_init);
102 diff --git a/arch/arm/plat-omap/include/plat/dmtimer.h b/arch/arm/plat-omap/include/plat/dmtimer.h
103 index 8adcb18..d0f3a2d 100644
104 --- a/arch/arm/plat-omap/include/plat/dmtimer.h
105 +++ b/arch/arm/plat-omap/include/plat/dmtimer.h
106 @@ -61,8 +61,6 @@
107  struct omap_dm_timer;
108  struct clk;
109  
110 -int omap_dm_timer_init(void);
112  struct omap_dm_timer *omap_dm_timer_request(void);
113  struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
114  void omap_dm_timer_free(struct omap_dm_timer *timer);
115 @@ -221,6 +219,7 @@ struct omap_dm_timer {
116         unsigned posted:1;
117  };
118  
119 +extern u32 sys_timer_reserved;
120  void omap_dm_timer_prepare(struct omap_dm_timer *timer);
121  
122  static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg,
123 -- 
124 1.6.6.1