From patchwork Sat Mar 10 03:46:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 10273161 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 C9AF360390 for ; Sat, 10 Mar 2018 03:46:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B700429E09 for ; Sat, 10 Mar 2018 03:46:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB81429E30; Sat, 10 Mar 2018 03:46:38 +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 3850D29E09 for ; Sat, 10 Mar 2018 03:46:38 +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:References: In-Reply-To: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:List-Owner; bh=WGMFm12l+hXtrcphOtXFu4GD70l7Rm4b0pIX/FzeMnM=; b=ezapmbFkBjxP3kccBSrSNZz/gd qqZTLXcMsyQB6hQpaVG/cXOB1bHFRtAu6BcsGTVrpf3foxBE+tVRuNt4jgXsZDNoqCT6fvpUm7Qa5 KkMgk+X6in2yiB/w0klQtKi+1p2B0G1ZKpDa5BJfY+q5eaPZ5SAFNNTsRLfN2iZwJhFiRuMXY0i23 ed/T5cNjrmPqPYfLIduv04Tv2tunvb+iYo4gAAjn+mCbyZfbUU+Zh3urX9UkMoloTSvFmupiaEE6y sfVe9i6pFFnVo6zCHbQUU5tdZNJqqZS0zbOim7RrJ2IzZERgB7eb3HPcYFVvr6RPZt3CzuiR/i3Nv +EVOt4/w==; 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 1euVSu-0005JE-9o; Sat, 10 Mar 2018 03:46:36 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1euVSn-0005Fk-AB for linux-rockchip@lists.infradead.org; Sat, 10 Mar 2018 03:46:30 +0000 Received: by mail-pf0-x244.google.com with SMTP id y186so2089338pfb.2 for ; Fri, 09 Mar 2018 19:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=46ua0d31S5ohDKLf0vyHoOTuFxRrLPcuC1tpQ5eJX7c=; b=HMh97gIjDm5tjyETm/4ZcGGUUcwq7WWIxet4IlnG8DdQ1ku6KnSixRbgGR20lPR3zl xD2n54KLb01OjHnzWkaIo3p0lKAVVB80sIc4bOjMEI3y4ww5mgO4uuWnbVweUzM9Im3H Hs591ZDQATIMLf0BszgFAHd4jzMJS6Msyz/eA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=46ua0d31S5ohDKLf0vyHoOTuFxRrLPcuC1tpQ5eJX7c=; b=CGWEcWPKzjlZrcwsXil8bTaoIQ7zc0Pyr1meWXMQzlEtPbqrF7YBAbt8OEyS2nB/+k dHXsZZ9wZ2VEDrvhp3t7V1IE+pm4n81O+RAQ7GCIaUBizwapQ48JVt2phhiZXPmkDucD npdUM0QnH+mOZrZc9HFHQSK+2enN5Dz8rAkzVY1nRCNd9MHdN7fDK4bxGzAA9fQP/ZIT 2mKIxNQouxHBjuePzKoVyaDGWRXjhBEQhhcfuL7VjMC3QPd4QcqDVN5t6FT7rrwKl13W blZh8vV5nt3b97VFa0JgmZH1bsmTf/h3vTI2HvMJCJLQ/eW3nufVCQZAIFgF+MoJndxr hrzw== X-Gm-Message-State: AElRT7E7rq0YKRVDwVtN6JAKsk9wc7cc2xBELaIpd+Tl/Of6s2hHwvIi OGZicfM/fIzJ7XOu4o8ybqG5Dg== X-Google-Smtp-Source: AG47ELs4Dq4ZUbTHaCoONOOMSvHDhUG9hkLrCdfU51rUOcq0J3ssbTg7bDEXBdXJok99CDTiDoJrzw== X-Received: by 10.98.248.7 with SMTP id d7mr768434pfh.117.1520653578859; Fri, 09 Mar 2018 19:46:18 -0800 (PST) Received: from ban.mtv.corp.google.com ([2620:0:1000:1501:bc2f:3082:9938:5d41]) by smtp.gmail.com with ESMTPSA id 76sm5280773pfp.53.2018.03.09.19.46.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 19:46:18 -0800 (PST) From: Brian Norris To: Wim Van Sebroeck , Guenter Roeck Subject: [PATCH v2 2/2] watchdog: dw: save/restore control and timeout across suspend/resume Date: Fri, 9 Mar 2018 19:46:07 -0800 Message-Id: <20180310034607.254884-2-briannorris@chromium.org> X-Mailer: git-send-email 2.16.2.660.g709887971b-goog In-Reply-To: <20180310034607.254884-1-briannorris@chromium.org> References: <20180310034607.254884-1-briannorris@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180309_194629_440827_932EFC94 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-watchdog@vger.kernel.org, Brian Norris , Doug Anderson , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Matthias Kaehlcke MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some platforms lose this state in suspend. It should be safe to do this unconditionally. Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck --- v2: no change --- drivers/watchdog/dw_wdt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 918357bccf5e..501aebb5b81f 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -57,6 +57,9 @@ struct dw_wdt { unsigned long rate; struct watchdog_device wdd; struct reset_control *rst; + /* Save/restore */ + u32 control; + u32 timeout; }; #define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd) @@ -205,6 +208,9 @@ static int dw_wdt_suspend(struct device *dev) { struct dw_wdt *dw_wdt = dev_get_drvdata(dev); + dw_wdt->control = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET); + dw_wdt->timeout = readl(dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET); + clk_disable_unprepare(dw_wdt->clk); return 0; @@ -218,6 +224,9 @@ static int dw_wdt_resume(struct device *dev) if (err) return err; + writel(dw_wdt->timeout, dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET); + writel(dw_wdt->control, dw_wdt->regs + WDOG_CONTROL_REG_OFFSET); + dw_wdt_ping(&dw_wdt->wdd); return 0;