Greg, > -----Original Message----- > From: gregkh@xxxxxxxxxxxxxxxxxxx [mailto:gregkh@xxxxxxxxxxxxxxxxxxx] > Sent: Tuesday, June 17, 2014 5:16 PM > To: boris.brezillon@xxxxxxxxxxxxxxxxxx; a.zummo@xxxxxxxxxxxx; > akpm@xxxxxxxxxxxxxxxxxxxx; Bryan Evenson; gregkh@xxxxxxxxxxxxxxxxxxx; > linux@xxxxxxxxxxxx; nicolas.ferre@xxxxxxxxx; plagnioj@xxxxxxxxxxxx; > torvalds@xxxxxxxxxxxxxxxxxxxx > Cc: stable@xxxxxxxxxxxxxxx; stable-commits@xxxxxxxxxxxxxxx > Subject: Patch "rtc: rtc-at91rm9200: fix infinite wait for ACKUPD irq" has been > added to the 3.10-stable tree > > > This is a note to let you know that I've just added the patch titled > > rtc: rtc-at91rm9200: fix infinite wait for ACKUPD irq > > to the 3.10-stable tree which can be found at: > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable- > queue.git;a=summary > > The filename of the patch is: > rtc-rtc-at91rm9200-fix-infinite-wait-for-ackupd-irq.patch > and it can be found in the queue-3.10 subdirectory. > > If you, or anyone else, feels it should not be added to the stable tree, please > let <stable@xxxxxxxxxxxxxxx> know about it. This patch should be added to the stable tree, but in my testing it needs an additional patch to avoid causing a different problem. This patch does fix the stated problem, but in my testing on an AT91SAM9G25 platform the system would not boot up after a power cycle if the RTC backup battery was in place. This second patch is needed to fix the second issue: https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=9dcc87fec8947308e0111c65dcd881e6aa5b1673 I had seen the failure to boot happen rarely in the past, but after applying the "rtc: rtc-at91rm9200: fix infinite wait for ACKUPD irq" patch the failure to boot from power cycle was happening every time on my system. I then applied the second patch I linked to above and my system would then boot up after a power cycle without issue every time. So I would suggest only applying this patch to 3.10-stable, 3.14-stable and 3.15-stable if the "ARM: at91: fix at91_sysirq_mask_rtc for sam9x5 SoCs" patch linked to above is applied in the same series. Regards, Bryan > > > From 2fe121e1f5aa3bf31b418a9790db6c400e922291 Mon Sep 17 00:00:00 > 2001 > From: Boris BREZILLON <boris.brezillon@xxxxxxxxxxxxxxxxxx> > Date: Fri, 6 Jun 2014 14:36:09 -0700 > Subject: rtc: rtc-at91rm9200: fix infinite wait for ACKUPD irq > > From: Boris BREZILLON <boris.brezillon@xxxxxxxxxxxxxxxxxx> > > commit 2fe121e1f5aa3bf31b418a9790db6c400e922291 upstream. > > The rtc user must wait at least 1 sec between each time/calandar update > (see atmel's datasheet chapter "Updating Time/Calendar"). > > Use the 1Hz interrupt to update the at91_rtc_upd_rdy flag and wait for the > at91_rtc_wait_upd_rdy event if the rtc is not ready. > > This patch fixes a deadlock in an uninterruptible wait when the RTC is > updated more than once every second. AFAICT the bug is here from the > beginning, but I think we should at least backport this fix to 3.10 and the > following longterm and stable releases. > > Signed-off-by: Boris BREZILLON <boris.brezillon@xxxxxxxxxxxxxxxxxx> > Reported-by: Bryan Evenson <bevenson@xxxxxxxxxxxxxx> > Tested-by: Bryan Evenson <bevenson@xxxxxxxxxxxxxx> > Cc: Andrew Victor <linux@xxxxxxxxxxxx> > Cc: Nicolas Ferre <nicolas.ferre@xxxxxxxxx> > Cc: Jean-Christophe Plagniol-Villard <plagnioj@xxxxxxxxxxxx> > Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> > > --- > drivers/rtc/rtc-at91rm9200.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > --- a/drivers/rtc/rtc-at91rm9200.c > +++ b/drivers/rtc/rtc-at91rm9200.c > @@ -49,6 +49,7 @@ struct at91_rtc_config { > > static const struct at91_rtc_config *at91_rtc_config; static > DECLARE_COMPLETION(at91_rtc_updated); > +static DECLARE_COMPLETION(at91_rtc_upd_rdy); > static unsigned int at91_alarm_year = AT91_RTC_EPOCH; static void > __iomem *at91_rtc_regs; static int irq; @@ -162,6 +163,8 @@ static int > at91_rtc_settime(struct devic > 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, > tm->tm_hour, tm->tm_min, tm->tm_sec); > > + wait_for_completion(&at91_rtc_upd_rdy); > + > /* Stop Time/Calendar from counting */ > cr = at91_rtc_read(AT91_RTC_CR); > at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | > AT91_RTC_UPDTIM); @@ -184,7 +187,9 @@ static int > at91_rtc_settime(struct devic > > /* Restart Time/Calendar */ > cr = at91_rtc_read(AT91_RTC_CR); > + at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_SECEV); > at91_rtc_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | > AT91_RTC_UPDTIM)); > + at91_rtc_write_ier(AT91_RTC_SECEV); > > return 0; > } > @@ -291,8 +296,10 @@ static irqreturn_t at91_rtc_interrupt(in > if (rtsr) { /* this interrupt is shared! Is it ours? */ > if (rtsr & AT91_RTC_ALARM) > events |= (RTC_AF | RTC_IRQF); > - if (rtsr & AT91_RTC_SECEV) > - events |= (RTC_UF | RTC_IRQF); > + if (rtsr & AT91_RTC_SECEV) { > + complete(&at91_rtc_upd_rdy); > + at91_rtc_write_idr(AT91_RTC_SECEV); > + } > if (rtsr & AT91_RTC_ACKUPD) > complete(&at91_rtc_updated); > > @@ -415,6 +422,11 @@ static int __init at91_rtc_probe(struct > } > platform_set_drvdata(pdev, rtc); > > + /* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy > + * completion. > + */ > + at91_rtc_write_ier(AT91_RTC_SECEV); > + > dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n"); > return 0; > > > > Patches currently in stable-queue which might be from boris.brezillon@free- > electrons.com are > > queue-3.10/rtc-rtc-at91rm9200-fix-infinite-wait-for-ackupd-irq.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html