Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2721538imj; Mon, 11 Feb 2019 07:30:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IZupUgjvQOwok2sy68f+HpolkzatJtKZM1sAZUoKY5SHjuVAq/NeIW2ZTNFKFRpSo+Hrsk1 X-Received: by 2002:a17:902:e486:: with SMTP id cj6mr24442289plb.86.1549899019359; Mon, 11 Feb 2019 07:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899019; cv=none; d=google.com; s=arc-20160816; b=zj8ZHq52j40oYRVoaAfSl+TPqep+2GyYFGqfwizwzG1wksE1RsX5k9WyvNL8e0Vm1y TGdsNnm8Eu/z86UBlC/BZzjHsRlxvEl+pxHPWNiSd0GkGApHWplbRnTVQ3LLms4y7NeD 23Pk/MEK06Gjn3fVek6vedQeqjQMgLWHCKcfjY0IDIqT6b/RYHTK0SKD2ypsqUvu7lUR AZ8MIqYItRnN1Emi0W7l6UKoVUHV4F49ZEKCnhTFgfDmHR7DzvygJM9KLHq3RWoAVPAE 8CHyNK8qF1ybiuU2dw4KZqq29lOotEzVqK/yBA0ZqWAzMRvnzQyN8cFyfLMYV+z5s/IP 9VNQ== 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=J8LvE75vRUWncHV3brI4WSP0FyTVf4R7gq631ABBCGI=; b=TNGchkjzac6goRBmKPl3evDcUhO87MrbmL93qzvzSzlY8NNGqC7SzjcJsB5rYAxNnI 1nTrjc7hAshCFrDYLbX2FdLWXXh1xWLfL6sqZ0qsoFNyPLJUv3gE6T+WbhpsmQK1pOW4 Vl9PjIdAyKevi/c+qAKQFj/0W5zRC//ORm1DteLoaRU9P+EoOQQwsQjLjQr+mO7p9YY8 BI9CryfQlOs+vHviwXNb9n0/+b4I95gI9jNk92n4TO2epSs/v2eJ13EOt6zbBLpGsRKf PKaWY0PpR0STkk5u8296+cU9pO3C9YHfCdUxImtkDKKtHIE6YAH6pPVAVK9u4xM7uoVT wg5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=avVesrD1; 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 bc12si10239634plb.111.2019.02.11.07.30.02; Mon, 11 Feb 2019 07:30:19 -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=avVesrD1; 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 S2389407AbfBKO5p (ORCPT + 99 others); Mon, 11 Feb 2019 09:57:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:45180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388779AbfBKO5n (ORCPT ); Mon, 11 Feb 2019 09:57:43 -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 56949222A1; Mon, 11 Feb 2019 14:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897062; bh=94Bzif+YofnvqvpvdZJ0SzyDrJ5/IO/ilMOUOm/w2MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avVesrD145iTDY9y13wtwEUZUW3kV88JPmEoxVhjvBJel+T9VtFWd3cN6tW+oqJZk AT7shmS0OU6TxNcxxQyS67aj8UOtulShpxe5oORK1DfbYGeCMToZ/NJuhe/VSkEQF6 KozcdDfNS2NAXlHryuGbLDImtglnEr2XDG4BMFZg= 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.14 078/205] watchdog: renesas_wdt: dont set divider while watchdog is running Date: Mon, 11 Feb 2019 15:17:56 +0100 Message-Id: <20190211141833.802533062@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 831ef83f6de1..c4a17d72d025 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