aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-sh.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index e9e0934380b8..198b9f22fbff 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -492,10 +492,10 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
492 492
493 spin_lock_irq(&rtc->lock); 493 spin_lock_irq(&rtc->lock);
494 494
495 /* disable alarm interrupt and clear flag */ 495 /* disable alarm interrupt and clear the alarm flag */
496 rcr1 = readb(rtc->regbase + RCR1); 496 rcr1 = readb(rtc->regbase + RCR1);
497 rcr1 &= ~RCR1_AF; 497 rcr1 &= ~(RCR1_AF|RCR1_AIE);
498 writeb(rcr1 & ~RCR1_AIE, rtc->regbase + RCR1); 498 writeb(rcr1, rtc->regbase + RCR1);
499 499
500 rtc->rearm_aie = 0; 500 rtc->rearm_aie = 0;
501 501
@@ -510,8 +510,10 @@ static int sh_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
510 mon += 1; 510 mon += 1;
511 sh_rtc_write_alarm_value(rtc, mon, RMONAR); 511 sh_rtc_write_alarm_value(rtc, mon, RMONAR);
512 512
513 /* Restore interrupt activation status */ 513 if (wkalrm->enabled) {
514 writeb(rcr1, rtc->regbase + RCR1); 514 rcr1 |= RCR1_AIE;
515 writeb(rcr1, rtc->regbase + RCR1);
516 }
515 517
516 spin_unlock_irq(&rtc->lock); 518 spin_unlock_irq(&rtc->lock);
517 519