All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Shimko <a.shimko.dev@gmail.com>
To: wim@linux-watchdog.org, linux@roeck-us.net,
	p.zabel@pengutronix.de, Sergey.Semin@baikalelectronics.ru,
	mika.westerberg@linux.intel.com, andi.shyti@kernel.org
Cc: Artem Shimko <a.shimko.dev@gmail.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] watchdog: dw_wdt: move reset control deassertion before register access
Date: Fri, 20 Mar 2026 16:56:18 +0300	[thread overview]
Message-ID: <20260320135624.223863-2-a.shimko.dev@gmail.com> (raw)
In-Reply-To: <20260320135624.223863-1-a.shimko.dev@gmail.com>

The watchdog controller must be taken out of reset before any register
access is attempted. Currently reset_control_deassert() is called after
dw_wdt_update_mode() which performs register read/write operations. If
the reset line is asserted, accessing registers may result in undefined
behavior or bus hangs.

Move reset_control_deassert() before dw_wdt_update_mode() to ensure the
controller is properly deasserted before the first register access. The
reset_control_assert() in the error path remains to properly revert the
reset state on probe failure.

Fixes: 46a1946314bf ("watchdog: dw_wdt: Add pre-timeouts support")
Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com>
---
 drivers/watchdog/dw_wdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index c3fbb6068c52..3450402b7707 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -592,6 +592,8 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
 	if (IS_ERR(dw_wdt->rst))
 		return PTR_ERR(dw_wdt->rst);
 
+	reset_control_deassert(dw_wdt->rst);
+
 	/* Enable normal reset without pre-timeout by default. */
 	dw_wdt_update_mode(dw_wdt, DW_WDT_RMOD_RESET);
 
@@ -617,8 +619,6 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
 		dw_wdt->wdd.info = &dw_wdt_ident;
 	}
 
-	reset_control_deassert(dw_wdt->rst);
-
 	ret = dw_wdt_init_timeouts(dw_wdt, dev);
 	if (ret)
 		goto out_assert_rst;
-- 
2.43.0


  reply	other threads:[~2026-03-20 13:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20 13:56 [PATCH 0/5] watchdog: dw_wdt: reset clean up and pm Artem Shimko
2026-03-20 13:56 ` Artem Shimko [this message]
2026-03-20 13:56 ` [PATCH 2/5] watchdog: dw_wdt: add error handling for reset control deassertion Artem Shimko
2026-03-20 13:56 ` [PATCH 3/5] watchdog: dw_wdt: Use devm_reset_control_get_optional_shared_deasserted Artem Shimko
2026-03-20 13:56 ` [PATCH 4/5] watchdog: dw_wdt: manage reset line during system suspend/resume Artem Shimko
2026-03-20 13:56 ` [PATCH 5/5] watchdog: dw_wdt: clean up error paths in resume function Artem Shimko
2026-05-03 16:23 ` [PATCH 0/5] watchdog: dw_wdt: reset clean up and pm Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260320135624.223863-2-a.shimko.dev@gmail.com \
    --to=a.shimko.dev@gmail.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andi.shyti@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mika.westerberg@linux.intel.com \
    --cc=p.zabel@pengutronix.de \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.