diff options
| author | Changhwan Youn <chaos.youn@samsung.com> | 2010-10-27 18:33:06 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:06 -0400 |
| commit | f61ae6711d69717558e882a78487527705603a74 (patch) | |
| tree | f0eaa331189e1444253e166961f3561fe1fa97ab /drivers/rtc | |
| parent | fa5b07820fe3a0fc06ac368516e71f10a59b9539 (diff) | |
rtc: rtc-s3c: fix access unit from byte to word on RTCCON
S3C2410_RTCCON of TYPE_S3C64XX RTC should be read/written by readw and
writew, because TYPE_S3C64XX RTC uses bit 8 and 9. And TYPE_S3C2410 RTC
also can access it by readw and writew.
[atul.dahiya@samsung.com: tested on smdk2416]
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Changhwan Youn <chaos.youn@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Tested-by: Atul Dahiya <atul.dahiya@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
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-s3c.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index f57a87f4ae96..a87982d7cb70 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -100,7 +100,7 @@ static int s3c_rtc_setpie(struct device *dev, int enabled) | |||
| 100 | spin_lock_irq(&s3c_rtc_pie_lock); | 100 | spin_lock_irq(&s3c_rtc_pie_lock); |
| 101 | 101 | ||
| 102 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | 102 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 103 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); | 103 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); |
| 104 | tmp &= ~S3C64XX_RTCCON_TICEN; | 104 | tmp &= ~S3C64XX_RTCCON_TICEN; |
| 105 | 105 | ||
| 106 | if (enabled) | 106 | if (enabled) |
| @@ -318,7 +318,7 @@ static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) | |||
| 318 | unsigned int ticnt; | 318 | unsigned int ticnt; |
| 319 | 319 | ||
| 320 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | 320 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 321 | ticnt = readb(s3c_rtc_base + S3C2410_RTCCON); | 321 | ticnt = readw(s3c_rtc_base + S3C2410_RTCCON); |
| 322 | ticnt &= S3C64XX_RTCCON_TICEN; | 322 | ticnt &= S3C64XX_RTCCON_TICEN; |
| 323 | } else { | 323 | } else { |
| 324 | ticnt = readb(s3c_rtc_base + S3C2410_TICNT); | 324 | ticnt = readb(s3c_rtc_base + S3C2410_TICNT); |
| @@ -391,11 +391,11 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) | |||
| 391 | return; | 391 | return; |
| 392 | 392 | ||
| 393 | if (!en) { | 393 | if (!en) { |
| 394 | tmp = readb(base + S3C2410_RTCCON); | 394 | tmp = readw(base + S3C2410_RTCCON); |
| 395 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) | 395 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) |
| 396 | tmp &= ~S3C64XX_RTCCON_TICEN; | 396 | tmp &= ~S3C64XX_RTCCON_TICEN; |
| 397 | tmp &= ~S3C2410_RTCCON_RTCEN; | 397 | tmp &= ~S3C2410_RTCCON_RTCEN; |
| 398 | writeb(tmp, base + S3C2410_RTCCON); | 398 | writew(tmp, base + S3C2410_RTCCON); |
| 399 | 399 | ||
| 400 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { | 400 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { |
| 401 | tmp = readb(base + S3C2410_TICNT); | 401 | tmp = readb(base + S3C2410_TICNT); |
| @@ -405,25 +405,28 @@ static void s3c_rtc_enable(struct platform_device *pdev, int en) | |||
| 405 | } else { | 405 | } else { |
| 406 | /* re-enable the device, and check it is ok */ | 406 | /* re-enable the device, and check it is ok */ |
| 407 | 407 | ||
| 408 | if ((readb(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ | 408 | if ((readw(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0) { |
| 409 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); | 409 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); |
| 410 | 410 | ||
| 411 | tmp = readb(base + S3C2410_RTCCON); | 411 | tmp = readw(base + S3C2410_RTCCON); |
| 412 | writeb(tmp|S3C2410_RTCCON_RTCEN, base+S3C2410_RTCCON); | 412 | writew(tmp | S3C2410_RTCCON_RTCEN, |
| 413 | base + S3C2410_RTCCON); | ||
| 413 | } | 414 | } |
| 414 | 415 | ||
| 415 | if ((readb(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ | 416 | if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)) { |
| 416 | dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n"); | 417 | dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n"); |
| 417 | 418 | ||
| 418 | tmp = readb(base + S3C2410_RTCCON); | 419 | tmp = readw(base + S3C2410_RTCCON); |
| 419 | writeb(tmp& ~S3C2410_RTCCON_CNTSEL, base+S3C2410_RTCCON); | 420 | writew(tmp & ~S3C2410_RTCCON_CNTSEL, |
| 421 | base + S3C2410_RTCCON); | ||
| 420 | } | 422 | } |
| 421 | 423 | ||
| 422 | if ((readb(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ | 424 | if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)) { |
| 423 | dev_info(&pdev->dev, "removing RTCCON_CLKRST\n"); | 425 | dev_info(&pdev->dev, "removing RTCCON_CLKRST\n"); |
| 424 | 426 | ||
| 425 | tmp = readb(base + S3C2410_RTCCON); | 427 | tmp = readw(base + S3C2410_RTCCON); |
| 426 | writeb(tmp & ~S3C2410_RTCCON_CLKRST, base+S3C2410_RTCCON); | 428 | writew(tmp & ~S3C2410_RTCCON_CLKRST, |
| 429 | base + S3C2410_RTCCON); | ||
| 427 | } | 430 | } |
| 428 | } | 431 | } |
| 429 | } | 432 | } |
| @@ -514,8 +517,8 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
| 514 | 517 | ||
| 515 | s3c_rtc_enable(pdev, 1); | 518 | s3c_rtc_enable(pdev, 1); |
| 516 | 519 | ||
| 517 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", | 520 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", |
| 518 | readb(s3c_rtc_base + S3C2410_RTCCON)); | 521 | readw(s3c_rtc_base + S3C2410_RTCCON)); |
| 519 | 522 | ||
| 520 | device_init_wakeup(&pdev->dev, 1); | 523 | device_init_wakeup(&pdev->dev, 1); |
| 521 | 524 | ||
| @@ -578,7 +581,7 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 578 | /* save TICNT for anyone using periodic interrupts */ | 581 | /* save TICNT for anyone using periodic interrupts */ |
| 579 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | 582 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); |
| 580 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | 583 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 581 | ticnt_en_save = readb(s3c_rtc_base + S3C2410_RTCCON); | 584 | ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON); |
| 582 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; | 585 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
| 583 | } | 586 | } |
| 584 | s3c_rtc_enable(pdev, 0); | 587 | s3c_rtc_enable(pdev, 0); |
| @@ -596,8 +599,8 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
| 596 | s3c_rtc_enable(pdev, 1); | 599 | s3c_rtc_enable(pdev, 1); |
| 597 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | 600 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); |
| 598 | if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { | 601 | if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { |
| 599 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); | 602 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); |
| 600 | writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); | 603 | writew(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); |
| 601 | } | 604 | } |
| 602 | 605 | ||
| 603 | if (device_may_wakeup(&pdev->dev)) | 606 | if (device_may_wakeup(&pdev->dev)) |
