aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorVladimir Zapolskiy <vzapolskiy@gmail.com>2010-05-24 17:33:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-25 11:07:07 -0400
commit5cf8f57d44d16652336fabdd65e727a6e6f98cd5 (patch)
tree103df7c268ca001af6d2338020da2945bdf9bfdb /drivers/rtc
parent9f4123b78d02ba48e7e6e3cd9de789c9b85b557a (diff)
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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-mxc.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index d71fe61db1d6..25ec921db07c 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -379,7 +379,6 @@ static struct rtc_class_ops mxc_rtc_ops = {
379 379
380static int __init mxc_rtc_probe(struct platform_device *pdev) 380static int __init mxc_rtc_probe(struct platform_device *pdev)
381{ 381{
382 struct clk *clk;
383 struct resource *res; 382 struct resource *res;
384 struct rtc_device *rtc; 383 struct rtc_device *rtc;
385 struct rtc_plat_data *pdata = NULL; 384 struct rtc_plat_data *pdata = NULL;
@@ -402,14 +401,15 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
402 pdata->ioaddr = devm_ioremap(&pdev->dev, res->start, 401 pdata->ioaddr = devm_ioremap(&pdev->dev, res->start,
403 resource_size(res)); 402 resource_size(res));
404 403
405 clk = clk_get(&pdev->dev, "ckil"); 404 pdata->clk = clk_get(&pdev->dev, "rtc");
406 if (IS_ERR(clk)) { 405 if (IS_ERR(pdata->clk)) {
407 ret = PTR_ERR(clk); 406 dev_err(&pdev->dev, "unable to get clock!\n");
407 ret = PTR_ERR(pdata->clk);
408 goto exit_free_pdata; 408 goto exit_free_pdata;
409 } 409 }
410 410
411 rate = clk_get_rate(clk); 411 clk_enable(pdata->clk);
412 clk_put(clk); 412 rate = clk_get_rate(pdata->clk);
413 413
414 if (rate == 32768) 414 if (rate == 32768)
415 reg = RTC_INPUT_CLK_32768HZ; 415 reg = RTC_INPUT_CLK_32768HZ;
@@ -420,7 +420,7 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
420 else { 420 else {
421 dev_err(&pdev->dev, "rtc clock is not valid (%lu)\n", rate); 421 dev_err(&pdev->dev, "rtc clock is not valid (%lu)\n", rate);
422 ret = -EINVAL; 422 ret = -EINVAL;
423 goto exit_free_pdata; 423 goto exit_put_clk;
424 } 424 }
425 425
426 reg |= RTC_ENABLE_BIT; 426 reg |= RTC_ENABLE_BIT;
@@ -428,18 +428,9 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
428 if (((readw(pdata->ioaddr + RTC_RTCCTL)) & RTC_ENABLE_BIT) == 0) { 428 if (((readw(pdata->ioaddr + RTC_RTCCTL)) & RTC_ENABLE_BIT) == 0) {
429 dev_err(&pdev->dev, "hardware module can't be enabled!\n"); 429 dev_err(&pdev->dev, "hardware module can't be enabled!\n");
430 ret = -EIO; 430 ret = -EIO;
431 goto exit_free_pdata; 431 goto exit_put_clk;
432 }
433
434 pdata->clk = clk_get(&pdev->dev, "rtc");
435 if (IS_ERR(pdata->clk)) {
436 dev_err(&pdev->dev, "unable to get clock!\n");
437 ret = PTR_ERR(pdata->clk);
438 goto exit_free_pdata;
439 } 432 }
440 433
441 clk_enable(pdata->clk);
442
443 rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops, 434 rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops,
444 THIS_MODULE); 435 THIS_MODULE);
445 if (IS_ERR(rtc)) { 436 if (IS_ERR(rtc)) {