Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2912060rdb; Tue, 6 Feb 2024 01:11:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHExeQ0OTCmknxcUP9WEnT3v5/vitpT9ER8FP95tT8lgLz86oHYHERYp6xU/qzPtba3Zgd/ X-Received: by 2002:a17:907:960b:b0:a35:edda:ca8b with SMTP id gb11-20020a170907960b00b00a35eddaca8bmr1612222ejc.76.1707210680246; Tue, 06 Feb 2024 01:11:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707210680; cv=pass; d=google.com; s=arc-20160816; b=Xg3lHupYixrUv+5EP/Tx3xxhxN5d3nhg1x3/5lYU0TpYYSPWH6EALlNol4afjtWUDg AGBg+2SHo0CJvKRt5S7RMFxp/fy7c/8uHAWxqN2HpbXTXcE48C0OYGoxbKCkdtgKSXN9 1jPtSmKsdZvafYvWxYfPp3ae/ZEwOxCsvm2PP7Hip97LG/O9pbgGPPPojEnKsyZ1PFGr sxGHRN7sR6ZBOc9FzGZgfq4o1JNhbL9i0vASlVjoBv3nNAH3sWr4VRwEGsDuO9mGPdwW 64teug7tC4q9Zff5Olv1vfkBlGklqPciMBF3niI8WZ+ccHRrAKeYZGm7drJmDqM8MFyM bh8Q== 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=rA4Lt7wlLZrwShaBAqRMXGVkQhmL/x3EvhyelQZjhV8=; fh=Rcwbckcf1DBcBBs/Lns4Ug272VLlZUJTcUi8lcV3N6w=; b=T6n1HeV+cMyKQlV97ciA4wNffdhryU0T/8t9uLyC1v4bBYECDWapbGPaf+toUZpQAz lSNcX7AehT9HMRlycAyuQ5M/L4w3AjoWvHttFWWPmO5ynLmCAJ8lTnG/DplE4ejVw+Ro pmQaRk/riBgHBy4b3aUWrpLVDidbH7Ai6DW/OepxPhv7ROVDWVs2jdOfNo/lzFY5tSGM zxB99UmFSV4zwgzmAN6LRMqsYMA0PXMrSMzyKgpfN9CihBvYUe69u8zRAn6vtCgKiUjq 6RJRxtsMWBXHoykLnLB/fQe2CPMDLYrSE10jzOgG1AzuqL/D3tKGxZ0l7pOcrgC2pIPu Fcqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=WGtxKTxy; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-54443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54443-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUATaMI5sh/eVpq/+3WXWSuS4Ls34mpjrDo5nEu8E+wSdUQSSiCozUZcnuMWnJ9n0fYEK/4PBlLUX60zmHTenjAUEbMot0+65QggGAh+w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gr6-20020a170906e2c600b00a3774900d13si874375ejb.924.2024.02.06.01.11.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 01:11:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=WGtxKTxy; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-54443-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54443-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D0F211F2481E for ; Tue, 6 Feb 2024 07:53:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C85E612C547; Tue, 6 Feb 2024 07:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="WGtxKTxy" Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 C2CDE12BE80 for ; Tue, 6 Feb 2024 07:52:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707205939; cv=none; b=GxfW9b50gJxQq1VcJaE76COdKp+NLekxQiLusoHfoqigyMgiJMj01C0YsDHNhjLGi8G6Y/pV3ZLbavbCYkOFJVyYZgWE1Js9OdNV+Wgq0Yz32wRR/UqzkpSo3ZOzmpMBIL5kuOIoVim8AiZ4vko9HD0Brh5nqy71JxzIhWa1LTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707205939; c=relaxed/simple; bh=oGuUsUJTOBwH4PJ/XO1WvReC8UQh5qLEUBVQyGMyDWc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RN/xViv1Uo4hnDK7aQs9+fK7yRXjE6uguSmiHsaluAXMOva6kVKF9zo2IRpg+dn+866U1lauDwh69vl6WdNOEjtKfE2z4FDbbsw/ibWVY45adO2eljyS3QQdtwRndfqPRJ9+j9X0hxk5NzZ3B8QVCeTPUHSBIImJ+1DITtmguNI= 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=WGtxKTxy; arc=none smtp.client-ip=209.85.128.53 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-wm1-f53.google.com with SMTP id 5b1f17b1804b1-40fc549ab9bso34953755e9.0 for ; Mon, 05 Feb 2024 23:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1707205935; x=1707810735; 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=rA4Lt7wlLZrwShaBAqRMXGVkQhmL/x3EvhyelQZjhV8=; b=WGtxKTxy7+PiMMhGjoEtNu56/u9mC4E97fFoHIGtyPC6EDifdfqqDQqaqIKUtsFJff fwGQxmXho8YLjEVgPP5Nlx7Irdhyrb2NjfrRMTRBDXxdOnJexLr0oRNjEYV3DlhAlDoC 0C2YgZqmSgxmI4y+uaknpkzUEwOZ5ieu38T8fz+ZV3xFqRlgWcgISB72gkat3YJ22RsB a6eq27rSKFUrbRp7uDoDTSC2Gq/+o8nhz+RdngI80ENtAJcX/DhUPYucmeQARdWyjS5w vPZU6QR5Qpk1d2Tfw9nb9KAFP6tqTCduosWRuB8a7k9pOysTD+zm9CxY96Vk/L3Wng+C YtOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707205935; x=1707810735; 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=rA4Lt7wlLZrwShaBAqRMXGVkQhmL/x3EvhyelQZjhV8=; b=O9ZsWhD9ESp3U15lHq2TS00zAwm+h1yROvPqKz1SOfWabB9DkXFlQibxnRwyDq4eTz 5rWu7Kj7y05Y2iGuy0M8CpOTKOH8Bn/hEW2WNTSLMjCii/64u815BVAJv3nFY52hfC2U YsuhTYmvZzSkzczlf+lNewRC/nLijIlia8+CjbltQzEaZgzZU3TCER+tLHHbtlMO3LTL Hu4MVUp5rR9GxQ8jO7bzbYAxcR7u8nz5/CPbRDPkZGoJzs1Hxy5675MkqKMmuX1g+6NG RWVCQIT5jEL29991FqF7W3g4hn/CDI69OKtvFBI0MM/WA2krp1941nvvSoTCMwYnWih+ ePFw== X-Gm-Message-State: AOJu0Ywln9UYpCK+03538/0mDT1+2sZK/pFhQ7BuZs7t0ssA0oP9fety PHDSF1msniZJFY+7SHIxHxRDWEicsClY9sZdmeWvtcjTtRH1eCZoyBCCCwq4Ukk= X-Received: by 2002:a05:600c:190e:b0:40e:4932:3995 with SMTP id j14-20020a05600c190e00b0040e49323995mr1591113wmq.14.1707205935232; Mon, 05 Feb 2024 23:52:15 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWth/RATJ/DZGD2r0NP4gOV7vr/QlwUYiCe3d7g0uTTH5xUB8Lfqu/xpwzSw5uQfI9krndixIDhcHwNi+XGRSj9b0YUtfGSB0HmNMyIQyQZAdvAhZD0BruFjDwfHZFIIrdbgZ8tO22IRd0xjqZXtMtHFVxG41ZJQX8sNthRJ4w3EylXqHcLsGOQ0Ord611Y6er6R3wwX/JfCJsG3ewtnYNlw6FOlclaY9ZCftxAUGAhpNNrZdtAjeABygyTVcOlySVVXk0y/a2jEEs8lTYmd00nTxhpVLYTx5bcBcvx6U1w6WYmBJ09UigihcMgXUFp9i/zW6phP/FpRDCyCNX4BF2L0ibxvKQre9C/0mexuLmbRU8cUtni8wHyw3+l5AUpRT+CpthQuA/B5hyz460tBmX8F/mEfS+c45jVAdyqHFuWW09UR04glqgTNIkJ8TEafdsVLkqPrdhjcVBsEUAQA01d3oAN5WU26GfZYcHtIL+5v6Ybi/Pzdz52yB+aUAJtMpF9H2YgoDLZ7Q== Received: from claudiu-X670E-Pro-RS.. ([82.78.167.154]) by smtp.gmail.com with ESMTPSA id j32-20020a05600c1c2000b0040fbad272f6sm1106843wms.46.2024.02.05.23.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 23:52:14 -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 v4 5/9] watchdog: rzg2l_wdt: Remove reset de-assert on probe/stop Date: Tue, 6 Feb 2024 09:51:45 +0200 Message-Id: <20240206075149.864996-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240206075149.864996-1-claudiu.beznea.uj@bp.renesas.com> References: <20240206075149.864996-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 There is no need to de-assert the reset signal on probe as the watchdog is not used prior executing start. Also, the clocks are not enabled in probe (pm_runtime_enable() doesn't do that), thus this is another indicator that the watchdog wasn't used previously like this. Instead, keep the watchdog hardware in its previous state at probe (by default it is in reset state), enable it when it is started and move it to reset state when it is stopped. This saves some extra power when the watchdog is unused. Signed-off-by: Claudiu Beznea --- Changes in v4: - none Changes in v3: - none Changes in v2: - none drivers/watchdog/rzg2l_wdt.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 7bce093316c4..93a49fd0c7aa 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -129,6 +129,10 @@ static int rzg2l_wdt_start(struct watchdog_device *wdev) if (ret) return ret; + ret = reset_control_deassert(priv->rstc); + if (ret) + return ret; + /* Initialize time out */ rzg2l_wdt_init_timeout(wdev); @@ -146,7 +150,9 @@ static int rzg2l_wdt_stop(struct watchdog_device *wdev) struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); int ret; - rzg2l_wdt_reset(priv); + ret = reset_control_assert(priv->rstc); + if (ret) + return ret; ret = pm_runtime_put(wdev->parent); if (ret < 0) @@ -186,6 +192,12 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, clk_prepare_enable(priv->osc_clk); if (priv->devtype == WDT_RZG2L) { + int ret; + + ret = reset_control_deassert(priv->rstc); + if (ret) + return ret; + /* Generate Reset (WDTRSTB) Signal on parity error */ rzg2l_wdt_write(priv, 0, PECR); @@ -236,13 +248,11 @@ static const struct watchdog_ops rzg2l_wdt_ops = { .restart = rzg2l_wdt_restart, }; -static void rzg2l_wdt_reset_assert_pm_disable(void *data) +static void rzg2l_wdt_pm_disable(void *data) { struct watchdog_device *wdev = data; - struct rzg2l_wdt_priv *priv = watchdog_get_drvdata(wdev); pm_runtime_disable(wdev->parent); - reset_control_assert(priv->rstc); } static int rzg2l_wdt_probe(struct platform_device *pdev) @@ -285,10 +295,6 @@ static int rzg2l_wdt_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(priv->rstc), "failed to get cpg reset"); - ret = reset_control_deassert(priv->rstc); - if (ret) - return dev_err_probe(dev, ret, "failed to deassert"); - priv->devtype = (uintptr_t)of_device_get_match_data(dev); if (priv->devtype == WDT_RZV2M) { @@ -309,9 +315,7 @@ static int rzg2l_wdt_probe(struct platform_device *pdev) priv->wdev.timeout = WDT_DEFAULT_TIMEOUT; watchdog_set_drvdata(&priv->wdev, priv); - ret = devm_add_action_or_reset(&pdev->dev, - rzg2l_wdt_reset_assert_pm_disable, - &priv->wdev); + ret = devm_add_action_or_reset(&pdev->dev, rzg2l_wdt_pm_disable, &priv->wdev); if (ret < 0) return ret; -- 2.39.2