Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2529563imm; Thu, 9 Aug 2018 14:47:39 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwF8AdPkBwm9UsM05Tos3X0BCpYXQQd/zzv79X0IVH3mCqkka/fq/NZn+/d4qHBvUtjH8l+ X-Received: by 2002:a63:bf43:: with SMTP id i3-v6mr1175878pgo.342.1533851259329; Thu, 09 Aug 2018 14:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533851259; cv=none; d=google.com; s=arc-20160816; b=mk5ASoLy8RCopkl52L03EeV3ncXO6aYO9up/E32Uskm+TPdTfKkSw+MTsdx+yQZAnD pJPFzX4HDJiNr/YUPJebrRFMu0q6a14z/eLRoZVeYDsecvEwVL1bO0Df7Crkkh94wldk 0/q3/vlC2wg0cgDF/qXGkll73//HO9KPkfiEFuGc/hB0jp7SeIh6/8PZvw6/Sz80bVKX eBXHefUb928O2AlrpyrHCpIdW2AeTEpSsJCSICqAKcF3B5PdMhCdq7tkZyvaW/FW1yCN 7GAjGgDz1LbooXTUsmkZrV7FFun/R7SvFQlWtohp1TaZBoyZmQww89M+bo4N0ZHIsgGC esbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=XMJB0o3ARAXBmfldCEPDdZOf4qYA3M3nQzxvgnxrgmA=; b=ZsVh4QtTpbZv3yZTxyLZmDbN53G8Oeyah76BiU5fLRu+uv7avrJxVPfVcoAiUCsT8S uuFQJ3QRsSCs8k7Pa4GYBgLCwzMu5LKZ3KyQW5J5Hf9M0wMRflPrLU6x0mtPYt5Qu4kS 5x6o8yce/Og/03auTNjkNjZRjm1m/nT+CGJKdFJj8yw92S58rXGALuPH2r3kL5vO/mnk 7Lu0u+MIWM74HanfP2dQ1rnG4syuJcYhI8iy/2E42l/mESNPSb9aRIqnV64h79L2EN/W nr7udXbF6W1lWo4b15W8RMzn1eMCtBFn43gLrsJZFOERBzQjKe4lfc7NRf//bzaF3Vki lzXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=aPUn+wcL; 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=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1-v6si6281567ple.262.2018.08.09.14.47.25; Thu, 09 Aug 2018 14:47:39 -0700 (PDT) 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=@crapouillou.net header.s=mail header.b=aPUn+wcL; 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=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727713AbeHJALy (ORCPT + 99 others); Thu, 9 Aug 2018 20:11:54 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:32804 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727628AbeHJALw (ORCPT ); Thu, 9 Aug 2018 20:11:52 -0400 From: Paul Cercueil To: Rob Herring , Mark Rutland , Thierry Reding , Daniel Lezcano , Thomas Gleixner , Wim Van Sebroeck , Guenter Roeck , Ralf Baechle , Paul Burton , James Hogan , Jonathan Corbet , Lee Jones , Mathieu Malaterre , Ezequiel Garcia Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-mips@linux-mips.org, linux-doc@vger.kernel.org, linux-clk@vger.kernel.org, Paul Cercueil Subject: [PATCH v6 10/24] watchdog: jz4740: Avoid starting watchdog in set_timeout Date: Thu, 9 Aug 2018 23:44:00 +0200 Message-Id: <20180809214414.20905-11-paul@crapouillou.net> In-Reply-To: <20180809214414.20905-1-paul@crapouillou.net> References: <20180809214414.20905-1-paul@crapouillou.net> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1533851106; bh=XMJB0o3ARAXBmfldCEPDdZOf4qYA3M3nQzxvgnxrgmA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=aPUn+wcL9d0+TCCTxw6HcKX+wuZmS4afX0Uy4H8pGu5VWzBr3lY2DL1rm8IT061OfEby14Y22tlPV4H2pAcL37kSnS2C2n6YCQzkGWUwlF3HySlL+W1t3xs2sSJkImKWoHuk+Voy0a52R6P1Jp5SI1/7yRxxMjmNVsx1yu8Fj/8= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously the jz4740_wdt_set_timeout() function was starting the timer unconditionally, even if it was stopped when that function was entered. Now, the timer will be restarted only if it was already running before this function is called. Signed-off-by: Paul Cercueil --- drivers/watchdog/jz4740_wdt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) v6: New patch diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index 0f54306aee25..45d9495170e5 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c @@ -64,13 +64,15 @@ static int jz4740_wdt_set_timeout(struct watchdog_device *wdt_dev, { struct jz4740_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); u16 timeout_value = (u16)(drvdata->clk_rate * new_timeout); + u32 tcer; + regmap_read(drvdata->map, TCU_REG_WDT_TCER, &tcer); regmap_write(drvdata->map, TCU_REG_WDT_TCER, 0); regmap_write(drvdata->map, TCU_REG_WDT_TDR, timeout_value); regmap_write(drvdata->map, TCU_REG_WDT_TCNT, 0); - regmap_write(drvdata->map, TCU_REG_WDT_TCER, TCU_WDT_TCER_TCEN); + regmap_write(drvdata->map, TCU_REG_WDT_TCER, tcer & TCU_WDT_TCER_TCEN); wdt_dev->timeout = new_timeout; return 0; @@ -86,6 +88,7 @@ static int jz4740_wdt_start(struct watchdog_device *wdt_dev) return ret; jz4740_wdt_set_timeout(wdt_dev, wdt_dev->timeout); + regmap_write(drvdata->map, TCU_REG_WDT_TCER, TCU_WDT_TCER_TCEN); return 0; } -- 2.11.0