Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3705492imu; Mon, 28 Jan 2019 09:20:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ARJXK8YlC7up2/u0HolixOrq7YAPwL1AYe+yLUMiOWq9srEKrnLbNbLI0V7e3QcUzqNMK X-Received: by 2002:a62:1f9d:: with SMTP id l29mr22685222pfj.14.1548696037836; Mon, 28 Jan 2019 09:20:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696037; cv=none; d=google.com; s=arc-20160816; b=Uo6V9pDPsnumAqsBoQ3RBVlApepdd6u4Z5DjXCcSP0UGBHlYOhklDN2PY67Mgn+EoR 9LdraoJgqvooor/DtThU+DZaXlnZI3leQAoPg267z/gE0UbuB5PGIXQtYwG2PWGnYdS/ 5XnqlOy6A3SRiJCaD7cxjBLWjx7z4nfiHlQzFWTLL6IeQg6fRPSsWxyYChhzdtVPtrMN fp/dopbOmz8a+m/dgYkyMCCvNKvcJHfP7msCoPVhGTyvITxwN0/aK1RTnABkivEaD46h 16PlXQ3Z3o9yzZ+KPOaqyFvfFm7LXq0xT6l0w2aYcG2d5QwSWxhv9XBGK6Jj3DkItiHW VQ8g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oTe+z4OBKc10queqqM81r960yeIPbutIvvAGvzl+IFs=; b=YkJ9xfHr63usUwA6WgzMGD9Yx5aVS2SEtbmV6KLXVrPl37p3y4I+rVasVoqB99BdsQ Z4KCdZ+5+V47gKL51wf3StA2XtCvjBMX+SAa3HvETUrkuyf5KXAOrnKtc7F3LvZxHPK5 B7wKZkANwOD+y90lUsN/6p199gIXRKNc9tPYdMyQplaxov3YBNWn3t7aBehxzBjwUyPb xalUpQMDKIOd4NNhcrgXw6lCcVrXRBeLW932j0aGoJ8d187T0yVJvf0x0SWJGu9D5vAP vZBRUg8Qj2cnuamrNQkFhYsRbj7MBHp1nYUMvMJswN2h4tei67P7OQTu6ckS1JFMg2D7 gcOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CHuN+vCy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si32784870pgm.25.2019.01.28.09.20.22; Mon, 28 Jan 2019 09:20:37 -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=CHuN+vCy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731987AbfA1RS2 (ORCPT + 99 others); Mon, 28 Jan 2019 12:18:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:51786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731333AbfA1QFS (ORCPT ); Mon, 28 Jan 2019 11:05:18 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 411FD2173C; Mon, 28 Jan 2019 16:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691517; bh=L67plHKj0uRvuW2ab7uXhM+XoaBr+WX1EBJiqIdZRNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHuN+vCy2kufRn60/mEe4WD4Qq7uhdE7I0WqAhZIKGiC0z0gJRdxZw9CQDgwYGIB/ D5MNpyNf48XUfib87or+dn1kimQAAIgvga8fCr9zVpOUWAd4eRwAardVL0zgRKvWtU kvs+bgxDDhTWkWoT3J3VLvY0REtS1O4mbrxTP+AU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wolfram Sang , Guenter Roeck , Wim Van Sebroeck , Sasha Levin , linux-watchdog@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 125/258] watchdog: renesas_wdt: don't set divider while watchdog is running Date: Mon, 28 Jan 2019 10:57:11 -0500 Message-Id: <20190128155924.51521-125-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang [ 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 88d81feba4e6..d01efd342dc0 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -77,12 +77,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