From patchwork Mon Feb 26 20:09:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 10243131 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 E6CE5602A0 for ; Mon, 26 Feb 2018 20:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4F032A2EC for ; Mon, 26 Feb 2018 20:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C95922A2F7; Mon, 26 Feb 2018 20:11:46 +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 5E5182A2EC for ; Mon, 26 Feb 2018 20:11:46 +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=SWuMU1LxYJfdxrNFjLMCC/+2vA2KksBHbNZodjaDACo=; b=goA 8puoKHFPQjKO/e7fYOavoW+rf3U+1l0VzJmnDx4sIrj/0eugHEeYcyqbeho3wgOfOMFShSwaWZxeS lPAYIipgvLcFZ6Axb2pd111oJJks+clUiipVHAXIHH6luCFxjEYj1OqRhKu4N6v6hyzZlK1CIlhnK 2Azqq6XOFb/ilXgYowbkbgHU7IMBdIO9y9I2oTaDfm7f1jgGphncq18qyhcV66qNMt5C21NrZB60t TiICQsjfoClp/pb4vhSsqUUkidMeRvnkzjRfrlDo26WyoQECdyOhJP/EiV0jre3OZYMPyraM2gYjf rTO/9n42r48IVIdUBC41YedhunVLM9Q==; 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 1eqP7Y-0001nm-7h; Mon, 26 Feb 2018 20:11:36 +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 1eqP7U-0001ln-R4 for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2018 20:11:34 +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 0994930C009; Mon, 26 Feb 2018 12:11:15 -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 A74C9AC0729; Mon, 26 Feb 2018 12:11:14 -0800 (PST) From: Justin Chen To: linux-rtc@vger.kernel.org Subject: [PATCH v2] rtc: brcmstb-waketimer: Set wktmr prescaler Date: Mon, 26 Feb 2018 12:09:58 -0800 Message-Id: <1519675798-26720-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-20180226_121133_019737_E1451A68 X-CRM114-Status: UNSURE ( 7.52 ) 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. Reviewed-by: Florian Fainelli Signed-off-by: Justin Chen --- drivers/rtc/rtc-brcmstb-waketimer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/rtc/rtc-brcmstb-waketimer.c b/drivers/rtc/rtc-brcmstb-waketimer.c index 796ac79..231b2f7 100644 --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c @@ -60,6 +60,9 @@ 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(timer->rate, timer->base + BRCMSTB_WKTMR_PRESCALER); + writel_relaxed(secs + 1, timer->base + BRCMSTB_WKTMR_ALARM); }