Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp122161lqp; Thu, 4 Apr 2024 08:34:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW27TnqiuKIteiR9oBJWYbOw9c+qBnNPniGkJBF09IqTTS7NUFXhGKSqBRXeiStd2CvOHgIzhks0EewWdqbqHTcZABFyp5J2/A1MOEemQ== X-Google-Smtp-Source: AGHT+IFLqEY+JmgS7drwEoLWPZ249B90vkwTMsHuiwkX8k//tFKjHZ9Z0kSCkAa9js7Q5Cz6hKMD X-Received: by 2002:a05:622a:28a:b0:431:7c1e:a76c with SMTP id z10-20020a05622a028a00b004317c1ea76cmr3256563qtw.64.1712244843858; Thu, 04 Apr 2024 08:34:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712244843; cv=pass; d=google.com; s=arc-20160816; b=yHuX3vhZNZtpJHM1FYZOEvAwRWv69WSCztlHgnp5prKQ8Oa3m+16aYYww80Ko6+yHp hi/T1uYQDu60CaJIeTphi+nLRJavp2RTUdIYvyw584yM+1oC4+KZpLKechcFLhKTXj5N QDKZvut8mu+TNwEdxOjfYtAlz8LzvXbu1DMMr70+h5GSVpni+VLFuHF/AuImVhp5Sqgx R7lGem6Jtvqnh921oYdiwIGCB3PbCOwn/9xaZgZ1j/G0oMLkbGE4IkzKoxDWYgOWnIE2 zD9L6fi4mV7SrLfdEg/ZsdL1f73ihFLY7emhZ+hKBIt67D2NjsbRzJwvkifnxzpIbyjt 2lVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ML1mhSa9Q7+kMHMImeTyEWgHXR1D+6Svt3w13mxjqjY=; fh=yA4CB6oj8qrYXAgXlyH/Rz1FfH4JIR1db/xQGW9Q0u0=; b=Ydgs2yM+rRzbsdyu6QEWzEK0rpxVYuozb0DwtrvSlF7IywY2OdL8kKzRsv3qV3kPVj iEgkgq4yb5HguMCWzrDNSkQ22AKVr5HixyJ1DqXuJLGgZEgtGsXzKsRLpUuOhabJBfh8 F+1A8SUG1/7PENWUKMD3HGXEfLAbe84RP96uFCZchTKLCvaDDXlZNg+OIO6fIj4NjbLr EaBQ707beUaMQESoVaBUuwsF5nk/Uh62pIIqEkZYQR5k6Z12aJURK2hZcLCv8jmLWB4L 9fAzi11+NOO1hdsXGPUJtz+LUJ2AOR4vaCXOwHRr3aBbopVThC6rG7eIyjIqalWur28Y AwBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xP+IHdHo; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-131730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f7-20020a05622a1a0700b004343e4dc4f8si3465636qtb.279.2024.04.04.08.34.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 08:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=xP+IHdHo; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-131730-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131730-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C8B661C25E8E for ; Thu, 4 Apr 2024 15:33:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B0F7129A78; Thu, 4 Apr 2024 15:33:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="xP+IHdHo" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F21CB32C8E; Thu, 4 Apr 2024 15:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712244816; cv=none; b=pQ/vqhaTen38XjwyLYRt93bW7OY8QFy2BYbLWfC1S4+nOMKCTvw2wIIWZYCpzpyu6s72W23OI1+YCAUyr85lfo/SofC9X5Vo99Q9UqsaQriVFQ38TRPqvC5r5YTD6uogpuIli+lvhVKDiGy0is4TQnd79RDD24SKKOqgmTW8Bks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712244816; c=relaxed/simple; bh=mMkr/dYqLpU1MsD5m4UuvQAkxg99rgTMBcVYr7tcEA4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=sIfyiUMsiLuH77jwJ7TwKWpaD5qRcNltGWgDf+/6INA+ekr1J1FpZeS4WH32aKJ+qSUwaiyFpdEMzrwLxv290fdscimOiqGS/tKdWUJiraaZDKyNTNlOjz1oDmmxHiMR9Z7B8Nt1/Gs+IkDOSLWKEH3fqiKAiaBuXgFQZnPiZIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=xP+IHdHo; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 434FXJMJ074202; Thu, 4 Apr 2024 10:33:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1712244799; bh=ML1mhSa9Q7+kMHMImeTyEWgHXR1D+6Svt3w13mxjqjY=; h=From:To:CC:Subject:Date; b=xP+IHdHov6//Cdt7T63m8IxZ9iVzgWpfDZjn4k2bj7gi/ygts2ChwLLVkXgziY0tk iQ+o7BPY9jf4IdwsmfgYuofAzfmAHgvTmT/K24EJJY4EQfAHFF2KMoEd8zSgHktwDt yliNm3iersUonXNLqivAp07N0WX25TgVw/95Obos= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 434FXJ9U057162 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 4 Apr 2024 10:33:19 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 4 Apr 2024 10:33:19 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 4 Apr 2024 10:33:19 -0500 Received: from judy-hp.dhcp.ti.com (judy-hp.dhcp.ti.com [128.247.81.105]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 434FXJma015284; Thu, 4 Apr 2024 10:33:19 -0500 From: Judith Mendez To: Wim Van Sebroeck , Guenter Roeck CC: , , Francesco Dolcini Subject: [PATCH v2] watchdog: rti_wdt: Set min_hw_heartbeat_ms to accommodate 5% safety margin Date: Thu, 4 Apr 2024 10:33:19 -0500 Message-ID: <20240404153319.1088644-1-jm@ti.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 On AM62x, the watchdog is pet before the valid window is open. Fix min_hw_heartbeat and accommodate a 5% safety margin with the exception of open window size < 10%, which shall use <5% due to the smaller open window size. cc: stable@vger.kernel.org Fixes: 5527483f8f7c (" watchdog: rti-wdt: attach to running watchdog during probe") Signed-off-by: Judith Mendez --- drivers/watchdog/rti_wdt.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c index 8e1be7ba0103..0b16ada659cc 100644 --- a/drivers/watchdog/rti_wdt.c +++ b/drivers/watchdog/rti_wdt.c @@ -92,7 +92,7 @@ static int rti_wdt_start(struct watchdog_device *wdd) * to be 50% or less than that; we obviouly want to configure the open * window as large as possible so we select the 50% option. */ - wdd->min_hw_heartbeat_ms = 500 * wdd->timeout; + wdd->min_hw_heartbeat_ms = 550 * wdd->timeout; /* Generate NMI when wdt expires */ writel_relaxed(RTIWWDRX_NMI, wdt->base + RTIWWDRXCTRL); @@ -126,31 +126,33 @@ static int rti_wdt_setup_hw_hb(struct watchdog_device *wdd, u32 wsize) * be petted during the open window; not too early or not too late. * The HW configuration options only allow for the open window size * to be 50% or less than that. + * To avoid any glitches, we accommodate 5% safety margin, with the + * exception of open window size < 10%. */ switch (wsize) { case RTIWWDSIZE_50P: - /* 50% open window => 50% min heartbeat */ - wdd->min_hw_heartbeat_ms = 500 * heartbeat; + /* 50% open window => 55% min heartbeat */ + wdd->min_hw_heartbeat_ms = 550 * heartbeat; break; case RTIWWDSIZE_25P: - /* 25% open window => 75% min heartbeat */ - wdd->min_hw_heartbeat_ms = 750 * heartbeat; + /* 25% open window => 80% min heartbeat */ + wdd->min_hw_heartbeat_ms = 800 * heartbeat; break; case RTIWWDSIZE_12P5: - /* 12.5% open window => 87.5% min heartbeat */ - wdd->min_hw_heartbeat_ms = 875 * heartbeat; + /* 12.5% open window => 92.5% min heartbeat */ + wdd->min_hw_heartbeat_ms = 925 * heartbeat; break; case RTIWWDSIZE_6P25: - /* 6.5% open window => 93.5% min heartbeat */ - wdd->min_hw_heartbeat_ms = 935 * heartbeat; + /* 6.5% open window => 96.5% min heartbeat */ + wdd->min_hw_heartbeat_ms = 965 * heartbeat; break; case RTIWWDSIZE_3P125: - /* 3.125% open window => 96.9% min heartbeat */ - wdd->min_hw_heartbeat_ms = 969 * heartbeat; + /* 3.125% open window => 97.9% min heartbeat */ + wdd->min_hw_heartbeat_ms = 979 * heartbeat; break; default: base-commit: 860bbe8e618fd62446309e286ab4a83d38201c0a -- 2.43.2