summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-spear.c
AgeCommit message (Collapse)Author
2012-12-18rtc: rtc-spear: Provide flag for no support of UIE modeDeepak Sikri
The applications can set the RTC hardware to trigger interrupts in one of three modes: * AIE: Alarm interrupt * UIE: Update interrupt (ie: once per second) * PIE: Periodic interrupt (sub-second irqs) The above defined 3 modes are to be supported in the RTC HW in form of interrupts. The SPEAr RTC hardware does not support the later two modes. There have been refinements in the RTC core in mainline related to use of timer queue infrastructure to manage events in RTC. Please refer the below mentioned patch for details: * RTC: Rework RTC code to use timerqueue for events * SHA ID: 6610e0893b8bc6f59b14fed7f089c5997f035f88 There have been provisions added to support hardware that do not have support the UIE mode. Please refer the following patch. * rtc: Provide flag for rtc devices that don't support UIE * SHA ID: 4a649903f91232d02284d53724b0a45728111767 The patch makes use of the provision defined in the above patch to update the hardware status of UIE mode. Signed-off-by: Deepak Sikri <deepak.sikri@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-18rtc: rtc-spear: Add clk_{un}prepare() supportDeepak Sikri
clk_{un}prepare is mandatory for platforms using common clock framework. Because for SPEAr we don't do anything in clk_{un}prepare() calls, just call them once in probe/remove. Signed-off-by: Deepak Sikri <deepak.sikri@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-12-18rtc: rtc-spear: use devm_*() routinesViresh Kumar
Free the rtc-spear driver from tension of freeing resources :) devm_* derivatives of multiple routines are used while allocating resources, which would be freed automatically by kernel. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Deepak Sikri <deepak.sikri@st.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-10-05drivers/rtc/rtc-spear.c: fix several error checksLars-Peter Clausen
There are several comparisons of a unsigned int to less than zero int spear RTC driver. Such a check will always be true. In all these cases a signed int is assigned to the unsigned variable, which is checked, before. So the right fix is to make the checked variable signed as well. In one case the check can be dropped completely, because all it does it returns 'err' if 'err' is less than zero, otherwise it returns 0. Since in this particular case 'err' is always either 0 or less this is the same as just returning 'err'. The issue has been found using the following coccinelle semantic patch: //<smpl> @@ type T; unsigned T i; @@ ( *i < 0 | *i >= 0 ) //</smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Viresh Kumar <viresh.kumar@st.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-07-11drivers/rtc/rtc-spear.c: fix use-after-free in spear_rtc_remove()Devendra Naga
`config' is freed and is then used in the rtc_device_unregister() call, causing a kernel panic. Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Reviewed-by: Viresh Kumar <viresh.linux@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-29rtc/spear: add Device Tree probing capabilityViresh Kumar
SPEAr platforms now support DT and so must convert all drivers support DT. This patch adds DT probing support for rtc and updates its documentation too. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Cc: Stefan Roese <sr@denx.de> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Rajeev Kumar <rajeev-dlh.kumar@st.com> Cc: Rob Herring <robherring2@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-23rtc/rtc-spear: call platform_set_drvdata() before registering rtc deviceViresh Kumar
rtc_device_register() calls rtc-spear routines internally. These routines call dev_get_drvdata() to get struct spear_rtc_config. Currently, platform_set_drvdata is called after rtc device is registered. This causes system to crash, as dev_get_drvdata returns NULL. For this we need to call platform_set_drvdata() before registering rtc device. This requires further cleanup, that leads to removal of dev_set_drvdata on rtc->dev, which was just not required at all. Also, we change the parameter to request_irq and pass pointer to config instead of pointer to rtc struct. This patch brings all above changes. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Cc: Shiraz Hashim <shiraz.hashim@st.com> Cc: Deepak Sikri <deepak.sikri@st.com> Acked-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-23rtc/spear: fix for RTC_AIE_ON and RTC_AIE_OFF ioctl errorsShiraz Hashim
Define API for '.alarm_irq_enable' to enable and disable alarm irq. This is required by the framework else RTC_AIE_ON and RTC_AIE_OFF ioctls return errors. Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Cc: Deepak Sikri <deepak.sikri@st.com> Acked-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-23rtc-spear: fix for balancing the enable_irq_wake in Power MgmtDeepak Sikri
Handle the fix for unbalanced irq for the cases when enable_irq_wake fails, and a warning related to same is displayed on the console. The workaround is handled at the driver level. Signed-off-by: Deepak Sikri <deepak.sikri@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Acked-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> Cc: Shiraz Hashim <shiraz.hashim@st.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-11rtc: convert drivers/rtc/* to use module_platform_driver()Axel Lin
This patch converts the drivers in drivers/rtc/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Ben Dooks <ben@simtec.co.uk> Cc: John Stultz <john.stultz@linaro.org> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-05-27rtc: add support for spear rtcRajeev Kumar
Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>