diff options
author | Keerthy <j-keerthy@ti.com> | 2015-08-18 05:41:15 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2015-09-05 13:37:20 -0400 |
commit | 532409aa1ba8b69d5a3dea159d4b1bd9adbd7a46 (patch) | |
tree | 490e74374ac5471ef1a93c265d4b9f7dd0d8e9b9 /drivers/rtc | |
parent | fff51e771eafc3b4fa6daf1372fd4a4023bb402b (diff) |
rtc: omap: Add internal clock enabling support
The rtc can be clocked by an internal 32K clock. Adding the support
to enable the same.
Signed-off-by: Keerthy <j-keerthy@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-omap.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 8b6355ffaff9..f31c0127dae0 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/of_device.h> | 25 | #include <linux/of_device.h> |
26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
27 | #include <linux/io.h> | 27 | #include <linux/io.h> |
28 | #include <linux/clk.h> | ||
28 | 29 | ||
29 | /* | 30 | /* |
30 | * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock | 31 | * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock |
@@ -132,6 +133,7 @@ struct omap_rtc_device_type { | |||
132 | struct omap_rtc { | 133 | struct omap_rtc { |
133 | struct rtc_device *rtc; | 134 | struct rtc_device *rtc; |
134 | void __iomem *base; | 135 | void __iomem *base; |
136 | struct clk *clk; | ||
135 | int irq_alarm; | 137 | int irq_alarm; |
136 | int irq_timer; | 138 | int irq_timer; |
137 | u8 interrupts_reg; | 139 | u8 interrupts_reg; |
@@ -553,6 +555,11 @@ static int omap_rtc_probe(struct platform_device *pdev) | |||
553 | if (rtc->irq_alarm <= 0) | 555 | if (rtc->irq_alarm <= 0) |
554 | return -ENOENT; | 556 | return -ENOENT; |
555 | 557 | ||
558 | rtc->clk = devm_clk_get(&pdev->dev, "int-clk"); | ||
559 | |||
560 | if (!IS_ERR(rtc->clk)) | ||
561 | clk_prepare_enable(rtc->clk); | ||
562 | |||
556 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 563 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
557 | rtc->base = devm_ioremap_resource(&pdev->dev, res); | 564 | rtc->base = devm_ioremap_resource(&pdev->dev, res); |
558 | if (IS_ERR(rtc->base)) | 565 | if (IS_ERR(rtc->base)) |
@@ -681,6 +688,9 @@ static int __exit omap_rtc_remove(struct platform_device *pdev) | |||
681 | 688 | ||
682 | device_init_wakeup(&pdev->dev, 0); | 689 | device_init_wakeup(&pdev->dev, 0); |
683 | 690 | ||
691 | if (!IS_ERR(rtc->clk)) | ||
692 | clk_disable_unprepare(rtc->clk); | ||
693 | |||
684 | rtc->type->unlock(rtc); | 694 | rtc->type->unlock(rtc); |
685 | /* leave rtc running, but disable irqs */ | 695 | /* leave rtc running, but disable irqs */ |
686 | rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0); | 696 | rtc_write(rtc, OMAP_RTC_INTERRUPTS_REG, 0); |