RTC: DaVinci RTC driver
PATCH 1/1 RTC: DaVinci RTC driver
From: Miguel Aguilar <[email protected]>
This driver features:
* Alarm support.
* Periodic interrupt by using a timer include into the RTC module.
* The update interrupt is not supported by this RTC module.
This driver was tested on a DM365 EVM by using the rtc-test application from the Documentation/rtc.txt.
---
This was reviewed and discussed a while back[1] and I dropped the ball on submitting the final version. Here's the updated version rebased against v2.6.34-rc1.
drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-davinci.c | 673 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 684 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-davinci.c
drivers/rtc/Kconfig +10 -0
@@ -620,6 +620,16 @@ config RTC_DRV_NUC900 comment "on-CPU RTC drivers" +config RTC_DRV_DAVINCI + tristate "TI DaVinci RTC" + depends on ARCH_DAVINCI_DM365 + help + If you say yes here you get support for the RTC on the + DaVinci platforms (DM365). + + This driver can also be built as a module. If so, the module + will be called rtc-davinci. + config RTC_DRV_OMAP tristate "TI OMAP1" depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_DAVINCI_DA8XX
drivers/rtc/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o +obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o
drivers/rtc/rtc-davinci.c new file +673 -0
673 lines not on this page · raw message
Signature · 1 line
1.7.0.2
Quoted 5 lines · On Fri, 12 Mar 2010 11:08:33 -0800 Kevin Hilman <[email protected]>…
This driver was tested on a DM365 EVM by using the rtc-test application from the
Documentation/rtc.txt.Signed-off-by Miguel Aguilar <[email protected]>Signed-off-by Kevin Hilman <[email protected]>
Please add an email in MODULE_AUTHOR
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Kevin Hilman
Acked-by Alessandro ZummoQuoted 6 lines · Alessandro Zummo
Quoted 3 lines · On Fri, 12 Mar 2010 11:08:33 -0800 Kevin Hilman <[email protected]>…
This driver was tested on a DM365 EVM by using the rtc-test application from the
Documentation/rtc.txt.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Miguel Aguilar <[email protected]>Signed-off-by Kevin Hilman <[email protected]>Acked-by Alessandro Zummo <[email protected]>Please add an email in
MODULE_AUTHOR
Done. updated version below with your ack added.
Will you merge this via RTC subsystem, or should I merge it via the davinci platform tree?
Kevin
Quoted 1 line
From
9a058a643fd2df4b391871cf1932eef76a5cf2fdMon Sep 17 00:00:00 2001
From: Miguel Aguilar <[email protected]>
Date: Thu, 5 Nov 2009 08:51:34 -0600
Subject: [PATCH] RTC: DaVinci RTC driver
This driver features:
* Alarm support.
* Periodic interrupt by using a timer include into the RTC module.
* The update interrupt is not supported by this RTC module.
This driver was tested on a DM365 EVM by using the rtc-test application from the Documentation/rtc.txt.
--- drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-davinci.c | 673 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 684 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-davinci.c
drivers/rtc/Kconfig +10 -0
@@ -620,6 +620,16 @@ config RTC_DRV_NUC900 comment "on-CPU RTC drivers" +config RTC_DRV_DAVINCI + tristate "TI DaVinci RTC" + depends on ARCH_DAVINCI_DM365 + help + If you say yes here you get support for the RTC on the + DaVinci platforms (DM365). + + This driver can also be built as a module. If so, the module + will be called rtc-davinci. + config RTC_DRV_OMAP tristate "TI OMAP1" depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 || ARCH_DAVINCI_DA8XX
drivers/rtc/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_RTC_DRV_BQ32K) += rtc-bq32k.o obj-$(CONFIG_RTC_DRV_BQ4802) += rtc-bq4802.o obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o obj-$(CONFIG_RTC_DRV_COH901331) += rtc-coh901331.o +obj-$(CONFIG_RTC_DRV_DAVINCI) += rtc-davinci.o obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o obj-$(CONFIG_RTC_DRV_DS1286) += rtc-ds1286.o
drivers/rtc/rtc-davinci.c new file +673 -0
673 lines not on this page · raw message
Signature · 1 line
1.7.0.2
Quoted 2 lines · On Fri, 12 Mar 2010 14:09:29 -0800 Kevin Hilman <[email protected]>…
Will you merge this via RTC subsystem, or should I merge it via the davinci platform tree?
Use the davinci tree and I'll be grateful ;)
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Quoted 32 lines · On Fri, 12 Mar 2010 11:08:33 -0800 Kevin Hilman <[email protected]>…
drivers/rtc/rtc-davinci.c new file +32
-0+static int convertfromdays (u16 days,struct rtc_time *tm) +{ +int tmp_days, year, mon; + +for (year =2000 ;; year++) { + tmp_days =rtc_year_days (1 ,12 , year); +if (days >= tmp_days) + days -= tmp_days; +else { +for (mon =0 ;; mon++) { + tmp_days =rtc_month_days (mon, year); +if (days >= tmp_days) { + days -= tmp_days; + }else { + tm->tm_year = year -1900 ; + tm->tm_mon = mon; + tm->tm_mday = days +1 ; +break ; + } + } +break ; + } + } +return 0 ; +} + +static int convert2days (u16 *days,struct rtc_time *tm) +{ +int i; + *days =0 ; + +/* epoch == 1900 */
drivers/rtc/rtc-davinci.c line 289
Quoted 10 lines
drivers/rtc/rtc-davinci.c new file +10
-0+if (tm->tm_year <100 || tm->tm_year >199 ) +return -EINVAL ; + +for (i =2000 ; i <1900 + tm->tm_year; i++) + *days +=rtc_year_days (1 ,12 , i); + + *days +=rtc_year_days (tm->tm_mday, tm->tm_mon,1900 + tm->tm_year); + +return 0 ; +}
I'm looking suspiciously at these (slow-looking) functions. Are they really specific to this device, or could we be making better use of library code, or adding functionality to library code?
Quoted 3 lines · On Mon, 15 Mar 2010 14:20:24 -0700 Andrew Morton <[email protected]>…
I'm looking suspiciously at these (slow-looking) functions. Are they really specific to this device, or could we be making better use of library code, or adding functionality to library code?
I truly hope no other driver with similar needs ;)
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Quoted 1 line · On Mon, 15 Mar 2010 23:32:03 +0100 Alessandro Zummo <[email protected]>…
I truly hope no other driver with similar needs ;)
insert "there is" where appropriate..
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it