diff options
author | Atul Dahiya <atul.dahiya@samsung.com> | 2010-07-20 02:49:14 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2010-08-05 05:32:51 -0400 |
commit | e48add8c1c462fb10d6297b739a57ef599eb02ae (patch) | |
tree | 16baea53f387c22ab9df44a06d033e8d632b710b | |
parent | 32fc7fb3b9b3e4b9361bda2d42921f71fe279d77 (diff) |
rtc: rtc-s3c: Updates RTC driver for clock enabling support
This Patch updates existing Samsung RTC driver for clock enabling support.
Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Acked-by: Wan ZongShun <mcuos.com@gmail.com>
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 70b68d35f969..c032a15c84ab 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -1,5 +1,8 @@ | |||
1 | /* drivers/rtc/rtc-s3c.c | 1 | /* drivers/rtc/rtc-s3c.c |
2 | * | 2 | * |
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
3 | * Copyright (c) 2004,2006 Simtec Electronics | 6 | * Copyright (c) 2004,2006 Simtec Electronics |
4 | * Ben Dooks, <ben@simtec.co.uk> | 7 | * Ben Dooks, <ben@simtec.co.uk> |
5 | * http://armlinux.simtec.co.uk/ | 8 | * http://armlinux.simtec.co.uk/ |
@@ -39,6 +42,7 @@ enum s3c_cpu_type { | |||
39 | 42 | ||
40 | static struct resource *s3c_rtc_mem; | 43 | static struct resource *s3c_rtc_mem; |
41 | 44 | ||
45 | static struct clk *rtc_clk; | ||
42 | static void __iomem *s3c_rtc_base; | 46 | static void __iomem *s3c_rtc_base; |
43 | static int s3c_rtc_alarmno = NO_IRQ; | 47 | static int s3c_rtc_alarmno = NO_IRQ; |
44 | static int s3c_rtc_tickno = NO_IRQ; | 48 | static int s3c_rtc_tickno = NO_IRQ; |
@@ -431,6 +435,10 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
431 | s3c_rtc_setpie(&dev->dev, 0); | 435 | s3c_rtc_setpie(&dev->dev, 0); |
432 | s3c_rtc_setaie(0); | 436 | s3c_rtc_setaie(0); |
433 | 437 | ||
438 | clk_disable(rtc_clk); | ||
439 | clk_put(rtc_clk); | ||
440 | rtc_clk = NULL; | ||
441 | |||
434 | iounmap(s3c_rtc_base); | 442 | iounmap(s3c_rtc_base); |
435 | release_resource(s3c_rtc_mem); | 443 | release_resource(s3c_rtc_mem); |
436 | kfree(s3c_rtc_mem); | 444 | kfree(s3c_rtc_mem); |
@@ -488,6 +496,16 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
488 | goto err_nomap; | 496 | goto err_nomap; |
489 | } | 497 | } |
490 | 498 | ||
499 | rtc_clk = clk_get(&pdev->dev, "rtc"); | ||
500 | if (IS_ERR(rtc_clk)) { | ||
501 | dev_err(&pdev->dev, "failed to find rtc clock source\n"); | ||
502 | ret = PTR_ERR(rtc_clk); | ||
503 | rtc_clk = NULL; | ||
504 | goto err_clk; | ||
505 | } | ||
506 | |||
507 | clk_enable(rtc_clk); | ||
508 | |||
491 | /* check to see if everything is setup correctly */ | 509 | /* check to see if everything is setup correctly */ |
492 | 510 | ||
493 | s3c_rtc_enable(pdev, 1); | 511 | s3c_rtc_enable(pdev, 1); |
@@ -523,6 +541,10 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
523 | 541 | ||
524 | err_nortc: | 542 | err_nortc: |
525 | s3c_rtc_enable(pdev, 0); | 543 | s3c_rtc_enable(pdev, 0); |
544 | clk_disable(rtc_clk); | ||
545 | clk_put(rtc_clk); | ||
546 | |||
547 | err_clk: | ||
526 | iounmap(s3c_rtc_base); | 548 | iounmap(s3c_rtc_base); |
527 | 549 | ||
528 | err_nomap: | 550 | err_nomap: |