Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp304517lqh; Fri, 31 May 2024 01:38:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfZCnYWiTfb5Ot/l0Uuo3RUgEdPqpX4f3kMJrmqsn6kXdVvGPko/QaW16Nmjdwm200i67b9NGI27tHvI7b69NwN8xz/nUlemOTzcwbNg== X-Google-Smtp-Source: AGHT+IFeD6JA7em5/LUED6nNJh3CSF1J3WkO/J1+ZRO2YXMolJP48wF/2M9PNS0F1L1hNFkpR4YG X-Received: by 2002:a17:906:7717:b0:a66:c041:e5fc with SMTP id a640c23a62f3a-a681fe4e225mr93695566b.5.1717144700867; Fri, 31 May 2024 01:38:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717144700; cv=pass; d=google.com; s=arc-20160816; b=QebNk56df0K0vdS5ztnnxG5b0xinVYi6EpBM6qHKF6iUEqsSULhYmzF1DSTi/NBlyO O6+53GIbYOrdzWQoeiLTvM9aL+F6/QdXuQF3xnguW4wlnrpuYWLk5u1IMmz4STNj7K9O KPaaDNkZe7E05q2rPttiKaeiujSTdIcCssOq5xK2A0XD5f/3iyRZ9KR61dj/Kh6NnkQs gaS+w3H/kp109PO4VG5T/B9J39o0EiiGEhkh+3FPVu6FzDHJTKWZtsBpNeu0h7buwPnk vnmFCfV3hFH4sYkV8gEuOvrn8xJfS0I/1SgkNdWfOXwxEFyNDytMYB+YEZ1J9N1GJrpO A5CA== 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=Aj2UABYkbAgBpbHbr7DMq3bJIVwbBa4OlR1Ztoek3y0=; fh=AjoYah3tP1wkd+MQ+YNPNFlQ3p5heKWMab7o612BkPM=; b=juAJ+Leb8Yzql5J8nzLOPy53B4QG17Tjp2hxnY0jUhsBAJfXiPgyGKrksyqdNZP/mJ O5KTYN9oEKez4AtqruqVlm3fjobnDv3mA/x/ywFnD5bMFuh02aiGXFip+82u1YtpiNef bnjJFtuWG1Hx4RFcpf6439AcQZazmIyqk0pHE2n/7PVcrNGdCwA2yU5NLIg91omOu3W/ WRjv+3MnsORiKbE8Ww3ZkNLjFVoqLRaZnwcPZao9eX+vioTTxoIAywZyDWT6/LepOkEH inRIAl3gvsThbhQ4b10MCQIMrlV1uMuIAjl3lWa19Pvky2qcNSF1vlL/5S5CC0UnLAiZ 5FeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=qLFZL8Oa; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-196382-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196382-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a67ea38dce5si68740166b.456.2024.05.31.01.38.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 01:38:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196382-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=qLFZL8Oa; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-196382-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196382-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 C02B31F26AEF for ; Fri, 31 May 2024 06:59:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82A60132133; Fri, 31 May 2024 06:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="qLFZL8Oa" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 3840712E1C1 for ; Fri, 31 May 2024 06:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717138684; cv=none; b=ob6OZWac6za9/zwwV1BR9wQtacJxCQGbNG6Az8S8B1HnWDbVfmOTPyzi+TqPj06huRkSIjGeIODQTeV56Omhx2paxrQ8wuLKlsM3eoX4sQgMXMKdwQwsuebIyBi/tk/9uZS5cIT5PZX1S2ykuRtFKPWO0X+k/WMcSp54h8icdyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717138684; c=relaxed/simple; bh=P/Nh/oo/uWjDFwH5OIXq+nZf5Rwf9DCbobbRc0hNR4Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KAU14p6hEdJFb6RDhYeOvnVW1LEoFHRxNa1Y6SYAFFvW5qgH459Hno2yaLrMRBTyyz4Iv4G9a3X+HpfvPgzdkxF1DNOg/1Bu7itJ/38mV8AL2uuSJ2JVr8QHlPMg8K1YZDmx1jZwaKQa1V/x+i28ke5ZG8nWngVgNvS0Ue7Wk5Y= 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=qLFZL8Oa; arc=none smtp.client-ip=209.85.167.48 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-lf1-f48.google.com with SMTP id 2adb3069b0e04-52b840cfecdso961600e87.3 for ; Thu, 30 May 2024 23:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1717138680; x=1717743480; 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=Aj2UABYkbAgBpbHbr7DMq3bJIVwbBa4OlR1Ztoek3y0=; b=qLFZL8OaEYfWJzw1hhVFCGTaS9XJnTpP/kfNkcdwke2DzQ/xK6UO+M/drY8v6jTuTs 420ph9xdSSwrM29zMj0+8dmVDkJK476BleKH4ONPQCjqaWrjWFO7jg1GNDZY6epWgp8Y y5nAaIH/3un3zqp92AmuU5PXedM5oUlmUWc63xR3ZT31BwjAWylP6npi8GOX99/MtvRI yD6Td9qFErln7KrcMppYpgX0fqaIAj044pMjbnv20NpSj3lWbHCTtZwvHLERVqPtsRzy rFLjzp9RRUD5elUpyf5Q757/QF/2ciWCku8sKgfAx5HCuqRAIjStxxswRiYF/2G727A3 GALA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717138680; x=1717743480; 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=Aj2UABYkbAgBpbHbr7DMq3bJIVwbBa4OlR1Ztoek3y0=; b=bmEnA7F1v3FBTFQfhbSWwMMRkmYmVtljHbWns0jjJZgO6RrSZPnHLrOHjj/Q2FPBP5 6Rn+IwDf9kcmyBhk0iUvsZYKCmy9WWNq09aD6mjR4NLMQ5jb4V0+nkUj8n7gtnVa/ZGJ 03IKpBRlbmNFA3suo2uYbsFtMr22fM/GHEHlslLLe8oJJKJuDTuv71CFGu/+ED4hJgPF ymf8DInlb5DdkzstylxAO4/apXQaPB7VR/WDoPt2D6dpSYvXj6f5Bl0dfI9guLlTwtSX FB+5DVw//nCsrKgUJmVTwY7I3SLJMzYWBRNFazC1vW06eeOUdaohElyGB39eYtr6urIx fdbA== X-Forwarded-Encrypted: i=1; AJvYcCUEfKu9tX9F4QVx5zMHAaMhxX34mZCPosSQ6tDT8HHkv20zu2kCZKPrhGLEzZ8zwFs6z0MSSDVKboG+EyICod5JfJYyTLtrg798TEjL X-Gm-Message-State: AOJu0Yx0RrUnWa3sW7nQON0AZisapgl9YbFRm4n2RVCI5PKejCqpdH63 vwTb6D3AJdF5Q4ysnLFUSIJmd6jUsbaVWU78GQSHsPjlYtrumippLW+ZsjMxnDE= X-Received: by 2002:ac2:599a:0:b0:52b:6921:4fd9 with SMTP id 2adb3069b0e04-52b896c7ab6mr508765e87.50.1717138680288; Thu, 30 May 2024 23:58:00 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.157]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a67e73fc1a5sm54205566b.53.2024.05.30.23.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 23:57:59 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: wim@linux-watchdog.org, linux@roeck-us.net, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com Cc: biju.das.jz@bp.renesas.com, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, claudiu.beznea.uj@bp.renesas.com Subject: [PATCH v9 7/9] watchdog: rzg2l_wdt: Rely on the reset driver for doing proper reset Date: Fri, 31 May 2024 09:57:21 +0300 Message-Id: <20240531065723.1085423-8-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240531065723.1085423-1-claudiu.beznea.uj@bp.renesas.com> References: <20240531065723.1085423-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 Reviewed-by: Guenter Roeck --- Changes in v9: - collected Guenter's Rb tag 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 1f013dfd3c97..d77290f7fdea 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 */ @@ -189,13 +164,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; @@ -207,7 +181,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; @@ -299,13 +275,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