Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp259461rdb; Mon, 22 Jan 2024 03:24:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIGBudhXkYR9PkteGAuZmeGpQjJfh++Bd0okINye61VzT9TJUw+aaQXPvHyByjVblwut/U X-Received: by 2002:a05:620a:1902:b0:783:9ac3:f6fd with SMTP id bj2-20020a05620a190200b007839ac3f6fdmr2981289qkb.150.1705922674913; Mon, 22 Jan 2024 03:24:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705922674; cv=pass; d=google.com; s=arc-20160816; b=fxprrWSfo62IybRmVKATx0q7+ICHB1ONpUMzGLxv4plaT7755ZxTdFFfZK/qDKuS6p X4iL3Q6+VCQGC83LPDY+GgJzKo44EtgycyLtqTO5nhRKXmw6GmTlxyvKcPUCChMjPbEe EGb0cRvwjQnHZcnAlEz0joIxZzIvUDq/U7ZPgWPumbhUDquROK51JUJRB87GTdkOvjMK BneSFVZVuAtVXgOQK+tEIIDd+hzGubsXEtkY+sQTzPtl/O7+qqyWj2CXQd1J5vK4UJsi 7/2HN2Sk448LjhoXr/9lv9HFQRHUk/Vhu4UouDAvH0Wne8WBfMAIBZeXphlIt78WKw02 TsXQ== 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=pqtCeRjkRQZF1X7FzpXbbf307qf5/3u+eo/6taxNjjo=; fh=udVwO0NRYY7+WHGry+7JLVq01vR2BwLxtvAczjMVMl8=; b=rMUEX9Ewb3Yg5Q0FuATVpfS61RRBfmsl83ocBOpSFACZoMJiM5IaUUfn8MolvT7iwI 8tyRNb59lPAfkZQ6A63IIKE+Z2qr84WOcB9x1HPjE0ZjWObj0UfCOjVJconQTKe7hbfP acgFtiFnmtJNI6b8FRtHZrvq31RBA77+yhRPSZR5aTaZN7BDcHofzhU2BneRZ3XWpvhA /6Pirj+4ibvWVOtoqGrzbvNI5arxfZNMvbOMTtPaIXm1ycV9pFhV2UPYwm4q1l08wiID 62YnJGyPdI6gOYyZ1SUvJXqaED5gzanIy+znmmRuaOcTl9aKDP16QAZPiOcG03zAGtVx Iirw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=IhcUJMwS; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-32877-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32877-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id os26-20020a05620a811a00b0078384b603f1si5068714qkn.749.2024.01.22.03.24.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:24:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32877-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=@tuxon.dev header.s=google header.b=IhcUJMwS; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-32877-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32877-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 7A0821C22264 for ; Mon, 22 Jan 2024 11:24:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 110AD3F8E7; Mon, 22 Jan 2024 11:11:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="IhcUJMwS" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 2751A3EA72 for ; Mon, 22 Jan 2024 11:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705921909; cv=none; b=ISh3UjKafS5KxUzFuW4XhU5CQUUzVHJ2Zu5GX8XtrCnQOY8LryTSHh2odi22MejsTCZxFUkVDCBjK18KIbGCoVb9HUqx0vSZv3+S9EpFVDOhODWxi9s4Lk2e6U17KauGahBBpqmHHA5gxs+AjnM/b14DrBhzPcdY/7LTG2FEL8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705921909; c=relaxed/simple; bh=LIPwfTVYzjHtnuFd0jU3NL/6FuMhnlnEQLJY/PrGiyo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JcCfJ9Ero5pnKGAYKmE9XjZkTZeLicHf5slpX4n1O/CI0JIrR7u5KAtFHyRkJfsH2BJjK8v7kB1O3WDxUHa7vbB1FdM9QOvvG+G89iA1YDqlSw9fwfJYDTEaj7UnvBBrlFe9BXhlqBilbtDjICUruFDdVP6+HsoGlx80Sl0h1Os= 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=IhcUJMwS; arc=none smtp.client-ip=209.85.208.43 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-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-55c4ec68993so491197a12.3 for ; Mon, 22 Jan 2024 03:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1705921905; x=1706526705; 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=pqtCeRjkRQZF1X7FzpXbbf307qf5/3u+eo/6taxNjjo=; b=IhcUJMwSmBVgnNoSy2KtZk8LT4jyaB6dfGx1vU/CM+Oe4jLPM324OaOtvug7kzCZO3 EcEylgyxpCS26STLgoAfklQVfhnrTcMzlcWW+OabsZIZ019tRBTCGkLdUw7Q+TzPcpdb gHwg0VL4cFiqNJI0hNqalvHyP8Ggr+R/2X4Kjw4b84AWLvBrDdDog3DvRc0xA/+uUqku c+Bl7srOSJJKQXqGzER397Ton6iiUyOli2iVh6Eeky1vTbQGHzTZj7j3x0uLyGqFsfsO Nj5vLoqydbKAKC57L0x86AV/L+sBstKi+LHNAOdp0ZDXcWZ/CMEs+WSLZxkM5u/I7zSb JUkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705921905; x=1706526705; 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=pqtCeRjkRQZF1X7FzpXbbf307qf5/3u+eo/6taxNjjo=; b=aokhQpCDTlOuZ1kNaW8ibUUryqpd7PhUsUZYNVBEKmdd//zNM6WAQMLhNastRVLaZ/ CX9SeF3vYKCVgIUwKgZMsQxboT5XrU/gWdV7Lb1m/B2jWRyVNz5UoZnFTPEQjetwVyL1 GWTTMDVaYYmhJXH0qmAvkC7Bu5PLSCcUNMhDEk8VXorHQSEtrjFgcRKCdjxXII48ZlTv 8vLuiKXwDmJiSYfLZdfunHBRvk9rGPWTPhZ53ghJBVJ0OugaLkTHgkSgSjplN2ObVW3U FpgYuHtotf/LKqub4uAh8wNJ6962OoSWk2CJDvUIS5GFZn0vYP2SYXYazVwI9M6RHgO8 B22A== X-Gm-Message-State: AOJu0YyGGXRKa01Yq63oGjJSjZ6ory2YJNgp09yat16rGje0mqgJkc3N 6dXkX82fnO5GCatykrC/5d/oFc2MxpacUSLZsjPZQN03vV9P1XHBSJ5uRMR3qKg= X-Received: by 2002:a50:a6dd:0:b0:559:ccc4:157e with SMTP id f29-20020a50a6dd000000b00559ccc4157emr2518301edc.30.1705921905246; Mon, 22 Jan 2024 03:11:45 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id t34-20020a056402242200b0055823c2ae17sm14194241eda.64.2024.01.22.03.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:11:44 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: wim@linux-watchdog.org, linux@roeck-us.net, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, 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, linux-clk@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH 04/10] watchdog: rzg2l_wdt: Remove reset de-assert on probe/stop Date: Mon, 22 Jan 2024 13:11:09 +0200 Message-Id: <20240122111115.2861835-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240122111115.2861835-1-claudiu.beznea.uj@bp.renesas.com> References: <20240122111115.2861835-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 --- 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 0554965027cd..988926e50741 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) @@ -181,6 +187,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); @@ -231,13 +243,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) @@ -280,10 +290,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) { @@ -304,9 +310,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