Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2652223imj; Mon, 11 Feb 2019 06:30:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IbTsWvzd/UlwUFRSt4r+m9vSD98p82i/XWDEbrLUoRDWRIeKAAYkqXtZPWPXGURqjQ8g9aC X-Received: by 2002:a17:902:aa8d:: with SMTP id d13mr36074458plr.293.1549895421242; Mon, 11 Feb 2019 06:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895421; cv=none; d=google.com; s=arc-20160816; b=wrAmS+iaR13cJnDuobEfuAj55iZPpH5Eg4LkJQ7F+S+F7AwrQlbuMU1My7IrKNuyg9 HHw+VRGOf7jAMseZ0nRJIieDhV7KJLoX5oCByoyqVTKDCt2Mjgv3QRgxDNlnMLGvORAH uuCO9PqBF3fgRT+dbfBcwfWiNpr0HvMckAjCKCzd7tZiBbRv1xN0v4AmhMNyLCRTfqfT GBlazn3xxWpslD0XRUxEP1c57ELkMIfcCLCfROflFS63xdB8MbfLHTJF90eZ+XrhwuD8 0mHwWHpYYezTG+5fp8/FU8MitY/BOxwiAO3S6KEy7ts/VIAGFb5nl9UnF++qWthUCyPR j/4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DSiLCKrfVuac7nIQ5qpwd9NjRisqQgAOwXKttEQTbt8=; b=NGtcjpODI5IM+JCzWIF37lLZn+TLMTkPSHpIVjFeVByslBWnxMOmGIQZZ0zokmOI0G rfxRL2Mn0MM/h0AEkCfoIdHdhXCwNP0MeMh0Ha1HT6wFMwjr00bd1KqkXAPo60Dsv4ky meAAYdYve41hTSug0BvRV3XCnBfor8iqduMufJzWlWZ9gIOIc5BI4M1KfHRY2UmYKlDM o/6evGoRUR8niscN3wDqnydPuOHaizIAOjJiwRHghIo7UYPKH+wa+IkVz6aOmeujMVIz mxMwkIpSt8mwRjJgQ1/F56PzCjHLW4SnYNgpzxIYcraJnrdT1tGFcgi4XH7x7ZnIVtjE 3Hjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XAGhrt1f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15si1670824pgh.477.2019.02.11.06.30.04; Mon, 11 Feb 2019 06:30:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XAGhrt1f; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728599AbfBKO1Y (ORCPT + 99 others); Mon, 11 Feb 2019 09:27:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:33168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729709AbfBKO1X (ORCPT ); Mon, 11 Feb 2019 09:27:23 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8806620844; Mon, 11 Feb 2019 14:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895242; bh=tBK3CZdNZWewbfthLWZ6W3lb359IMP6SAZUEkKAm6b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XAGhrt1fDD4Lru0haTDzvWbeqbvpW7U4HgKGjV1fHo1Ms+ImYvyXSYoDpwcp9vYLP GyonMhwDnf7NtSFLOf5AMYQHMVFsyaRJwJ+ByaYFp+yLjMmu5O3CjEgOKA9jNHmWXJ CDm3HTNL08T6h8rv6ESmQPVCYwWL1MGzu8oAry28= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Fabrizio Castro , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 4.20 139/352] watchdog: renesas_wdt: dont set divider while watchdog is running Date: Mon, 11 Feb 2019 15:16:06 +0100 Message-Id: <20190211141855.362756843@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit e990e12741877e9bfac402ca468f4007a75f6e2a ] The datasheet says we must stop the timer before changing the clock divider. This can happen when the restart handler is called while the watchdog is running. Signed-off-by: Wolfram Sang Reviewed-by: Fabrizio Castro Reviewed-by: Guenter Roeck Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/renesas_wdt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index 0d74c3e48979..55c9eb6c6e51 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -74,12 +74,17 @@ static int rwdt_init_timeout(struct watchdog_device *wdev) static int rwdt_start(struct watchdog_device *wdev) { struct rwdt_priv *priv = watchdog_get_drvdata(wdev); + u8 val; pm_runtime_get_sync(wdev->parent); - rwdt_write(priv, 0, RWTCSRB); - rwdt_write(priv, priv->cks, RWTCSRA); + /* Stop the timer before we modify any register */ + val = readb_relaxed(priv->base + RWTCSRA) & ~RWTCSRA_TME; + rwdt_write(priv, val, RWTCSRA); + rwdt_init_timeout(wdev); + rwdt_write(priv, priv->cks, RWTCSRA); + rwdt_write(priv, 0, RWTCSRB); while (readb_relaxed(priv->base + RWTCSRA) & RWTCSRA_WRFLG) cpu_relax(); -- 2.19.1