Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-14 Thread Joel Fernandes
On 03/14/2014 07:13 PM, Suman Anna wrote:
> Hi Joel,
> 
> On 03/13/2014 03:35 PM, Joel Fernandes wrote:
>> We introduce functions to initialize clocksource and clockevent, use
>> CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the
>> clocksource
>> selection on a per-SoC basis (Currently only AM335x is supported).
>> Powering up
>> of the timer will be done with the help of the mach-omap layer function
>> that's
>> introduced earlier in the series.
>>
>> We make a local copy of dmtimer API for use by clocksource, the original
>> dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
>> completed after which it can't be deleted.
>>
>> Signed-off-by: Joel Fernandes 
>> ---
>>   drivers/clocksource/Makefile |1 +
>>   drivers/clocksource/omap-timer.c | 1157
>> ++
>>   drivers/clocksource/omap-timer.h |  422 ++
>>   3 files changed, 1580 insertions(+)
>>   create mode 100644 drivers/clocksource/omap-timer.c
>>   create mode 100644 drivers/clocksource/omap-timer.h
>>
>> diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
>> index c7ca50a..2ffe698 100644
>> --- a/drivers/clocksource/Makefile
>> +++ b/drivers/clocksource/Makefile
>> @@ -37,3 +37,4 @@ obj-$(CONFIG_ARM_ARCH_TIMER)+= arm_arch_timer.o
>>   obj-$(CONFIG_ARM_GLOBAL_TIMER)+= arm_global_timer.o
>>   obj-$(CONFIG_CLKSRC_METAG_GENERIC)+= metag_generic.o
>>   obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST)+= dummy_timer.o
>> +obj-y+= omap-timer.o
>> diff --git a/drivers/clocksource/omap-timer.c
>> b/drivers/clocksource/omap-timer.c
>> new file mode 100644
>> index 000..91593d8
>> --- /dev/null
>> +++ b/drivers/clocksource/omap-timer.c
>> @@ -0,0 +1,1157 @@
>> +/*
>> + * drivers/clocksource/omap-timer.c
>> + *
>> + * OMAP Dual-Mode Timers
>> + *
>> + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
>> + * Joel Fernandes 
>> + * Tarun Kanti DebBarma 
>> + * Thara Gopinath 
>> + *
>> + * dmtimer adaptation to platform_driver.
>> + *
>> + * Copyright (C) 2005 Nokia Corporation
>> + * OMAP2 support by Juha Yrjola
>> + * API improvements and OMAP2 clock framework support by Timo Teras
>> + *
>> + * Copyright (C) 2014 Texas Instruments
>> + * Added OMAP4 support - Santosh Shilimkar 
>> + *
>> + * This program is free software; you can redistribute it and/or modify it
>> + * under the terms of the GNU General Public License as published by the
>> + * Free Software Foundation; either version 2 of the License, or (at your
>> + * option) any later version.
>> + *
>> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
>> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
>> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
>> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
>> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
>> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
>> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> + *
>> + * You should have received a copy of the  GNU General Public License along
>> + * with this program; if not, write  to the Free Software Foundation, Inc.,
>> + * 675 Mass Ave, Cambridge, MA 02139, USA.
>> + */
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include "omap-timer.h"
>> +/*
>> + *  TODO: OMAP1 support removed due to need for header mach/hardware.h
>> + *OMAP2 support may be broken due to lack of cpu_is stuff, see
>> omap_dm_timer_get_errata
>> + */
>> +
>> +/**
>> + * omap_dm_timer_get_errata - get errata flags for a timer
>> + *
>> + * Get the timer errata flags that are specific to the OMAP device being
>> used.
>> + */
>> +static u32 __init omap_dm_timer_get_errata(void)
>> +{
>> +/* ifdef'd out due to lack of availaibility of soc.h */
>> +#if 0
>> +if (cpu_is_omap24xx())
>> +return 0;
> 
> You should be able to fix this using some compatible checks.

Thanks. I'll use of_device_is_compatible to check for that.

-Joel

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


Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-14 Thread Suman Anna

Hi Joel,

On 03/13/2014 03:35 PM, Joel Fernandes wrote:

We introduce functions to initialize clocksource and clockevent, use
CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the clocksource
selection on a per-SoC basis (Currently only AM335x is supported). Powering up
of the timer will be done with the help of the mach-omap layer function that's
introduced earlier in the series.

We make a local copy of dmtimer API for use by clocksource, the original
dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
completed after which it can't be deleted.

Signed-off-by: Joel Fernandes 
---
  drivers/clocksource/Makefile |1 +
  drivers/clocksource/omap-timer.c | 1157 ++
  drivers/clocksource/omap-timer.h |  422 ++
  3 files changed, 1580 insertions(+)
  create mode 100644 drivers/clocksource/omap-timer.c
  create mode 100644 drivers/clocksource/omap-timer.h

diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index c7ca50a..2ffe698 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -37,3 +37,4 @@ obj-$(CONFIG_ARM_ARCH_TIMER)  += arm_arch_timer.o
  obj-$(CONFIG_ARM_GLOBAL_TIMER)+= arm_global_timer.o
  obj-$(CONFIG_CLKSRC_METAG_GENERIC)+= metag_generic.o
  obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o
+obj-y  += omap-timer.o
diff --git a/drivers/clocksource/omap-timer.c b/drivers/clocksource/omap-timer.c
new file mode 100644
index 000..91593d8
--- /dev/null
+++ b/drivers/clocksource/omap-timer.c
@@ -0,0 +1,1157 @@
+/*
+ * drivers/clocksource/omap-timer.c
+ *
+ * OMAP Dual-Mode Timers
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ * Joel Fernandes 
+ * Tarun Kanti DebBarma 
+ * Thara Gopinath 
+ *
+ * dmtimer adaptation to platform_driver.
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * OMAP2 support by Juha Yrjola
+ * API improvements and OMAP2 clock framework support by Timo Teras
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Added OMAP4 support - Santosh Shilimkar 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the  GNU General Public License along
+ * with this program; if not, write  to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "omap-timer.h"
+/*
+ *  TODO: OMAP1 support removed due to need for header mach/hardware.h
+ *OMAP2 support may be broken due to lack of cpu_is stuff, see 
omap_dm_timer_get_errata
+ */
+
+/**
+ * omap_dm_timer_get_errata - get errata flags for a timer
+ *
+ * Get the timer errata flags that are specific to the OMAP device being used.
+ */
+static u32 __init omap_dm_timer_get_errata(void)
+{
+   /* ifdef'd out due to lack of availaibility of soc.h */
+#if 0
+   if (cpu_is_omap24xx())
+   return 0;


You should be able to fix this using some compatible checks.

regards
Suman


+#endif
+   return OMAP_TIMER_ERRATA_I103_I767;
+}
+
+


-snip-

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


Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-14 Thread Joel Fernandes
On 03/14/2014 02:32 PM, Joel Fernandes wrote:
> On 03/14/2014 10:52 AM, Tony Lindgren wrote:
>> * Joel Fernandes  [140313 16:52]:
>>> On 03/13/2014 03:48 PM, Tony Lindgren wrote:
 * Joel Fernandes  [140313 13:43]:
> We introduce functions to initialize clocksource and clockevent, use
> CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the 
> clocksource
> selection on a per-SoC basis (Currently only AM335x is supported). 
> Powering up
> of the timer will be done with the help of the mach-omap layer function 
> that's
> introduced earlier in the series.
>
> We make a local copy of dmtimer API for use by clocksource, the original
> dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
> completed after which it can't be deleted.
>
> Signed-off-by: Joel Fernandes 
> ---
>  drivers/clocksource/Makefile |1 +
>  drivers/clocksource/omap-timer.c | 1157 
> ++
>  drivers/clocksource/omap-timer.h |  422 ++
>  3 files changed, 1580 insertions(+)
>  create mode 100644 drivers/clocksource/omap-timer.c
>  create mode 100644 drivers/clocksource/omap-timer.h

 Hmm this leaves duplicate arch/arm/plat-omap/dmtimer.c code, please
>>>
>>> Sure, ofcourse- but how else can we make sure everything works while we do
>>> the migration in steps. We can get rid of the duplicate once everything is
>>> migrated.
>>
>> That's not doing incremental changes then. You're not even modifying
>> the existing omap_dm_timer functions, so please do the changes in incremental
>> steps where things keep working throughout the series.
> 
> That is much more work than appears- it is much easier to remove what you
> don't want after everything is moved, than to pick things up part by part
> and move it.. That way we also don't accidentally remove something we
> shouldn't be and introduced more regressions.. right?
> 
> Plus this is an RFC that I whipped up in 2 days so I didn't this
> expectations should be too high ;-)

s/this/think/

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


Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-14 Thread Joel Fernandes
On 03/14/2014 10:52 AM, Tony Lindgren wrote:
> * Joel Fernandes  [140313 16:52]:
>> On 03/13/2014 03:48 PM, Tony Lindgren wrote:
>>> * Joel Fernandes  [140313 13:43]:
 We introduce functions to initialize clocksource and clockevent, use
 CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the 
 clocksource
 selection on a per-SoC basis (Currently only AM335x is supported). 
 Powering up
 of the timer will be done with the help of the mach-omap layer function 
 that's
 introduced earlier in the series.

 We make a local copy of dmtimer API for use by clocksource, the original
 dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
 completed after which it can't be deleted.

 Signed-off-by: Joel Fernandes 
 ---
  drivers/clocksource/Makefile |1 +
  drivers/clocksource/omap-timer.c | 1157 
 ++
  drivers/clocksource/omap-timer.h |  422 ++
  3 files changed, 1580 insertions(+)
  create mode 100644 drivers/clocksource/omap-timer.c
  create mode 100644 drivers/clocksource/omap-timer.h
>>>
>>> Hmm this leaves duplicate arch/arm/plat-omap/dmtimer.c code, please
>>
>> Sure, ofcourse- but how else can we make sure everything works while we do
>> the migration in steps. We can get rid of the duplicate once everything is
>> migrated.
> 
> That's not doing incremental changes then. You're not even modifying
> the existing omap_dm_timer functions, so please do the changes in incremental
> steps where things keep working throughout the series.

That is much more work than appears- it is much easier to remove what you
don't want after everything is moved, than to pick things up part by part
and move it.. That way we also don't accidentally remove something we
shouldn't be and introduced more regressions.. right?

Plus this is an RFC that I whipped up in 2 days so I didn't this
expectations should be too high ;-)

>>> And not the that drivers/clocksource/omap-timer.h won't be needed at
>>> all, those defines can stay private to the drivers/clocksource/omap-timer.c.
>>
>> Actually- I wanted it separate because omap-timer.c is already huge at 1157
>> lines. Infact the largest among the clocksource drivers. Is that fair?
> 
> No need for it. We want to keep these functions private to the driver.

Ok, I can do that. I don't mind either way.

Thanks,
-Joel
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-14 Thread Tony Lindgren
* Joel Fernandes  [140313 16:52]:
> On 03/13/2014 03:48 PM, Tony Lindgren wrote:
> > * Joel Fernandes  [140313 13:43]:
> >> We introduce functions to initialize clocksource and clockevent, use
> >> CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the 
> >> clocksource
> >> selection on a per-SoC basis (Currently only AM335x is supported). 
> >> Powering up
> >> of the timer will be done with the help of the mach-omap layer function 
> >> that's
> >> introduced earlier in the series.
> >>
> >> We make a local copy of dmtimer API for use by clocksource, the original
> >> dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
> >> completed after which it can't be deleted.
> >>
> >> Signed-off-by: Joel Fernandes 
> >> ---
> >>  drivers/clocksource/Makefile |1 +
> >>  drivers/clocksource/omap-timer.c | 1157 
> >> ++
> >>  drivers/clocksource/omap-timer.h |  422 ++
> >>  3 files changed, 1580 insertions(+)
> >>  create mode 100644 drivers/clocksource/omap-timer.c
> >>  create mode 100644 drivers/clocksource/omap-timer.h
> > 
> > Hmm this leaves duplicate arch/arm/plat-omap/dmtimer.c code, please
> 
> Sure, ofcourse- but how else can we make sure everything works while we do
> the migration in steps. We can get rid of the duplicate once everything is
> migrated.

That's not doing incremental changes then. You're not even modifying
the existing omap_dm_timer functions, so please do the changes in incremental
steps where things keep working throughout the series.
 
> > sort out that issue too by allowing omap1 and omap3 still to use
> > the legacy timer init functions but with timer code under
> > drivers/clocksource/omap-timer.c.
> 
> Sorry, I didn't follow. I didn't see OMAP3 using legacy timer stuff. To me
> it looks like OMAP3 migration should be straight forward along the same
> lines as this RFC patchset. Could you elaborate a bit more what the legacy
> functions you mentioned for OMAP1 are? I will just like to keep everything
> in drivers/clocksource/ private for now till we're done migrating most
> platforms. IMO once we get system timers working for omap2+, then we can
> look into omap1 :)

Well omap3 is still also booting in legacy mode too.
 
> > And not the that drivers/clocksource/omap-timer.h won't be needed at
> > all, those defines can stay private to the drivers/clocksource/omap-timer.c.
> 
> Actually- I wanted it separate because omap-timer.c is already huge at 1157
> lines. Infact the largest among the clocksource drivers. Is that fair?

No need for it. We want to keep these functions private to the driver.
 
> > So this patch really should just be moving of the code to the new
> > location.
> 
> To be honest, its not just a simple moving of code, there are new things
> such as selecting correct timer, new functions for clockevent and
> clocksource init, different handling of clocks etc.

Those changes should then be separate patches to prepare things so
people can see what changes in arch/arm/plat-omap/dmtimer.c code.

Regards,

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


Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-13 Thread Joel Fernandes
On 03/13/2014 03:48 PM, Tony Lindgren wrote:
> * Joel Fernandes  [140313 13:43]:
>> We introduce functions to initialize clocksource and clockevent, use
>> CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the clocksource
>> selection on a per-SoC basis (Currently only AM335x is supported). Powering 
>> up
>> of the timer will be done with the help of the mach-omap layer function 
>> that's
>> introduced earlier in the series.
>>
>> We make a local copy of dmtimer API for use by clocksource, the original
>> dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
>> completed after which it can't be deleted.
>>
>> Signed-off-by: Joel Fernandes 
>> ---
>>  drivers/clocksource/Makefile |1 +
>>  drivers/clocksource/omap-timer.c | 1157 
>> ++
>>  drivers/clocksource/omap-timer.h |  422 ++
>>  3 files changed, 1580 insertions(+)
>>  create mode 100644 drivers/clocksource/omap-timer.c
>>  create mode 100644 drivers/clocksource/omap-timer.h
> 
> Hmm this leaves duplicate arch/arm/plat-omap/dmtimer.c code, please

Sure, ofcourse- but how else can we make sure everything works while we do
the migration in steps. We can get rid of the duplicate once everything is
migrated.

> sort out that issue too by allowing omap1 and omap3 still to use
> the legacy timer init functions but with timer code under
> drivers/clocksource/omap-timer.c.

Sorry, I didn't follow. I didn't see OMAP3 using legacy timer stuff. To me
it looks like OMAP3 migration should be straight forward along the same
lines as this RFC patchset. Could you elaborate a bit more what the legacy
functions you mentioned for OMAP1 are? I will just like to keep everything
in drivers/clocksource/ private for now till we're done migrating most
platforms. IMO once we get system timers working for omap2+, then we can
look into omap1 :)

> And not the that drivers/clocksource/omap-timer.h won't be needed at
> all, those defines can stay private to the drivers/clocksource/omap-timer.c.

Actually- I wanted it separate because omap-timer.c is already huge at 1157
lines. Infact the largest among the clocksource drivers. Is that fair?

> So this patch really should just be moving of the code to the new
> location.

To be honest, its not just a simple moving of code, there are new things
such as selecting correct timer, new functions for clockevent and
clocksource init, different handling of clocks etc.

Thanks,
-Joel
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-13 Thread Tony Lindgren
* Joel Fernandes  [140313 13:43]:
> We introduce functions to initialize clocksource and clockevent, use
> CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the clocksource
> selection on a per-SoC basis (Currently only AM335x is supported). Powering up
> of the timer will be done with the help of the mach-omap layer function that's
> introduced earlier in the series.
> 
> We make a local copy of dmtimer API for use by clocksource, the original
> dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
> completed after which it can't be deleted.
> 
> Signed-off-by: Joel Fernandes 
> ---
>  drivers/clocksource/Makefile |1 +
>  drivers/clocksource/omap-timer.c | 1157 
> ++
>  drivers/clocksource/omap-timer.h |  422 ++
>  3 files changed, 1580 insertions(+)
>  create mode 100644 drivers/clocksource/omap-timer.c
>  create mode 100644 drivers/clocksource/omap-timer.h

Hmm this leaves duplicate arch/arm/plat-omap/dmtimer.c code, please
sort out that issue too by allowing omap1 and omap3 still to use
the legacy timer init functions but with timer code under
drivers/clocksource/omap-timer.c.

And not the that drivers/clocksource/omap-timer.h won't be needed at
all, those defines can stay private to the drivers/clocksource/omap-timer.c.

So this patch really should just be moving of the code to the new
location.

Regards,

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


[RFC 4/5] clocksource: omap-timer: Introduce clocksource driver for OMAP SoCs

2014-03-13 Thread Joel Fernandes
We introduce functions to initialize clocksource and clockevent, use
CLOCKSOURCE_OF_DECLARE to declare the clocksource, and handle the clocksource
selection on a per-SoC basis (Currently only AM335x is supported). Powering up
of the timer will be done with the help of the mach-omap layer function that's
introduced earlier in the series.

We make a local copy of dmtimer API for use by clocksource, the original
dmtimer API in plat-omap is kept as-is till the migration of all SoCs is
completed after which it can't be deleted.

Signed-off-by: Joel Fernandes 
---
 drivers/clocksource/Makefile |1 +
 drivers/clocksource/omap-timer.c | 1157 ++
 drivers/clocksource/omap-timer.h |  422 ++
 3 files changed, 1580 insertions(+)
 create mode 100644 drivers/clocksource/omap-timer.c
 create mode 100644 drivers/clocksource/omap-timer.h

diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index c7ca50a..2ffe698 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -37,3 +37,4 @@ obj-$(CONFIG_ARM_ARCH_TIMER)  += arm_arch_timer.o
 obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o
 obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o
 obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST)  += dummy_timer.o
+obj-y  += omap-timer.o
diff --git a/drivers/clocksource/omap-timer.c b/drivers/clocksource/omap-timer.c
new file mode 100644
index 000..91593d8
--- /dev/null
+++ b/drivers/clocksource/omap-timer.c
@@ -0,0 +1,1157 @@
+/*
+ * drivers/clocksource/omap-timer.c
+ *
+ * OMAP Dual-Mode Timers
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ * Joel Fernandes 
+ * Tarun Kanti DebBarma 
+ * Thara Gopinath 
+ *
+ * dmtimer adaptation to platform_driver.
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * OMAP2 support by Juha Yrjola
+ * API improvements and OMAP2 clock framework support by Timo Teras
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Added OMAP4 support - Santosh Shilimkar 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the  GNU General Public License along
+ * with this program; if not, write  to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include "omap-timer.h"
+/*
+ *  TODO: OMAP1 support removed due to need for header mach/hardware.h
+ *OMAP2 support may be broken due to lack of cpu_is stuff, see 
omap_dm_timer_get_errata
+ */
+
+/**
+ * omap_dm_timer_get_errata - get errata flags for a timer
+ *
+ * Get the timer errata flags that are specific to the OMAP device being used.
+ */
+static u32 __init omap_dm_timer_get_errata(void)
+{
+   /* ifdef'd out due to lack of availaibility of soc.h */
+#if 0
+   if (cpu_is_omap24xx())
+   return 0;
+#endif
+   return OMAP_TIMER_ERRATA_I103_I767;
+}
+
+
+/* Below code borrowed from plat-omap/dmtimer.c, everything static'd */
+
+static u32 omap_reserved_systimers;
+static LIST_HEAD(omap_timer_list);
+static DEFINE_SPINLOCK(dm_timer_lock);
+
+enum {
+   REQUEST_ANY = 0,
+   REQUEST_BY_ID,
+   REQUEST_BY_CAP,
+   REQUEST_BY_NODE,
+};
+
+/**
+ * omap_dm_timer_read_reg - read timer registers in posted and non-posted mode
+ * @timer:  timer pointer over which read operation to perform
+ * @reg:lowest byte holds the register offset
+ *
+ * The posted mode bit is encoded in reg. Note that in posted mode write
+ * pending bit must be checked. Otherwise a read of a non completed write
+ * will produce an error.
+ */
+static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
+{
+   WARN_ON((reg & 0xff) < _OMAP_TIMER_WAKEUP_EN_OFFSET);
+   return __omap_dm_timer_read(timer, reg, timer->posted);
+}
+
+/**
+ * omap_dm_timer_write_reg - write timer registers in posted and non-posted 
mode
+ * @timer:  timer po