public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Adding dmtimer support for OMAP3
@ 2007-06-21 18:45 Syed Mohammed, Khasim
  2007-06-25  8:56 ` Tony Lindgren
  0 siblings, 1 reply; 7+ messages in thread
From: Syed Mohammed, Khasim @ 2007-06-21 18:45 UTC (permalink / raw)
  To: linux-omap-open-source

After incorporating Tony's changes.

DM timer support for OMAP3

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-06-21 08:19:04.000000000 -0500
+++ val_3430_GIT/arch/arm/plat-omap/dmtimer.c	2007-06-21 12:00:42.000000000 -0500
@@ -70,7 +70,7 @@
 struct omap_dm_timer {
 	unsigned long phys_base;
 	int irq;
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	struct clk *iclk, *fclk;
 #endif
 	void __iomem *io_base;
@@ -85,6 +85,9 @@ struct omap_dm_timer {
 #define omap2_dm_timers			NULL
 #define omap2_dm_source_names		NULL
 #define omap2_dm_source_clocks		NULL
+#define omap3_dm_timers			NULL
+#define omap3_dm_source_names		NULL
+#define omap3_dm_source_clocks		NULL
 
 static struct omap_dm_timer omap1_dm_timers[] = {
 	{ .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 },
@@ -104,6 +107,9 @@ static const int dm_timer_count = ARRAY_
 #define omap_dm_clk_enable(x)		clk_enable(x)
 #define omap_dm_clk_disable(x)		clk_disable(x)
 #define omap1_dm_timers			NULL
+#define omap3_dm_timers			NULL
+#define omap3_dm_source_names		NULL
+#define omap3_dm_source_clocks		NULL
 
 static struct omap_dm_timer omap2_dm_timers[] = {
 	{ .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 },
@@ -130,6 +136,40 @@ static const char *omap2_dm_source_names
 static struct clk **omap2_dm_source_clocks[3];
 static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
 
+#elif defined(CONFIG_ARCH_OMAP3)
+
+#define omap_dm_clk_enable(x)		clk_enable(x)
+#define omap_dm_clk_disable(x)		clk_disable(x)
+#define omap1_dm_timers			NULL
+#define omap2_dm_timers			NULL
+#define omap2_dm_source_names		NULL
+#define omap2_dm_source_clocks		NULL
+
+static struct omap_dm_timer omap3_dm_timers[] = {
+	{ .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 },
+	{ .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 },
+	{ .phys_base = 0x49034000, .irq = INT_24XX_GPTIMER3 },
+	{ .phys_base = 0x49036000, .irq = INT_24XX_GPTIMER4 },
+	{ .phys_base = 0x49038000, .irq = INT_24XX_GPTIMER5 },
+	{ .phys_base = 0x4903A000, .irq = INT_24XX_GPTIMER6 },
+	{ .phys_base = 0x4903C000, .irq = INT_24XX_GPTIMER7 },
+	{ .phys_base = 0x4903E000, .irq = INT_24XX_GPTIMER8 },
+	{ .phys_base = 0x49040000, .irq = INT_24XX_GPTIMER9 },
+	{ .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 },
+	{ .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 },
+	{ .phys_base = 0x48304000, .irq = INT_24XX_GPTIMER12 },
+};
+
+static const char *omap3_dm_source_names[] __initdata = {
+	"sys_ck",
+	"func_32k_ck",
+	"alt_ck",
+	NULL
+};
+
+static struct clk **omap3_dm_source_clocks[3];
+static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers);
+
 #else
 
 #error OMAP architecture not supported!
@@ -310,7 +350,7 @@ __u32 omap_dm_timer_modify_idlect_mask(_
 	return inputmask;
 }
 
-#elif defined(CONFIG_ARCH_OMAP2)
+#elif defined(CONFIG_ARCH_OMAP2) || defined (CONFIG_ARCH_OMAP3)
 
 struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 {
@@ -502,7 +542,7 @@ int __init omap_dm_timer_init(void)
 	struct omap_dm_timer *timer;
 	int i;
 
-	if (!(cpu_is_omap16xx() || cpu_is_omap24xx()))
+	if (!(cpu_is_omap16xx() || cpu_class_is_omap2()))
 		return -ENODEV;
 
 	spin_lock_init(&dm_timer_lock);
@@ -513,6 +553,10 @@ int __init omap_dm_timer_init(void)
 		dm_timers = omap2_dm_timers;
 		dm_source_names = (char **)omap2_dm_source_names;
 		dm_source_clocks = (struct clk **)omap2_dm_source_clocks;
+	} else if (cpu_is_omap34xx()) {
+		dm_timers = omap3_dm_timers;
+		dm_source_names = (char **)omap3_dm_source_names;
+		dm_source_clocks = (struct clk **)omap3_dm_source_clocks;
 	}
 
 	if (cpu_class_is_omap2())
@@ -525,7 +569,7 @@ int __init omap_dm_timer_init(void)
 	for (i = 0; i < dm_timer_count; i++) {
 		timer = &dm_timers[i];
 		timer->io_base = (void __iomem *)io_p2v(timer->phys_base);
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 		if (cpu_class_is_omap2()) {
 			char clk_name[16];
 			sprintf(clk_name, "gpt%d_ick", i + 1);

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] Adding dmtimer support for OMAP3
@ 2007-06-21  3:14 Syed Mohammed, Khasim
  2007-06-21  3:22 ` Syed Mohammed, Khasim
  0 siblings, 1 reply; 7+ messages in thread
From: Syed Mohammed, Khasim @ 2007-06-21  3:14 UTC (permalink / raw)
  To: linux-omap-open-source

DM timer support for OMAP3. This patch should be applied on top of dmtimer pre-patch

Signed-off-by: Syed Mohammed Khasim  <x0khasim@ti.com>

Files:
 arch/arm/plat-omap/dmtimer.c

=======================================================================
--- lin_for_mmc/arch/arm/plat-omap/dmtimer.c	2007-06-20 19:29:54.000000000 -0500
+++ val_3430_GIT/arch/arm/plat-omap/dmtimer.c	2007-06-20 19:51:44.000000000 -0500
@@ -70,7 +70,7 @@
 struct omap_dm_timer {
 	unsigned long phys_base;
 	int irq;
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	struct clk *iclk, *fclk;
 #endif
 	void __iomem *io_base;
@@ -78,7 +78,7 @@ struct omap_dm_timer {
 	unsigned enabled:1;
 };
 
-#ifdef CONFIG_ARCH_OMAP1
+#if defined(CONFIG_ARCH_OMAP1)
 
 #define omap_dm_clk_enable(x)
 #define omap_dm_clk_disable(x)
@@ -100,6 +100,10 @@ static struct omap_dm_timer omap2_dm_tim
 static const char *omap2_dm_source_names[]	= {};
 static struct clk omap2_dm_source_clocks[1];
 
+static struct clk omap3_dm_source_clocks[1];
+static struct omap_dm_timer omap3_dm_timers[]	= {};
+static const char *omap3_dm_source_names[]	= {};
+
 #elif defined(CONFIG_ARCH_OMAP2)
 
 #define omap_dm_clk_enable(x) clk_enable(x)
@@ -129,9 +133,50 @@ static const char *omap2_dm_source_names
 };
 
 static struct clk *omap2_dm_source_clocks[3];
+
+static struct clk *omap3_dm_source_clocks[1];
+static struct omap_dm_timer omap3_dm_timers[]	= {};
+static const char *omap3_dm_source_names[]	= {};
+
 static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
 static const int dm_source_names_count = ARRAY_SIZE(omap2_dm_source_names);
 
+#elif defined(CONFIG_ARCH_OMAP3)
+
+#define omap_dm_clk_enable(x) clk_enable(x)
+#define omap_dm_clk_disable(x) clk_disable(x)
+
+static struct clk *omap2_dm_source_clocks[1];
+static struct omap_dm_timer omap1_dm_timers[]	= {};
+static struct omap_dm_timer omap2_dm_timers[]	= {};
+static const char *omap2_dm_source_names[]	= {};
+
+static struct omap_dm_timer omap3_dm_timers[] = {
+	{ .phys_base	= 0x48318000, .irq	= INT_24XX_GPTIMER1 },
+	{ .phys_base	= 0x49032000, .irq	= INT_24XX_GPTIMER2 },
+	{ .phys_base	= 0x49034000, .irq	= INT_24XX_GPTIMER3 },
+	{ .phys_base	= 0x49036000, .irq	= INT_24XX_GPTIMER4 },
+	{ .phys_base	= 0x49038000, .irq	= INT_24XX_GPTIMER5 },
+	{ .phys_base	= 0x4903A000, .irq	= INT_24XX_GPTIMER6 },
+	{ .phys_base	= 0x4903C000, .irq	= INT_24XX_GPTIMER7 },
+	{ .phys_base	= 0x4903E000, .irq	= INT_24XX_GPTIMER8 },
+	{ .phys_base	= 0x49040000, .irq	= INT_24XX_GPTIMER9 },
+	{ .phys_base	= 0x48086000, .irq	= INT_24XX_GPTIMER10 },
+	{ .phys_base	= 0x48088000, .irq	= INT_24XX_GPTIMER11 },
+	{ .phys_base	= 0x48304000, .irq	= INT_24XX_GPTIMER12 },
+};
+
+static const char *omap3_dm_source_names[] = {
+	"sys_ck",
+	"func_32k_ck",
+	"alt_ck"
+};
+
+static struct clk *omap3_dm_source_clocks[3];
+
+static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers);
+static const int dm_source_names_count = ARRAY_SIZE(omap3_dm_source_names);
+
 #else
 
 #error OMAP architecture not supported!
@@ -235,7 +280,6 @@ struct omap_dm_timer *omap_dm_timer_requ
 		dump_stack();
 		return NULL;
 	}
-
 	timer = &dm_timers[id-1];
 	timer->reserved = 1;
 	spin_unlock_irqrestore(&dm_timer_lock, flags);
@@ -312,7 +356,7 @@ __u32 omap_dm_timer_modify_idlect_mask(_
 	return inputmask;
 }
 
-#elif defined(CONFIG_ARCH_OMAP2)
+#elif defined(CONFIG_ARCH_OMAP2) || defined (CONFIG_ARCH_OMAP3)
 
 struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 {
@@ -504,7 +548,7 @@ int omap_dm_timer_init(void)
 	struct omap_dm_timer *timer;
 	int i;
 
-	if (!(cpu_is_omap16xx() || cpu_is_omap24xx()))
+	if (!(cpu_is_omap16xx() || cpu_class_is_omap2()))
 		return -ENODEV;
 
 	spin_lock_init(&dm_timer_lock);
@@ -515,9 +559,13 @@ int omap_dm_timer_init(void)
 		dm_timers = omap2_dm_timers;
 		dm_source_names  = (unsigned long *) omap2_dm_source_names;
 		dm_source_clocks = (unsigned long *) omap2_dm_source_clocks;
+	} else if (cpu_is_omap34xx()) {
+		dm_timers = omap3_dm_timers;
+		dm_source_names  = (unsigned long *) omap3_dm_source_names;
+		dm_source_clocks = (unsigned long *) omap3_dm_source_clocks;
 	}
 
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	for (i = 0; i < dm_source_names_count; i++) {
 		dm_source_clocks[i] = (unsigned long)
 			clk_get(NULL, (unsigned char *)dm_source_names[i]);
@@ -528,13 +576,13 @@ int omap_dm_timer_init(void)
 		dm_timers[0].phys_base = 0x49018000;
 
 	for (i = 0; i < dm_timer_count; i++) {
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 		char clk_name[16];
 #endif
 
 		timer = &dm_timers[i];
 		timer->io_base = (void __iomem *) io_p2v(timer->phys_base);
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 		sprintf(clk_name, "gpt%d_ick", i + 1);
 		timer->iclk = clk_get(NULL, clk_name);
 		sprintf(clk_name, "gpt%d_fck", i + 1);

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] Adding dmtimer support for OMAP3
@ 2007-06-21  3:14 Syed Mohammed, Khasim
  2007-06-21 11:10 ` Tony Lindgren
  0 siblings, 1 reply; 7+ messages in thread
From: Syed Mohammed, Khasim @ 2007-06-21  3:14 UTC (permalink / raw)
  To: linux-omap-open-source

DM timer support for OMAP3. This patch should be applied on top of dmtimer pre-patch

Signed-off-by: Syed Mohammed Khasim  <x0khasim@ti.com>

Files:
 arch/arm/plat-omap/dmtimer.c

=======================================================================
--- lin_for_mmc/arch/arm/plat-omap/dmtimer.c	2007-06-20 19:29:54.000000000 -0500
+++ val_3430_GIT/arch/arm/plat-omap/dmtimer.c	2007-06-20 19:51:44.000000000 -0500
@@ -70,7 +70,7 @@
 struct omap_dm_timer {
 	unsigned long phys_base;
 	int irq;
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	struct clk *iclk, *fclk;
 #endif
 	void __iomem *io_base;
@@ -78,7 +78,7 @@ struct omap_dm_timer {
 	unsigned enabled:1;
 };
 
-#ifdef CONFIG_ARCH_OMAP1
+#if defined(CONFIG_ARCH_OMAP1)
 
 #define omap_dm_clk_enable(x)
 #define omap_dm_clk_disable(x)
@@ -100,6 +100,10 @@ static struct omap_dm_timer omap2_dm_tim
 static const char *omap2_dm_source_names[]	= {};
 static struct clk omap2_dm_source_clocks[1];
 
+static struct clk omap3_dm_source_clocks[1];
+static struct omap_dm_timer omap3_dm_timers[]	= {};
+static const char *omap3_dm_source_names[]	= {};
+
 #elif defined(CONFIG_ARCH_OMAP2)
 
 #define omap_dm_clk_enable(x) clk_enable(x)
@@ -129,9 +133,50 @@ static const char *omap2_dm_source_names
 };
 
 static struct clk *omap2_dm_source_clocks[3];
+
+static struct clk *omap3_dm_source_clocks[1];
+static struct omap_dm_timer omap3_dm_timers[]	= {};
+static const char *omap3_dm_source_names[]	= {};
+
 static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers);
 static const int dm_source_names_count = ARRAY_SIZE(omap2_dm_source_names);
 
+#elif defined(CONFIG_ARCH_OMAP3)
+
+#define omap_dm_clk_enable(x) clk_enable(x)
+#define omap_dm_clk_disable(x) clk_disable(x)
+
+static struct clk *omap2_dm_source_clocks[1];
+static struct omap_dm_timer omap1_dm_timers[]	= {};
+static struct omap_dm_timer omap2_dm_timers[]	= {};
+static const char *omap2_dm_source_names[]	= {};
+
+static struct omap_dm_timer omap3_dm_timers[] = {
+	{ .phys_base	= 0x48318000, .irq	= INT_24XX_GPTIMER1 },
+	{ .phys_base	= 0x49032000, .irq	= INT_24XX_GPTIMER2 },
+	{ .phys_base	= 0x49034000, .irq	= INT_24XX_GPTIMER3 },
+	{ .phys_base	= 0x49036000, .irq	= INT_24XX_GPTIMER4 },
+	{ .phys_base	= 0x49038000, .irq	= INT_24XX_GPTIMER5 },
+	{ .phys_base	= 0x4903A000, .irq	= INT_24XX_GPTIMER6 },
+	{ .phys_base	= 0x4903C000, .irq	= INT_24XX_GPTIMER7 },
+	{ .phys_base	= 0x4903E000, .irq	= INT_24XX_GPTIMER8 },
+	{ .phys_base	= 0x49040000, .irq	= INT_24XX_GPTIMER9 },
+	{ .phys_base	= 0x48086000, .irq	= INT_24XX_GPTIMER10 },
+	{ .phys_base	= 0x48088000, .irq	= INT_24XX_GPTIMER11 },
+	{ .phys_base	= 0x48304000, .irq	= INT_24XX_GPTIMER12 },
+};
+
+static const char *omap3_dm_source_names[] = {
+	"sys_ck",
+	"func_32k_ck",
+	"alt_ck"
+};
+
+static struct clk *omap3_dm_source_clocks[3];
+
+static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers);
+static const int dm_source_names_count = ARRAY_SIZE(omap3_dm_source_names);
+
 #else
 
 #error OMAP architecture not supported!
@@ -235,7 +280,6 @@ struct omap_dm_timer *omap_dm_timer_requ
 		dump_stack();
 		return NULL;
 	}
-
 	timer = &dm_timers[id-1];
 	timer->reserved = 1;
 	spin_unlock_irqrestore(&dm_timer_lock, flags);
@@ -312,7 +356,7 @@ __u32 omap_dm_timer_modify_idlect_mask(_
 	return inputmask;
 }
 
-#elif defined(CONFIG_ARCH_OMAP2)
+#elif defined(CONFIG_ARCH_OMAP2) || defined (CONFIG_ARCH_OMAP3)
 
 struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer)
 {
@@ -504,7 +548,7 @@ int omap_dm_timer_init(void)
 	struct omap_dm_timer *timer;
 	int i;
 
-	if (!(cpu_is_omap16xx() || cpu_is_omap24xx()))
+	if (!(cpu_is_omap16xx() || cpu_class_is_omap2()))
 		return -ENODEV;
 
 	spin_lock_init(&dm_timer_lock);
@@ -515,9 +559,13 @@ int omap_dm_timer_init(void)
 		dm_timers = omap2_dm_timers;
 		dm_source_names  = (unsigned long *) omap2_dm_source_names;
 		dm_source_clocks = (unsigned long *) omap2_dm_source_clocks;
+	} else if (cpu_is_omap34xx()) {
+		dm_timers = omap3_dm_timers;
+		dm_source_names  = (unsigned long *) omap3_dm_source_names;
+		dm_source_clocks = (unsigned long *) omap3_dm_source_clocks;
 	}
 
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 	for (i = 0; i < dm_source_names_count; i++) {
 		dm_source_clocks[i] = (unsigned long)
 			clk_get(NULL, (unsigned char *)dm_source_names[i]);
@@ -528,13 +576,13 @@ int omap_dm_timer_init(void)
 		dm_timers[0].phys_base = 0x49018000;
 
 	for (i = 0; i < dm_timer_count; i++) {
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 		char clk_name[16];
 #endif
 
 		timer = &dm_timers[i];
 		timer->io_base = (void __iomem *) io_p2v(timer->phys_base);
-#ifdef CONFIG_ARCH_OMAP2
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 		sprintf(clk_name, "gpt%d_ick", i + 1);
 		timer->iclk = clk_get(NULL, clk_name);
 		sprintf(clk_name, "gpt%d_fck", i + 1);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-06-25  8:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 18:45 [PATCH] Adding dmtimer support for OMAP3 Syed Mohammed, Khasim
2007-06-25  8:56 ` Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2007-06-21  3:14 Syed Mohammed, Khasim
2007-06-21  3:22 ` Syed Mohammed, Khasim
2007-06-21  3:14 Syed Mohammed, Khasim
2007-06-21 11:10 ` Tony Lindgren
2007-06-21 13:16   ` Syed Mohammed, Khasim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox