* [PATCH] Pre-3430 patch for dmtimer.c
@ 2007-06-21 3:13 Syed Mohammed, Khasim
2007-06-21 10:15 ` Tony Lindgren
0 siblings, 1 reply; 2+ messages in thread
From: Syed Mohammed, Khasim @ 2007-06-21 3:13 UTC (permalink / raw)
To: linux-omap-open-source
Cleanup DM timer list for OMAP2 and OMAP1
Signed-off-by: Syed Mohammed Khasim <x0khasim@ti.com>
Files:
arch/arm/plat-omap/dmtimer.c
=======================================================================
--- linux-omap/arch/arm/plat-omap/dmtimer.c 2007-04-04 18:13:49.000000000 -0500
+++ lin_for_mmc/arch/arm/plat-omap/dmtimer.c 2007-06-20 19:29:54.000000000 -0500
@@ -83,7 +83,7 @@ struct omap_dm_timer {
#define omap_dm_clk_enable(x)
#define omap_dm_clk_disable(x)
-static struct omap_dm_timer dm_timers[] = {
+static struct omap_dm_timer omap1_dm_timers[] = {
{ .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 },
{ .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 },
{ .phys_base = 0xfffb2400, .irq = INT_1610_GPTIMER3 },
@@ -94,12 +94,20 @@ static struct omap_dm_timer dm_timers[]
{ .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 },
};
+static const int dm_timer_count = ARRAY_SIZE(omap1_dm_timers);
+
+static struct omap_dm_timer omap2_dm_timers[] = {};
+static const char *omap2_dm_source_names[] = {};
+static struct clk omap2_dm_source_clocks[1];
+
#elif defined(CONFIG_ARCH_OMAP2)
#define omap_dm_clk_enable(x) clk_enable(x)
#define omap_dm_clk_disable(x) clk_disable(x)
-static struct omap_dm_timer dm_timers[] = {
+static struct omap_dm_timer omap1_dm_timers[] = {};
+
+static struct omap_dm_timer omap2_dm_timers[] = {
{ .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 },
{ .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 },
{ .phys_base = 0x48078000, .irq = INT_24XX_GPTIMER3 },
@@ -114,13 +122,15 @@ static struct omap_dm_timer dm_timers[]
{ .phys_base = 0x4808a000, .irq = INT_24XX_GPTIMER12 },
};
-static const char *dm_source_names[] = {
+static const char *omap2_dm_source_names[] = {
"sys_ck",
"func_32k_ck",
"alt_ck"
};
-static struct clk *dm_source_clocks[3];
+static struct clk *omap2_dm_source_clocks[3];
+static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
+static const int dm_source_names_count = ARRAY_SIZE(omap2_dm_source_names);
#else
@@ -128,7 +138,10 @@ static struct clk *dm_source_clocks[3];
#endif
-static const int dm_timer_count = ARRAY_SIZE(dm_timers);
+static struct omap_dm_timer *dm_timers;
+static unsigned long *dm_source_names;
+static unsigned long *dm_source_clocks;
+
static spinlock_t dm_timer_lock;
static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, int reg)
@@ -171,7 +184,7 @@ static void omap_dm_timer_reset(struct o
l = omap_dm_timer_read_reg(timer, OMAP_TIMER_OCP_CFG_REG);
l |= 0x02 << 3;
- if (cpu_class_is_omap2() && timer == &dm_timers[0]) {
+ if ((cpu_class_is_omap2()) && (timer == &dm_timers[0])) {
/* Enable wake-up only for GPT1 on OMAP2 CPUs*/
l |= 1 << 2;
/* Non-posted mode */
@@ -362,7 +375,7 @@ void omap_dm_timer_set_source(struct oma
return;
clk_disable(timer->fclk);
- clk_set_parent(timer->fclk, dm_source_clocks[source]);
+ clk_set_parent(timer->fclk, (struct clk *)dm_source_clocks[source]);
clk_enable(timer->fclk);
/* When the functional clock disappears, too quick writes seem to
@@ -495,10 +508,20 @@ int omap_dm_timer_init(void)
return -ENODEV;
spin_lock_init(&dm_timer_lock);
+
+ if (cpu_class_is_omap1()) {
+ dm_timers = omap1_dm_timers;
+ } else if (cpu_is_omap24xx()) {
+ dm_timers = omap2_dm_timers;
+ dm_source_names = (unsigned long *) omap2_dm_source_names;
+ dm_source_clocks = (unsigned long *) omap2_dm_source_clocks;
+ }
+
#ifdef CONFIG_ARCH_OMAP2
- for (i = 0; i < ARRAY_SIZE(dm_source_names); i++) {
- dm_source_clocks[i] = clk_get(NULL, dm_source_names[i]);
- BUG_ON(dm_source_clocks[i] == NULL);
+ for (i = 0; i < dm_source_names_count; i++) {
+ dm_source_clocks[i] = (unsigned long)
+ clk_get(NULL, (unsigned char *)dm_source_names[i]);
+ BUG_ON((struct clk *)dm_source_clocks[i] == NULL);
}
#endif
if (cpu_is_omap243x())
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Pre-3430 patch for dmtimer.c
2007-06-21 3:13 [PATCH] Pre-3430 patch for dmtimer.c Syed Mohammed, Khasim
@ 2007-06-21 10:15 ` Tony Lindgren
0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2007-06-21 10:15 UTC (permalink / raw)
To: Syed Mohammed, Khasim; +Cc: linux-omap-open-source
* Syed Mohammed, Khasim <x0khasim@ti.com> [070620 20:14]:
> Cleanup DM timer list for OMAP2 and OMAP1
I've cleaned it up further to get rid of unnecessary casts etc.
Committed as a67825f661980a324aacf22e89af66afa4e4ff59.
Hmmm, looks like the BUG_ON() can be removed too...
Regards,
Tony
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-21 10:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 3:13 [PATCH] Pre-3430 patch for dmtimer.c Syed Mohammed, Khasim
2007-06-21 10:15 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox