From ded12950dfd6edb2f9a52f2ca36d0e9c253b46da Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 10 Jul 2014 18:07:32 +0900 Subject: [PATCH] rtc: s3c: Control RTC's source clock This patch control source clock(32.768KHz) for RTC block. If source clock of RTC is registerd on clock list of common clk framework, Exynos RTC drvier have to control this clock. Clock list for s3c-rtc device: - rtc : CLK_RTC of CLK_GATE_IP_PERIR is gate clock for RTC. - rtc_src_clk : XrtcXTI is 32.768.kHz source clock for RTC. Signed-off-by: Chanwoo Choi --- drivers/rtc/rtc-s3c.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 0b495e8..8fff2d9 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -47,6 +47,7 @@ struct s3c_rtc_drv_data { * of these rtc blocks in */ static struct clk *rtc_clk; +static struct clk *rtc_src_clk; static void __iomem *s3c_rtc_base; static int s3c_rtc_alarmno = NO_IRQ; static int s3c_rtc_tickno = NO_IRQ; @@ -425,6 +426,7 @@ static int s3c_rtc_remove(struct platform_device *dev) s3c_rtc_setaie(&dev->dev, 0); + clk_disable_unprepare(rtc_src_clk); clk_unprepare(rtc_clk); rtc_clk = NULL; @@ -483,7 +485,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) rtc_clk = devm_clk_get(&pdev->dev, "rtc"); if (IS_ERR(rtc_clk)) { - dev_err(&pdev->dev, "failed to find rtc clock source\n"); + dev_err(&pdev->dev, "failed to find rtc gate clock\n"); ret = PTR_ERR(rtc_clk); rtc_clk = NULL; return ret; @@ -491,6 +493,14 @@ static int s3c_rtc_probe(struct platform_device *pdev) clk_prepare_enable(rtc_clk); + rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src_clk"); + if (IS_ERR(rtc_src_clk)) { + dev_warn(&pdev->dev, "failed to find rtc source clock\n"); + rtc_src_clk = NULL; + } + + clk_prepare_enable(rtc_src_clk); + /* check to see if everything is setup correctly */ s3c_rtc_enable(pdev, 1); @@ -568,6 +578,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) err_nortc: s3c_rtc_enable(pdev, 0); + clk_disable_unprepare(rtc_src_clk); clk_disable_unprepare(rtc_clk); return ret; -- 2.7.4