summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-at91sam9.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-02-14 00:25:44 +0100
committerArnd Bergmann <arnd@arndb.de>2012-02-14 00:25:44 +0100
commita5368e770c9ec58b9d18378844c149df8513e7b8 (patch)
tree2dc0953afd7f54f3269486fc0edbb41cd9cf804e /drivers/rtc/rtc-at91sam9.c
parentMerge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/... (diff)
parentARM: at91: drop ide driver in favor of the pata one (diff)
downloadlinux-a5368e770c9ec58b9d18378844c149df8513e7b8.tar.xz
linux-a5368e770c9ec58b9d18378844c149df8513e7b8.zip
Merge branch 'at91-fixes' of git://github.com/at91linux/linux-at91 into fixes
* 'at91-fixes' of git://github.com/at91linux/linux-at91: ARM: at91: drop ide driver in favor of the pata one pata/at91: use newly introduced SMC accessors ARM: at91: add accessor to manage SMC ARM: at91:rtc/rtc-at91sam9: ioremap register bank ARM: at91: USB AT91 gadget registration for module
Diffstat (limited to 'drivers/rtc/rtc-at91sam9.c')
-rw-r--r--drivers/rtc/rtc-at91sam9.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index a3ad957507dc..ee3c122c0599 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -307,8 +307,12 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 1);
platform_set_drvdata(pdev, rtc);
- rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS);
- rtc->rtt += r->start;
+ rtc->rtt = ioremap(r->start, resource_size(r));
+ if (!rtc->rtt) {
+ dev_err(&pdev->dev, "failed to map registers, aborting.\n");
+ ret = -ENOMEM;
+ goto fail;
+ }
mr = rtt_readl(rtc, MR);
@@ -326,7 +330,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
&at91_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc->rtcdev)) {
ret = PTR_ERR(rtc->rtcdev);
- goto fail;
+ goto fail_register;
}
/* register irq handler after we know what name we'll use */
@@ -351,6 +355,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
return 0;
+fail_register:
+ iounmap(rtc->rtt);
fail:
platform_set_drvdata(pdev, NULL);
kfree(rtc);
@@ -371,6 +377,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
rtc_device_unregister(rtc->rtcdev);
+ iounmap(rtc->rtt);
platform_set_drvdata(pdev, NULL);
kfree(rtc);
return 0;