[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260106053749.61440-2-superm1@kernel.org>
Date: Mon, 5 Jan 2026 23:37:48 -0600
From: "Mario Limonciello (AMD)" <superm1@...nel.org>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc: linux-usb@...r.kernel.org (open list:THUNDERBOLT DRIVER),
linux-kernel@...r.kernel.org,
Andreas Noever <andreas.noever@...il.com>,
Michael Jamet <michael.jamet@...el.com>,
Yehezkel Bernat <YehezkelShB@...il.com>,
"Mario Limonciello (AMD)" <superm1@...nel.org>
Subject: [PATCH v2 1/2] thunderbolt: Move nhi_reset before pmops declaration
pmops will be using nhi_reset for restore from S4. No intended
functional changes.
Signed-off-by: Mario Limonciello (AMD) <superm1@...nel.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
Powered by blists - more mailing lists