From patchwork Thu Feb 22 01:15:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 10234465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 72F9560224 for ; Thu, 22 Feb 2018 01:17:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77493286C4 for ; Thu, 22 Feb 2018 01:17:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BA2C286CB; Thu, 22 Feb 2018 01:17:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE627286CF for ; Thu, 22 Feb 2018 01:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=PpwUsl66VDjpV0GldVosIA99Gp1NijvZe5vglI4IbqE=; b=NaU F0+vcjFiPFqko3/3kmgiVgzrx7GPyf17xwGQj3gGYRvh7W/A6mrF2socXp66AuD8EZ8+pJBv7cerq 6vKyzoXm6lA3XGjiDLL/bsdgYoe4UkwUeeXQu0rQ/yOTUmDwHvqv0b1Vx5w2ZBCbZuDtsj75z6FEX Uy62WVh92m+k8QrMcJpyf2MA1NYeaxJsomSLuTz7zpK1ijmETUomLeyyO0OO8wVceTG6SIzQIHT42 HqQ6LuLv9eDlz1W3VmdDPmznPY505NW07Rjsuzapk9pv8ZwbyzACA4xQYirSdylPVqS3rdxo/8zvY gb2LBJVmtpBX7DMHcAhExxjDWTNvHAw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eofVC-0007CQ-8H; Thu, 22 Feb 2018 01:16:50 +0000 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eofV7-00079s-Ob for linux-arm-kernel@lists.infradead.org; Thu, 22 Feb 2018 01:16:47 +0000 Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id E979730C018; Wed, 21 Feb 2018 17:16:26 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id B6DA7AC0729; Wed, 21 Feb 2018 17:16:26 -0800 (PST) From: Justin Chen To: linux-rtc@vger.kernel.org Subject: [PATCH] rtc: brcmstb-waketimer: Set wktmr prescaler Date: Wed, 21 Feb 2018 17:15:55 -0800 Message-Id: <1519262155-15580-1-git-send-email-justin.chen@broadcom.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180221_171645_958214_D640FAD8 X-CRM114-Status: UNSURE ( 7.28 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: a.zummo@towertech.it, f.fainelli@gmail.com, linux-kernel@vger.kernel.org, Justin Chen , alexandre.belloni@free-electrons.com, Justin Chen , gregory.0xf0@gmail.com, bcm-kernel-feedback-list@broadcom.com, computersforpeace@gmail.com, linux-arm-kernel@lists.infradead.org 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 The HW default is one tick per second, however instead of assuming this, lets make sure the waketimer is actually one tick per second before arming the alarm. Signed-off-by: Justin Chen Reviewed-by: Florian Fainelli --- drivers/rtc/rtc-brcmstb-waketimer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c index 796ac79..46116b7 100644 --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c @@ -60,6 +60,10 @@ static void brcmstb_waketmr_set_alarm(struct brcmstb_waketmr *timer, { brcmstb_waketmr_clear_alarm(timer); + /* Make sure we are actually counting in seconds */ + writel_relaxed(BRCMSTB_WKTMR_DEFAULT_FREQ, + timer->base + BRCMSTB_WKTMR_PRESCALER); + writel_relaxed(secs + 1, timer->base + BRCMSTB_WKTMR_ALARM); }