diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-09-17 22:17:54 -0400 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2012-02-23 08:57:58 -0500 |
commit | 4e9267f1b42b4f7b66214161b55f1f73365692cd (patch) | |
tree | d24783345549df8f3fbb12f77ee9fb3a0ca29607 /drivers/rtc/rtc-at91sam9.c | |
parent | 205056a3ea33f5aca7adffa4584eb6572b1d3273 (diff) |
ARM: at91:rtc/rtc-at91sam9: ioremap register bank
Instead of computing virtual address with AT91_VA_BASE_SYS, use the
appropriate ioremap() call on the driver "memory" resource.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/rtc/rtc-at91sam9.c')
-rw-r--r-- | drivers/rtc/rtc-at91sam9.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 65896a3a352f..08b69fdf2a7e 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -307,8 +307,12 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) | |||
307 | device_init_wakeup(&pdev->dev, 1); | 307 | device_init_wakeup(&pdev->dev, 1); |
308 | 308 | ||
309 | platform_set_drvdata(pdev, rtc); | 309 | platform_set_drvdata(pdev, rtc); |
310 | rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); | 310 | rtc->rtt = ioremap(r->start, resource_size(r)); |
311 | rtc->rtt += r->start; | 311 | if (!rtc->rtt) { |
312 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | ||
313 | ret = -ENOMEM; | ||
314 | goto fail; | ||
315 | } | ||
312 | 316 | ||
313 | mr = rtt_readl(rtc, MR); | 317 | mr = rtt_readl(rtc, MR); |
314 | 318 | ||
@@ -326,7 +330,7 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) | |||
326 | &at91_rtc_ops, THIS_MODULE); | 330 | &at91_rtc_ops, THIS_MODULE); |
327 | if (IS_ERR(rtc->rtcdev)) { | 331 | if (IS_ERR(rtc->rtcdev)) { |
328 | ret = PTR_ERR(rtc->rtcdev); | 332 | ret = PTR_ERR(rtc->rtcdev); |
329 | goto fail; | 333 | goto fail_register; |
330 | } | 334 | } |
331 | 335 | ||
332 | /* register irq handler after we know what name we'll use */ | 336 | /* register irq handler after we know what name we'll use */ |
@@ -351,6 +355,8 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) | |||
351 | 355 | ||
352 | return 0; | 356 | return 0; |
353 | 357 | ||
358 | fail_register: | ||
359 | iounmap(rtc->rtt); | ||
354 | fail: | 360 | fail: |
355 | platform_set_drvdata(pdev, NULL); | 361 | platform_set_drvdata(pdev, NULL); |
356 | kfree(rtc); | 362 | kfree(rtc); |
@@ -371,6 +377,7 @@ static int __devexit at91_rtc_remove(struct platform_device *pdev) | |||
371 | 377 | ||
372 | rtc_device_unregister(rtc->rtcdev); | 378 | rtc_device_unregister(rtc->rtcdev); |
373 | 379 | ||
380 | iounmap(rtc->rtt); | ||
374 | platform_set_drvdata(pdev, NULL); | 381 | platform_set_drvdata(pdev, NULL); |
375 | kfree(rtc); | 382 | kfree(rtc); |
376 | return 0; | 383 | return 0; |