From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-usb@vger.kernel.org (open list:THUNDERBOLT DRIVER),
linux-kernel@vger.kernel.org,
Andreas Noever <andreas.noever@gmail.com>,
Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <YehezkelShB@gmail.com>,
"Mario Limonciello (AMD)" <superm1@kernel.org>
Subject: [PATCH v2 1/2] thunderbolt: Move nhi_reset before pmops declaration
Date: Mon, 5 Jan 2026 23:37:48 -0600 [thread overview]
Message-ID: <20260106053749.61440-2-superm1@kernel.org> (raw)
In-Reply-To: <20260106053749.61440-1-superm1@kernel.org>
pmops will be using nhi_reset for restore from S4. No intended
functional changes.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
drivers/thunderbolt/nhi.c | 62 +++++++++++++++++++--------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 6d0c9d37c55d8..ea2a5a06ee710 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -971,6 +971,37 @@ static irqreturn_t nhi_msi(int irq, void *data)
return IRQ_HANDLED;
}
+static void nhi_reset(struct tb_nhi *nhi)
+{
+ ktime_t timeout;
+ u32 val;
+
+ val = ioread32(nhi->iobase + REG_CAPS);
+ /* Reset only v2 and later routers */
+ if (FIELD_GET(REG_CAPS_VERSION_MASK, val) < REG_CAPS_VERSION_2)
+ return;
+
+ if (!host_reset) {
+ dev_dbg(&nhi->pdev->dev, "skipping host router reset\n");
+ return;
+ }
+
+ iowrite32(REG_RESET_HRR, nhi->iobase + REG_RESET);
+ msleep(100);
+
+ timeout = ktime_add_ms(ktime_get(), 500);
+ do {
+ val = ioread32(nhi->iobase + REG_RESET);
+ if (!(val & REG_RESET_HRR)) {
+ dev_warn(&nhi->pdev->dev, "host router reset successful\n");
+ return;
+ }
+ usleep_range(10, 20);
+ } while (ktime_before(ktime_get(), timeout));
+
+ dev_warn(&nhi->pdev->dev, "timeout resetting host router\n");
+}
+
static int __nhi_suspend_noirq(struct device *dev, bool wakeup)
{
struct pci_dev *pdev = to_pci_dev(dev);
@@ -1231,37 +1262,6 @@ static void nhi_check_iommu(struct tb_nhi *nhi)
str_enabled_disabled(port_ok));
}
-static void nhi_reset(struct tb_nhi *nhi)
-{
- ktime_t timeout;
- u32 val;
-
- val = ioread32(nhi->iobase + REG_CAPS);
- /* Reset only v2 and later routers */
- if (FIELD_GET(REG_CAPS_VERSION_MASK, val) < REG_CAPS_VERSION_2)
- return;
-
- if (!host_reset) {
- dev_dbg(&nhi->pdev->dev, "skipping host router reset\n");
- return;
- }
-
- iowrite32(REG_RESET_HRR, nhi->iobase + REG_RESET);
- msleep(100);
-
- timeout = ktime_add_ms(ktime_get(), 500);
- do {
- val = ioread32(nhi->iobase + REG_RESET);
- if (!(val & REG_RESET_HRR)) {
- dev_warn(&nhi->pdev->dev, "host router reset successful\n");
- return;
- }
- usleep_range(10, 20);
- } while (ktime_before(ktime_get(), timeout));
-
- dev_warn(&nhi->pdev->dev, "timeout resetting host router\n");
-}
-
static int nhi_init_msi(struct tb_nhi *nhi)
{
struct pci_dev *pdev = nhi->pdev;
--
2.43.0
next prev parent reply other threads:[~2026-01-06 5:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 5:37 [PATCH v2 0/2] thunderbolt: Fix S4 resume incongruities Mario Limonciello (AMD)
2026-01-06 5:37 ` Mario Limonciello (AMD) [this message]
2026-01-06 5:37 ` [PATCH v2 2/2] thunderbolt: Reset NHI during S4 restore_noirq() callback Mario Limonciello (AMD)
2026-01-07 9:33 ` [PATCH v2 0/2] thunderbolt: Fix S4 resume incongruities Mika Westerberg
2026-01-07 20:50 ` Mario Limonciello
2026-01-08 11:42 ` Mika Westerberg
2026-01-08 19:18 ` Mario Limonciello
2026-01-09 7:23 ` Mika Westerberg
2026-01-09 15:38 ` Mario Limonciello
2026-01-10 0:42 ` Katiyar, Pooja
2026-01-13 18:44 ` Mario Limonciello (AMD) (kernel.org)
2026-01-17 16:57 ` Katiyar, Pooja
2026-01-19 19:59 ` Mario Limonciello (AMD) (kernel.org)
2026-01-19 22:13 ` Kenneth Crudup
2026-01-29 23:13 ` Katiyar, Pooja
2026-01-30 1:39 ` Kenneth Crudup
2026-01-30 1:42 ` Kenneth Crudup
2026-02-04 0:50 ` Katiyar, Pooja
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=20260106053749.61440-2-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michael.jamet@intel.com \
--cc=mika.westerberg@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox