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-13 12:31:36 -0500 |
commit | 2dcc90e6ac06d78433aec682961d9b587a07d4b5 (patch) | |
tree | f81ba01526d9c31036c9e0b1255d0e52a45c384c | |
parent | e8c9dc93e27d891636defbc269f182a83e6abba8 (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>
-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 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) | |||
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 __init 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 __init 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 __exit 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; |