From patchwork Sun Apr 14 11:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10899801 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DBB2B1800 for ; Sun, 14 Apr 2019 11:09:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB412285C5 for ; Sun, 14 Apr 2019 11:09:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF04A28747; Sun, 14 Apr 2019 11:09:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 311FE285C5 for ; Sun, 14 Apr 2019 11:09:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725805AbfDNLJk (ORCPT ); Sun, 14 Apr 2019 07:09:40 -0400 Received: from sauhun.de ([88.99.104.3]:33170 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726149AbfDNLJj (ORCPT ); Sun, 14 Apr 2019 07:09:39 -0400 Received: from localhost (p5486CDCF.dip0.t-ipconnect.de [84.134.205.207]) by pokefinder.org (Postfix) with ESMTPSA id B81D32CF687; Sun, 14 Apr 2019 13:09:37 +0200 (CEST) From: Wolfram Sang To: linux-watchdog@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Support Opensource , Wolfram Sang Subject: [PATCH RFT] watchdog: da9063_wdt: parse DT for timeout value, too Date: Sun, 14 Apr 2019 13:09:33 +0200 Message-Id: <20190414110933.30529-1-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP And make sure the final obtained value gets properly scaled. Remove two empty lines to group the initialization blocks while we are here. Signed-off-by: Wolfram Sang Reviewed-by: Guenter Roeck Tested-by: Steve Twiss --- Tested with a Renesas Lager board (R-Car H2, DA9063AD), checking the initial timeout value via sysfs. I didn't test handover from bootloader because my bootloader neither supports WDT or I2C out of the box. drivers/watchdog/da9063_wdt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c index 06eb9070203c..3d65e92a4e3f 100644 --- a/drivers/watchdog/da9063_wdt.c +++ b/drivers/watchdog/da9063_wdt.c @@ -208,18 +208,20 @@ static int da9063_wdt_probe(struct platform_device *pdev) wdd->min_timeout = DA9063_WDT_MIN_TIMEOUT; wdd->max_timeout = DA9063_WDT_MAX_TIMEOUT; wdd->min_hw_heartbeat_ms = DA9063_RESET_PROTECTION_MS; - wdd->timeout = DA9063_WDG_TIMEOUT; wdd->parent = dev; - wdd->status = WATCHDOG_NOWAYOUT_INIT_STATUS; watchdog_set_restart_priority(wdd, 128); - watchdog_set_drvdata(wdd, da9063); + /* Set default timeout, maybe override it with DT value, scale it */ + wdd->timeout = DA9063_WDG_TIMEOUT; + watchdog_init_timeout(wdd, 0, dev); + da9063_wdt_set_timeout(wdd, wdd->timeout); + /* Change the timeout to the default value if the watchdog is running */ if (da9063_wdt_is_running(da9063)) { - da9063_wdt_update_timeout(da9063, DA9063_WDG_TIMEOUT); + da9063_wdt_update_timeout(da9063, wdd->timeout); set_bit(WDOG_HW_RUNNING, &wdd->status); }