* [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
* Re: [PATCH 5/7] Samsung: SMDKV210: Init Timer Using Device tree
[not found] ` <1284977997-30807-1-git-send-email-shaju.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2010-09-23 20:01 ` Grant Likely
0 siblings, 0 replies; 2+ messages in thread
From: Grant Likely @ 2010-09-23 20:01 UTC (permalink / raw)
To: Shaju Abraham; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On Mon, Sep 20, 2010 at 03:49:57PM +0530, Shaju Abraham wrote:
> 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");
Ah, heh. Forget my comment from the last patch as you are doing what
I suggested here. You can probably merge this patch with the previous
patch.
> s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
> }
> --
> 1.7.2
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [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