diff mbox

[2/2] ARM: OMAP4: Add local timer support for Device Tree

Message ID 1341839470-5586-3-git-send-email-santosh.shilimkar@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Santosh Shilimkar July 9, 2012, 1:11 p.m. UTC
Add cortex-a9 local timer  support for all OMAP4 based
SOCs using DT.

Cc: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 arch/arm/boot/dts/omap4.dtsi |    6 ++++++
 arch/arm/mach-omap2/timer.c  |   11 ++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

Comments

Tony Lindgren July 9, 2012, 1:15 p.m. UTC | #1
* Santosh Shilimkar <santosh.shilimkar@ti.com> [120709 06:16]:
> Add cortex-a9 local timer  support for all OMAP4 based
> SOCs using DT.
...

> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -36,6 +36,7 @@
>  #include <linux/clocksource.h>
>  #include <linux/clockchips.h>
>  #include <linux/slab.h>
> +#include <linux/of.h>
>  
>  #include <asm/mach/time.h>
>  #include <plat/dmtimer.h>
> @@ -384,9 +385,13 @@ static void __init omap4_timer_init(void)
>  	if (omap_rev() != OMAP4430_REV_ES1_0) {
>  		int err;
>  
> -		err = twd_local_timer_register(&twd_local_timer);
> -		if (err)
> -			pr_err("twd_local_timer_register failed %d\n", err);
> +		if (of_have_populated_dt()) {
> +			twd_local_timer_of_register();
> +		} else {
> +			err = twd_local_timer_register(&twd_local_timer);
> +			if (err)
> +				pr_err("twd_local_timer_register failed %d\n", err);
> +		}
>  	}
>  #endif
>  }

How about just return after twd_local_timer_of_register() instead?
That avoids nesting the code further.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Santosh Shilimkar July 9, 2012, 1:25 p.m. UTC | #2
On Mon, Jul 9, 2012 at 6:45 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Santosh Shilimkar <santosh.shilimkar@ti.com> [120709 06:16]:
>> Add cortex-a9 local timer  support for all OMAP4 based
>> SOCs using DT.
> ...
>
>> --- a/arch/arm/mach-omap2/timer.c
>> +++ b/arch/arm/mach-omap2/timer.c
>> @@ -36,6 +36,7 @@
>>  #include <linux/clocksource.h>
>>  #include <linux/clockchips.h>
>>  #include <linux/slab.h>
>> +#include <linux/of.h>
>>
>>  #include <asm/mach/time.h>
>>  #include <plat/dmtimer.h>
>> @@ -384,9 +385,13 @@ static void __init omap4_timer_init(void)
>>       if (omap_rev() != OMAP4430_REV_ES1_0) {
>>               int err;
>>
>> -             err = twd_local_timer_register(&twd_local_timer);
>> -             if (err)
>> -                     pr_err("twd_local_timer_register failed %d\n", err);
>> +             if (of_have_populated_dt()) {
>> +                     twd_local_timer_of_register();
>> +             } else {
>> +                     err = twd_local_timer_register(&twd_local_timer);
>> +                     if (err)
>> +                             pr_err("twd_local_timer_register failed %d\n", err);
>> +             }
>>       }
>>  #endif
>>  }
>
> How about just return after twd_local_timer_of_register() instead?
> That avoids nesting the code further.
>
Yep. Make sense. Will consider that in next version.

Regards
Santosh
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 57f7cd4..8504397 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -43,6 +43,12 @@ 
 		cache-level = <2>;
 	};
 
+	local-timer {
+		compatible = "arm,cortex-a9-twd-timer";
+		reg = <0x48240600 0x20>;
+		interrupts = <1 13 0x304>;
+	};
+
 	/*
 	 * The soc node represents the soc top level view. It is uses for IPs
 	 * that are not memory mapped in the MPU view or for the MPU itself.
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 840929b..dbdd9a6 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -36,6 +36,7 @@ 
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 #include <asm/mach/time.h>
 #include <plat/dmtimer.h>
@@ -384,9 +385,13 @@  static void __init omap4_timer_init(void)
 	if (omap_rev() != OMAP4430_REV_ES1_0) {
 		int err;
 
-		err = twd_local_timer_register(&twd_local_timer);
-		if (err)
-			pr_err("twd_local_timer_register failed %d\n", err);
+		if (of_have_populated_dt()) {
+			twd_local_timer_of_register();
+		} else {
+			err = twd_local_timer_register(&twd_local_timer);
+			if (err)
+				pr_err("twd_local_timer_register failed %d\n", err);
+		}
 	}
 #endif
 }