瀏覽代碼

rtc-mxc: remove unnecessary clock source for rtc subsystem

On imx SoCs rtc clock parent is CKIL, but clock rate shall be determined
using rtc clock itself, that eliminates CKIL clock usage in the driver.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Daniel Mack <daniel@caiaq.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Vladimir Zapolskiy 15 年之前
父節點
當前提交
5cf8f57d44
共有 1 個文件被更改,包括 8 次插入17 次删除
  1. 8 17
      drivers/rtc/rtc-mxc.c

+ 8 - 17
drivers/rtc/rtc-mxc.c

@@ -379,7 +379,6 @@ static struct rtc_class_ops mxc_rtc_ops = {
 
 
 static int __init mxc_rtc_probe(struct platform_device *pdev)
 static int __init mxc_rtc_probe(struct platform_device *pdev)
 {
 {
-	struct clk *clk;
 	struct resource *res;
 	struct resource *res;
 	struct rtc_device *rtc;
 	struct rtc_device *rtc;
 	struct rtc_plat_data *pdata = NULL;
 	struct rtc_plat_data *pdata = NULL;
@@ -402,14 +401,15 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
 	pdata->ioaddr = devm_ioremap(&pdev->dev, res->start,
 	pdata->ioaddr = devm_ioremap(&pdev->dev, res->start,
 				     resource_size(res));
 				     resource_size(res));
 
 
-	clk = clk_get(&pdev->dev, "ckil");
-	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
+	pdata->clk = clk_get(&pdev->dev, "rtc");
+	if (IS_ERR(pdata->clk)) {
+		dev_err(&pdev->dev, "unable to get clock!\n");
+		ret = PTR_ERR(pdata->clk);
 		goto exit_free_pdata;
 		goto exit_free_pdata;
 	}
 	}
 
 
-	rate = clk_get_rate(clk);
-	clk_put(clk);
+	clk_enable(pdata->clk);
+	rate = clk_get_rate(pdata->clk);
 
 
 	if (rate == 32768)
 	if (rate == 32768)
 		reg = RTC_INPUT_CLK_32768HZ;
 		reg = RTC_INPUT_CLK_32768HZ;
@@ -420,7 +420,7 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
 	else {
 	else {
 		dev_err(&pdev->dev, "rtc clock is not valid (%lu)\n", rate);
 		dev_err(&pdev->dev, "rtc clock is not valid (%lu)\n", rate);
 		ret = -EINVAL;
 		ret = -EINVAL;
-		goto exit_free_pdata;
+		goto exit_put_clk;
 	}
 	}
 
 
 	reg |= RTC_ENABLE_BIT;
 	reg |= RTC_ENABLE_BIT;
@@ -428,18 +428,9 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
 	if (((readw(pdata->ioaddr + RTC_RTCCTL)) & RTC_ENABLE_BIT) == 0) {
 	if (((readw(pdata->ioaddr + RTC_RTCCTL)) & RTC_ENABLE_BIT) == 0) {
 		dev_err(&pdev->dev, "hardware module can't be enabled!\n");
 		dev_err(&pdev->dev, "hardware module can't be enabled!\n");
 		ret = -EIO;
 		ret = -EIO;
-		goto exit_free_pdata;
-	}
-
-	pdata->clk = clk_get(&pdev->dev, "rtc");
-	if (IS_ERR(pdata->clk)) {
-		dev_err(&pdev->dev, "unable to get clock!\n");
-		ret = PTR_ERR(pdata->clk);
-		goto exit_free_pdata;
+		goto exit_put_clk;
 	}
 	}
 
 
-	clk_enable(pdata->clk);
-
 	rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops,
 	rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops,
 				  THIS_MODULE);
 				  THIS_MODULE);
 	if (IS_ERR(rtc)) {
 	if (IS_ERR(rtc)) {