Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2414765rbb; Wed, 28 Feb 2024 00:35:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVkqDlxcIKYVEq7zKyx/2z+gmvnJjGCQ2AS9H3PB2N1oBPS4WFt/MftI0VQIZnHwmj+ybeGoFh7eWb4+aryfrreDmgJAn0/9WXKGaH3tA== X-Google-Smtp-Source: AGHT+IE3gbbSDYcFXOTIL2C4xY4wWnfpOMq97DPiYtJbRDNHRT2KTtzwkskDGPqOEFwrZoZ6uFQI X-Received: by 2002:a05:620a:2995:b0:787:f4e5:5e44 with SMTP id r21-20020a05620a299500b00787f4e55e44mr301847qkp.19.1709109333075; Wed, 28 Feb 2024 00:35:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709109333; cv=pass; d=google.com; s=arc-20160816; b=u6LfWXVd6t5aUuHpJC9tcDU8tiQsAVoBD13C4zf3Hu43/LbjR1UorI52YvVnpHPS3i ObQITsO1ryO98h+Lv4rKuccs8jA2JQbKpsofktzs0cn1yv9XM3k6nJ3nJwXJyWcvCB5a zhs05sT/BRJu/w4qnm64h/j46pganApQqpR8CN57gek1J7/HuMraZwedWR/or2oNUUcq NnNBlfVSjKRP/CaMp0UzWJDc/QPUcJU9bL6ODnOOC8fy7HlQzeScTlLc9PKM9hdPqx0o 4pbl6YJbPpZTpIzHXiHCzyhL1XnyG/l+RSl8j22zEu+JtLmtdTgl8sM9v/XyoSwntgfL KciA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CK+4L+T/fCIZeFhsmGZI2escuTtf5tzbbpdNzNvLL94=; fh=bnkrp7qmIJ76Di4px+4GQzz9bOtm2rGlioMAwuAD0V8=; b=k0oIUfH/9qoEXnozBWDBQjHfpea4AYXSgL6smsz+FAnsQhtmEXiWMD+KbA9mq7g5nV GsCu2Y7T0ktQqHIrf2jqNK5LGBYgEiFf4FLahv3cH7CN9+/1IMEI6rOgmcyazGzELiXm UNW+WzR+MkIqBEw8il2tMvlndvb5RxAQMo6B3Gc7Z7/uzUn7baWklijS3FQnb9L8kKBT 9+2weMw4J7hIiLrmcd2w0oJCArogQ+SWYRGwsFRUHV6g8NpJXkhpuWqVbHDHBq1qiX2G oFr1kHHXjQqRVwp9I24N0LLkLHETkA5sbr81T4qkLBGyt49vRtSE+1uYhaxASZQM9rPC mazw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=I1oWmTp+; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-84683-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84683-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u19-20020a05620a023300b00787d4c64080si5676888qkm.381.2024.02.28.00.35.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:35:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84683-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=I1oWmTp+; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-84683-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84683-linux.lists.archive=gmail.com@vger.kernel.org" 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 9A90B1C23C04 for ; Wed, 28 Feb 2024 08:35:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C8D2381CB; Wed, 28 Feb 2024 08:33:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="I1oWmTp+" Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 723AD3612C for ; Wed, 28 Feb 2024 08:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109208; cv=none; b=tqaGzaBvo7rBtZ7lQmw5wWYlCdo1sG+EyW0ALTgO52fkn6MDPaohRBh/XqcPLiWE+OH/elNykREc1CIdK/K2V/x1rPAlSoEsnJ4yxzWdJ7I6NC+jKMhX+SLv2kY9ZWCQGs8vP8Qg/x17PWJcNz/9Sqhgo7OHJVxylZnlmLvj8wk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109208; c=relaxed/simple; bh=Rdlb2ia/Zc28BSEYVcVdZUAeB+95/SXqjOJ1NOQ27MU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mwFzRo8gUJ6YxQi7Hs3x+g5klXkR4JUkG8W7L8b9fXfZTUkdbA4+owprmudbA22Kx4e12hT5mmsIBjO4z1MTchoq87gsYwuRcMxp4sSqVdefIgTk848hV1YjvHx1lWK/vPw/G3mTm7Iqm2P69W/ht/Mbb68ROAYsqTUqgtJM69w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=I1oWmTp+; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a3ee69976c9so655534766b.0 for ; Wed, 28 Feb 2024 00:33:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1709109204; x=1709714004; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CK+4L+T/fCIZeFhsmGZI2escuTtf5tzbbpdNzNvLL94=; b=I1oWmTp+aD0H2i8uoTd9oTKsnW4BYXvwX/ALMk0OFOsB4QBlO8Ot7ybR14BsHW3nC4 qElOrDmrrlpaQpEhfpQIgmHMpO1I0BGqEPsbraOILsshM+YVWMBuFKw3SfUW5ulDQ5rf Pfg12vJ2rQc5e4O2lWiqdNRb8E7a4/uIjdfvfltzRLTX7Jotv2fFGiP2NPx2x+7BDgQe qEBZB/zl+SUx12KutfXU9NlPcz/9AaO1t6eYVze9EoSPGlK7tyi0tZQceQj5VnvXPL1f w69I/yX36S1nHieUS78MEcBxIPbQ0jVU+BO6LScGdBpmNMvr8NTbeNuAmLgU63YW9T+O gWRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709109204; x=1709714004; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CK+4L+T/fCIZeFhsmGZI2escuTtf5tzbbpdNzNvLL94=; b=FIFIQD1ZuL9BT6GHQQXy49SYelHEwSZbLy28MSOQeilTy9i0xEnmgDbGZCN1AHuXUi BXuK6xXFf8EPhCOrxCZLB3DdLCUjPgqctu+C3WYqI8bv7d6BiBqUtcbDDRAMzvq339rb YuYCviufv3DjTQTOBL0zyxgdIy+UqMC0DIkQUgQj/LpzPVC3YtZvCcZj6A2mCMs8owJr zGyclWuqzXjV2OnJkvhVPUwq2QM0rC1u/CQOu3vXy0U6+qp+/pFwYsXjye1YvnsYWVza jPcdQx5Wy9ZckjX5e8db//0tS/6j2HJHZoJ2att5lkDZurZw5uwLeB3eN9tngGLqRk4P avIg== X-Forwarded-Encrypted: i=1; AJvYcCVo/YRmwlE2ygT84D1bQkVl2VN2LUBX/eDUxgScmy4L1KlVQBBAZB9XrbXPqdXw9xelm58GwI6DKHtpiBhi/KSGzBDFOpeXEDbDt09G X-Gm-Message-State: AOJu0YxDBuWemNM6bRVY3/wvVdcpXLe0xIf3XEZs5LpwfkMlMWM1n+Uk PbF+dYYfdIx0tPekG16jJuMjwxcjLW9Z9KVGR2tKC/yt13am6UmpXhZzEORND+k= X-Received: by 2002:a17:906:254b:b0:a43:fd9e:2d44 with SMTP id j11-20020a170906254b00b00a43fd9e2d44mr610957ejb.42.1709109204365; Wed, 28 Feb 2024 00:33:24 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.83]) by smtp.gmail.com with ESMTPSA id qh16-20020a170906ecb000b00a432777eb77sm1593987ejb.60.2024.02.28.00.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:33:24 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: wim@linux-watchdog.org, linux@roeck-us.net, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com, biju.das.jz@bp.renesas.com Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v8 07/10] watchdog: rzg2l_wdt: Rely on the reset driver for doing proper reset Date: Wed, 28 Feb 2024 10:32:50 +0200 Message-Id: <20240228083253.2640997-8-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228083253.2640997-1-claudiu.beznea.uj@bp.renesas.com> References: <20240228083253.2640997-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea The reset driver has been adapted in commit da235d2fac21 ("clk: renesas: rzg2l: Check reset monitor registers") to check the reset monitor bits before declaring reset asserts/de-asserts as successful/failure operations. With that, there is no need to keep the reset workaround for RZ/V2M in place in the watchdog driver. Signed-off-by: Claudiu Beznea Reviewed-by: Philipp Zabel --- Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - collected tag Changes in v3: - none Changes in v2: - none drivers/watchdog/rzg2l_wdt.c | 39 ++++-------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 29eb47bcf984..42f1d5d6f07e 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -54,35 +53,11 @@ struct rzg2l_wdt_priv { struct reset_control *rstc; unsigned long osc_clk_rate; unsigned long delay; - unsigned long minimum_assertion_period; struct clk *pclk; struct clk *osc_clk; enum rz_wdt_type devtype; }; -static int rzg2l_wdt_reset(struct rzg2l_wdt_priv *priv) -{ - int err, status; - - if (priv->devtype == WDT_RZV2M) { - /* WDT needs TYPE-B reset control */ - err = reset_control_assert(priv->rstc); - if (err) - return err; - ndelay(priv->minimum_assertion_period); - err = reset_control_deassert(priv->rstc); - if (err) - return err; - err = read_poll_timeout(reset_control_status, status, - status != 1, 0, 1000, false, - priv->rstc); - } else { - err = reset_control_reset(priv->rstc); - } - - return err; -} - static void rzg2l_wdt_wait_delay(struct rzg2l_wdt_priv *priv) { /* delay timer when change the setting register */ @@ -187,13 +162,12 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, unsigned long action, void *data) { struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); + int ret; clk_prepare_enable(priv->pclk); clk_prepare_enable(priv->osc_clk); if (priv->devtype == WDT_RZG2L) { - int ret; - ret = reset_control_deassert(priv->rstc); if (ret) return ret; @@ -205,7 +179,9 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, rzg2l_wdt_write(priv, PEEN_FORCE, PEEN); } else { /* RZ/V2M doesn't have parity error registers */ - rzg2l_wdt_reset(priv); + ret = reset_control_reset(priv->rstc); + if (ret) + return ret; wdev->timeout = 0; @@ -297,13 +273,6 @@ static int rzg2l_wdt_probe(struct platform_device *pdev) priv->devtype = (uintptr_t)of_device_get_match_data(dev); - if (priv->devtype == WDT_RZV2M) { - priv->minimum_assertion_period = RZV2M_A_NSEC + - 3 * F2CYCLE_NSEC(pclk_rate) + 5 * - max(F2CYCLE_NSEC(priv->osc_clk_rate), - F2CYCLE_NSEC(pclk_rate)); - } - pm_runtime_enable(&pdev->dev); priv->wdev.info = &rzg2l_wdt_ident; -- 2.39.2