From patchwork Thu Nov 21 10:35:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Peng 1. (NSB - CN/Hangzhou)" X-Patchwork-Id: 11256073 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D0B1913 for ; Thu, 21 Nov 2019 10:35:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34F1920872 for ; Thu, 21 Nov 2019 10:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726014AbfKUKfS (ORCPT ); Thu, 21 Nov 2019 05:35:18 -0500 Received: from cnshjsmin05.app.nokia-sbell.com ([116.246.26.45]:56124 "EHLO cnshjsmin05.nokia-sbell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbfKUKfS (ORCPT ); Thu, 21 Nov 2019 05:35:18 -0500 X-AuditID: ac18929d-483ff700000014de-52-5dd668616efd Received: from CNSHPPEXCH1604.nsn-intra.net (Unknown_Domain [135.251.51.104]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by cnshjsmin05.nokia-sbell.com (Symantec Messaging Gateway) with SMTP id 24.6B.05342.16866DD5; Thu, 21 Nov 2019 18:35:13 +0800 (HKT) Received: from CNSHPPEXCH1601.nsn-intra.net (135.251.51.101) by CNSHPPEXCH1604.nsn-intra.net (135.251.51.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 21 Nov 2019 18:35:13 +0800 Received: from CNSHPPEXCH1601.nsn-intra.net ([135.251.51.101]) by CNSHPPEXCH1601.nsn-intra.net ([135.251.51.101]) with mapi id 15.01.1713.007; Thu, 21 Nov 2019 18:35:13 +0800 From: "Wang, Peng 1. (NSB - CN/Hangzhou)" To: Guenter Roeck CC: "wim@linux-watchdog.org" , "linux-watchdog@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2] watchdog: make DesignWare watchdog allow users to set bigger timeout value Thread-Topic: [PATCH v2] watchdog: make DesignWare watchdog allow users to set bigger timeout value Thread-Index: AdWgVy1kREB4bw5dQ4u+4ZEezt20uw== Date: Thu, 21 Nov 2019 10:35:12 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [135.251.51.115] MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeLIzCtJLcpLzFFi42Jp/22coZuYcS3W4G+XiMW+zutMFpd3zWGz uLFuH7vF45f/mB1YPHbOusvusXLNGlaPz5vkApijuGxSUnMyy1KL9O0SuDKOHlnFVnBGoGLL IfMGxikCXYycHBICJhLLf39h7GLk4hASOMQkcfTbMXYI5y+jxIZ1J5ghnE2MEvP2vWcBaWET cJdo2rSODcQWEVCV2LdjJVgRs8BuRom5jW/AioQFEiQu7mxngihKlfg24QCUrScxY/MmsBoW oObOczfABvEK2EnsPDqHGcRmFJCVmPboPlg9s4C4xK0n85kgbhWQWLLnPDOELSrx8vE/1i5G DiBbSaJvAxOIySygKbF+lz5Ep6LElO6H7BDTBSVOznzCMoFRZBaSobMQOmYh6ZiFpGMBI8sq RunkvOKMrOLczDwDU728/OzMRN3ipNScHL3k/NxNjMCoWSMxae4Oxs7O+EOMAhyMSjy8GRpX Y4VYE8uKK3MPMUpwMCuJ8O65fiVWiDclsbIqtSg/vqg0J7X4EKM0B4uSOG/L5IWxQgLpiSWp 2ampBalFMFkmDk6pBsYV7UZX7y9YKnL7Ksexl4c2Hq7ncBbUiWh04feqnV62RaCr5OqWsvXP b3b9CT0axpw/rWZBJuf7rb9WWsiXP9r+X+j57KD9Gyecz3p77HqV8M5P9mwm33glgrb1yv+c Ozej407/s/y1E+PVz0mVvV/HuddpwgcdB9eDDYorY73nrFEWbnYzP2ivxFKckWioxVxUnAgA M7xmhJYCAAA= Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From aabaa4b709bd451e566c906e8d1dca48f92f9b12 Mon Sep 17 00:00:00 2001 From: Peng Wang Date: Wed, 20 Nov 2019 15:12:59 +0800 Subject: [PATCH] watchdog: make DesignWare watchdog allow users to set bigger timeout value watchdog_dev.c provides means to allow users to set bigger timeout value than HW can support, make DesignWare watchdog align with this. Reviewed-by: Guenter Roeck Reviewed-by: Guenter Roeck --- v2 -> v1: - use top_s to compare with wdd->max_hw_heartbeat_ms - update wdd->timeout in case it's greater than HW supports - fix comments error v1: initial version Signed-off-by: Peng Wang --- drivers/watchdog/dw_wdt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index fef7c61..12c116e 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -114,7 +114,15 @@ static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s) writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT, dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET); - wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val); + /* + * In case users set bigger timeout value than HW can support, + * kernel(watchdog_dev.c) helps to feed watchdog before + * wdd->max_hw_heartbeat_ms + */ + if ( top_s * 1000 <= wdd->max_hw_heartbeat_ms ) + wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val); + else + wdd->timeout = top_s; return 0; }