Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752078AbbG2GCX (ORCPT ); Wed, 29 Jul 2015 02:02:23 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36657 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750957AbbG2GCW (ORCPT ); Wed, 29 Jul 2015 02:02:22 -0400 From: Leo Yan To: Linus Walleij , Alessandro Zummo , Alexandre Belloni , linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, Deepak Saxena Cc: Leo Yan Subject: [PATCH] drivers/rtc/rtc-pl031.c: reset registers in init flow Date: Wed, 29 Jul 2015 14:02:01 +0800 Message-Id: <1438149721-11072-1-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1529 Lines: 40 When use rtc-pl031 for suspend test on Hisilicon's SoC Hi6220, Usually the data register (DR) will read back as value zero. So the suspend test code will set the match register (MR) for 10 seconds' timeout; But there have chance later will read back some random values from DR register; So finally miss with match value and will not trigger waken up event anymore. This issue can be dismissed by reset registers in initialization flow; And this code have no harm for ST's variant. Signed-off-by: Leo Yan --- drivers/rtc/rtc-pl031.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 99181fff..01768de 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -345,6 +345,12 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev)); dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev)); + /* Init registers */ + writel(0x0, ldata->base + RTC_LR); + writel(0x0, ldata->base + RTC_DR); + writel(0x0, ldata->base + RTC_IMSC); + writel(RTC_BIT_AI, ldata->base + RTC_ICR); + data = readl(ldata->base + RTC_CR); /* Enable the clockwatch on ST Variants */ if (vendor->clockwatch) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/