Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1831512ybb; Thu, 26 Mar 2020 08:07:37 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtnP8Hcjm7AWAophcusrcW2JRq9P3CkW34ah8GE80U3FOeNIOP6tngHcie/Ig4aCidy79jH X-Received: by 2002:aca:d50f:: with SMTP id m15mr358929oig.19.1585235257751; Thu, 26 Mar 2020 08:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585235257; cv=none; d=google.com; s=arc-20160816; b=yQqiz6XCqlaHXwKknar+G21ch0703r+pT/sqofXLfREOU+lYx2JFTkErMBTWSNKzoB hX1xds7KK7+5bUcyi+RYBOHMD7F82go9Q4iudO/QjOsFQlrPVhLc+8YHe9cROVz6HBCU JaY0l8z3I8hrDZvNXjNueYBu58JdPUMXju9u/Jvc/k/M0cW+RRB+/CCOTt2BPF62y1Cu nQAtgTIdLyqTDp3DtTxH3kh4d9VPQXopmk3Nm71GCK6q4lmGtHqUE+43qunGLi6oufnk P3gdGo6Y3z6t+IMqVJskCU6oQ54t8uXV5DsizPT8llP/foCZCGZSfzcqqFJEhX5RkYNt bNAw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=rUzAGlVkpmwbFE9JLntcUq5EEof70GqXTJXs3xGUGPs=; b=qed9zuxs0GwdjktWKhm8w+R77u+0zpXyfd8i4Yk3lxBsBBPlmmx2or7OUKMI5YoWcm oZoiYW1alV+ohbrj0QNWUOt+tSGlHs2oGQdRqrPnhMGHMJmmhzuXko5jRtFx95f7hLPa o2jagruVuwIlI92UWLY+S8+twpzAiGheeuj9R7hvZ9lDbNaKjcjXj85Tqp4PI6U20JAv L6IGZp1o6wvpB4KANIryNmujZEGA0pmonxcNprrtkQmZCeytEs4xcpL21w8yJgph+4aj tD0f1Mp8bxxvqg+bePqxceYbOo+G3fPPcmyf71/D+5HupuYgs4bxe5gtsa9EUf09QzsR VKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@phytec.de header.s=a1 header.b=TPV+j3xY; 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 q23si1207650otm.79.2020.03.26.08.07.13; Thu, 26 Mar 2020 08:07:37 -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=fail header.i=@phytec.de header.s=a1 header.b=TPV+j3xY; 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 S1727857AbgCZPCF (ORCPT + 99 others); Thu, 26 Mar 2020 11:02:05 -0400 Received: from mickerik.phytec.de ([195.145.39.210]:46414 "EHLO mickerik.phytec.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbgCZPCF (ORCPT ); Thu, 26 Mar 2020 11:02:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; d=phytec.de; s=a1; c=relaxed/simple; q=dns/txt; i=@phytec.de; t=1585234924; x=1587826924; h=From:Sender:Reply-To:Subject:Date:Message-Id:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=z2mlDmUTVL8bamKSgP9kkGknh9FvkyYg3rvvPm37X4Q=; b=TPV+j3xYLPi/szZNWzSPvj3Qxqy6XFqbU9pzIWY+kiVsdQk7SPqydxOYrVrvc5pk 6Bg/i+jxtn1wEgqbpEwOAKfvQDyje+Ndkr1dBM7jC+FjAZeXHpIxExFOj6i+UMuG gRBT2lreLWnhDVN98uBuNizfGUCe4I3Xy+6d9ldVM2E=; X-AuditID: c39127d2-583ff70000001db9-a4-5e7cc3ecbc8d Received: from idefix.phytec.de (Unknown_Domain [172.16.0.10]) by mickerik.phytec.de (PHYTEC Mail Gateway) with SMTP id 14.1C.07609.CE3CC7E5; Thu, 26 Mar 2020 16:02:04 +0100 (CET) Received: from augenblix2.phytec.de ([172.16.0.56]) by idefix.phytec.de (IBM Domino Release 9.0.1FP7) with ESMTP id 2020032616020393-89374 ; Thu, 26 Mar 2020 16:02:03 +0100 From: Stefan Riedmueller To: Wim Van Sebroeck , Guenter Roeck , Support Opensource Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] watchdog: da9062: Use pre-configured timeout until userspace takes over Date: Thu, 26 Mar 2020 16:02:01 +0100 Message-Id: <20200326150203.371673-1-s.riedmueller@phytec.de> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on Idefix/Phytec(Release 9.0.1FP7|August 17, 2016) at 26.03.2020 16:02:04, Serialize by Router on Idefix/Phytec(Release 9.0.1FP7|August 17, 2016) at 26.03.2020 16:02:04 X-TNEFEvaluated: 1 Content-Transfer-Encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOLMWRmVeSWpSXmKPExsWyRoCBS/fN4Zo4g9VL+C0u75rDZnFj3T52 iycLzzBZ7G29yGzx+OU/ZgdWjxWf9D1WrlnD6rHzewO7x+dNcgEsUVw2Kak5mWWpRfp2CVwZ H28ZFXTxVfzf0s3ewPiSu4uRk0NCwETi3oerjF2MXBxCAlsZJfrvNbJAOOcYJZ7/vcQGUsUm YCSxYFojE0hCRKCNUWLP0VmMIAlmAQeJx3MfgtnCAjES27ZMZgKxWQRUJZq+7GUGsXkFbCWu tLcD2RxA6+QlDh/KgggLSpyc+QRsmYTAFUaJ47d7WCBOEpI4vfgsM8R8bYllC18zT2Dkm4Wk ZxaS1AJGplWMQrmZydmpRZnZegUZlSWpyXopqZsYgYF3eKL6pR2MfXM8DjEycTAeYpTgYFYS 4X0aWRMnxJuSWFmVWpQfX1Sak1p8iFGag0VJnHcDb0mYkEB6YklqdmpqQWoRTJaJg1OqgdHl /zNTM0dh0/goGenJVzQb+/SXnt9puCx0xcaQ7ui5NxL2v5m2MLjv5c9DzMphj9KmJzid2nPI 7W/UuRczgk54ctSYFQJjjnF7ae5Rt39PQndMXffOqvV8uk9X4LZPl1db9z+z6pQ1Fvlgmzxv xoeIL+dexBZY8N9fdaDtzYa2LRMajOI+8CmxFGckGmoxFxUnAgDn9A2bKgIAAA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the watchdog is already running during probe read back its pre-configured timeout (set e.g. by the bootloader) and use it to ping the watchdog until userspace takes over. Otherwise the default timeout set before might not result in a fast enough ping. Signed-off-by: Stefan Riedmueller --- drivers/watchdog/da9062=5Fwdt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/watchdog/da9062=5Fwdt.c b/drivers/watchdog/da9062=5Fwd= t.c index 0ad15d55071c..6d81b1276b87 100644 --- a/drivers/watchdog/da9062=5Fwdt.c +++ b/drivers/watchdog/da9062=5Fwdt.c @@ -35,6 +35,14 @@ struct da9062=5Fwatchdog { bool use=5Fsw=5Fpm; }; =20 +static unsigned int da9062=5Fwdt=5Fread=5Ftimeout(struct da9062=5Fwatchdog= *wdt) +{ + int val; + + regmap=5Fread(wdt->hw->regmap, DA9062AA=5FCONTROL=5FD, &val); + return wdt=5Ftimeout[val & DA9062AA=5FTWDSCALE=5FMASK]; +} + static unsigned int da9062=5Fwdt=5Ftimeout=5Fto=5Fsel(unsigned int secs) { unsigned int i; @@ -184,6 +192,7 @@ static int da9062=5Fwdt=5Fprobe(struct platform=5Fdevic= e *pdev) { struct device *dev =3D &pdev->dev; int ret; + int timeout; struct da9062 *chip; struct da9062=5Fwatchdog *wdt; =20 @@ -213,6 +222,13 @@ static int da9062=5Fwdt=5Fprobe(struct platform=5Fdevi= ce *pdev) watchdog=5Fset=5Fdrvdata(&wdt->wdtdev, wdt); dev=5Fset=5Fdrvdata(dev, &wdt->wdtdev); =20 + timeout =3D da9062=5Fwdt=5Fread=5Ftimeout(wdt); + if (timeout > 0) { + wdt->wdtdev.timeout =3D timeout; + set=5Fbit(WDOG=5FHW=5FRUNNING, &wdt->wdtdev.status); + dev=5Finfo(wdt->hw->dev, "watchdog is running (%u s)", timeout); + } + ret =3D devm=5Fwatchdog=5Fregister=5Fdevice(dev, &wdt->wdtdev); if (ret < 0) return ret; --=20 2.23.0