Devicetree
 help / color / mirror / Atom feed
* [PATCH 5/7] Samsung: SMDKV210: Init Timer Using Device tree
@ 2010-09-20 10:19 Shaju Abraham
       [not found] ` <1284977997-30807-1-git-send-email-shaju.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Shaju Abraham @ 2010-09-20 10:19 UTC (permalink / raw)
  To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

Get the irq number and virtual address to be used from the
device tree. Initialise the timer using these parameters.

Signed-off-by: Shaju Abraham <shaju.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/plat-s5p/irq_dt.c |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-s5p/irq_dt.c b/arch/arm/plat-s5p/irq_dt.c
index 2fca196..317348f 100644
--- a/arch/arm/plat-s5p/irq_dt.c
+++ b/arch/arm/plat-s5p/irq_dt.c
@@ -58,7 +58,28 @@ static struct s3c_uart_irq uart_irqs[] = {
 	},
 #endif
 };
+int s5p_dt_init_vic_timer_irq(void)
+{
+	struct device_node *node;
+	int err = -ENODEV, irq = 0;
+	const u32 *prop;
+	u32 virt_irq = 0;
 
+	for_each_compatible_node(node, NULL , "samsung,s5p-timer") {
+		prop = of_get_property(node, "interrupts", NULL);
+		if (prop == NULL) {
+			printk(KERN_ERR "No Irq defined for %s timer\n",
+				node->name);
+			return err;
+		}
+		irq = of_read_ulong(prop, 1);
+		s3c_init_vic_timer_irq(S5P_IRQ_VIC0(irq),
+					S5P_TIMER_IRQ(virt_irq));
+		virt_irq++;
+	}
+	of_node_put(node);
+	return 0;
+}
 
 static int __init s5p_dt_vic_init(void)
 {
@@ -88,11 +109,7 @@ void __init s5p_dt_init_irq(void)
 
 	/* initialize the VICs */
 	s5p_dt_vic_init();
-	s3c_init_vic_timer_irq(IRQ_TIMER0_VIC, IRQ_TIMER0);
-	s3c_init_vic_timer_irq(IRQ_TIMER1_VIC, IRQ_TIMER1);
-	s3c_init_vic_timer_irq(IRQ_TIMER2_VIC, IRQ_TIMER2);
-	s3c_init_vic_timer_irq(IRQ_TIMER3_VIC, IRQ_TIMER3);
-	s3c_init_vic_timer_irq(IRQ_TIMER4_VIC, IRQ_TIMER4);
-
+	if (s5p_dt_init_vic_timer_irq())
+		printk(KERN_ERR"s5p_dt Timer init Failed\n");
 	s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
 }
-- 
1.7.2

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

end of thread, other threads:[~2010-09-23 20:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-20 10:19 [PATCH 5/7] Samsung: SMDKV210: Init Timer Using Device tree Shaju Abraham
     [not found] ` <1284977997-30807-1-git-send-email-shaju.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2010-09-23 20:01   ` Grant Likely

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