[PATCH 09/19] thunderbolt: Add ring_interrupt_active to tb_nhi_ops
Sven Peter
sven at kernel.org
Sun Aug 30 13:19:27 PDT 2026
The Apple NHI enables and disables ring interrupts differently. Add an
optional tb_nhi_ops hook to override ring_interrupt_active which falls
back to the standard USB4 method when it is not set.
Signed-off-by: Sven Peter <sven at kernel.org>
---
drivers/thunderbolt/nhi.c | 12 ++++++++++--
drivers/thunderbolt/nhi.h | 4 ++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
index 6a97dcd57deb..fc54ff7edfb9 100644
--- a/drivers/thunderbolt/nhi.c
+++ b/drivers/thunderbolt/nhi.c
@@ -149,6 +149,14 @@ static void ring_interrupt_active(struct tb_ring *ring, bool active)
nhi_mask_interrupt(ring->nhi, mask, index);
}
+static void nhi_ring_interrupt_active(struct tb_ring *ring, bool active)
+{
+ if (ring->nhi->ops->ring_interrupt_active)
+ ring->nhi->ops->ring_interrupt_active(ring, active);
+ else
+ ring_interrupt_active(ring, active);
+}
+
/*
* nhi_disable_interrupts() - disable interrupts for all rings
*
@@ -724,7 +732,7 @@ void tb_ring_start(struct tb_ring *ring)
}
if (!(ring->flags & RING_FLAG_NO_INTERRUPT))
- ring_interrupt_active(ring, true);
+ nhi_ring_interrupt_active(ring, true);
ring->running = true;
err:
spin_unlock(&ring->lock);
@@ -785,7 +793,7 @@ void tb_ring_stop(struct tb_ring *ring)
goto err;
}
if (!(ring->flags & RING_FLAG_NO_INTERRUPT))
- ring_interrupt_active(ring, false);
+ nhi_ring_interrupt_active(ring, false);
ring_iowrite32options(ring, 0, 0);
ring_iowrite64desc(ring, 0, 0);
diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h
index f72d6b274501..4884c3f5a2b2 100644
--- a/drivers/thunderbolt/nhi.h
+++ b/drivers/thunderbolt/nhi.h
@@ -52,6 +52,9 @@ extern const struct dev_pm_ops nhi_pm_ops;
* @post_nvm_auth: hook to run after Thunderbolt 3 NVM authentication
* @request_ring_irq: NHI specific interrupt retrieval hook
* @release_ring_irq: NHI specific interrupt release hook
+ * @ring_interrupt_active: NHI specific hook to activate/deactivate the
+ * interrupt of a single ring. If not set the
+ * standard USB4 NHI registers are used.
* @is_present: Whether the device is currently present on the parent bus
* @init_interrupts: NHI specific interrupt initialization hook
* @reset_interface: Resets the host interface
@@ -67,6 +70,7 @@ struct tb_nhi_ops {
void (*post_nvm_auth)(struct tb_nhi *nhi);
int (*request_ring_irq)(struct tb_ring *ring, bool no_suspend);
void (*release_ring_irq)(struct tb_ring *ring);
+ void (*ring_interrupt_active)(struct tb_ring *ring, bool active);
bool (*is_present)(struct tb_nhi *nhi);
int (*init_interrupts)(struct tb_nhi *nhi);
void (*reset_interface)(struct tb_nhi *nhi);
--
2.55.0
More information about the linux-arm-kernel
mailing list