From patchwork Mon May 5 20:23:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 4117101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3F99C9F1E1 for ; Mon, 5 May 2014 20:26:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E00920138 for ; Mon, 5 May 2014 20:26:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BFC1200EC for ; Mon, 5 May 2014 20:26:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhPQQ-00055t-Bn; Mon, 05 May 2014 20:23:46 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhPQN-00053O-MT for linux-arm-kernel@lists.infradead.org; Mon, 05 May 2014 20:23:44 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 148107F9; Mon, 5 May 2014 22:23:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost.localdomain (col31-4-88-188-80-5.fbx.proxad.net [88.188.80.5]) by mail.free-electrons.com (Postfix) with ESMTPSA id 4FA44798; Mon, 5 May 2014 22:23:20 +0200 (CEST) From: Boris BREZILLON To: Bryan Evenson Subject: [PATCH] rtc: rtc-at91rm9200: fix lost ACKUPD interrupt Date: Mon, 5 May 2014 22:23:08 +0200 Message-Id: <1399321388-15148-1-git-send-email-boris.brezillon@free-electrons.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <55cab9fba2ea4eed8f73591b37cc874b@BLUPR05MB037.namprd05.prod.outlook.com> References: <55cab9fba2ea4eed8f73591b37cc874b@BLUPR05MB037.namprd05.prod.outlook.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140505_132343_879110_1B8B095B X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: 0.3 (/) Cc: Alessandro Zummo , rtc-linux@googlegroups.com, Boris BREZILLON , Nicolas Ferre , linux-kernel@vger.kernel.org, Jean-Christophe Plagniol-Villard , Andrew Victor , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If an alarm interrupt raises just after the CR register is written and before the ACKUPD is unmasked the ACKUPD bit might be cleaned up without waking up the waiting thread. Unmask the ACKUPD interrupt before writing the CR register so that the ACKUPD cannot be lost. Signed-off-by: Boris BREZILLON Reported-by: Bryan Evenson --- Hello Bryan, Could you try to apply this patch and tell me if it fixes your bug ? Best Regards, Boris drivers/rtc/rtc-at91rm9200.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index 3281c90..c16c423 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c @@ -163,9 +163,9 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) /* Stop Time/Calendar from counting */ cr = at91_rtc_read(AT91_RTC_CR); + at91_rtc_write_ier(AT91_RTC_ACKUPD); at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); - at91_rtc_write_ier(AT91_RTC_ACKUPD); wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ at91_rtc_write_idr(AT91_RTC_ACKUPD);