public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming
@ 2024-12-31 11:59 Jarkko Nikula
  2024-12-31 11:59 ` [PATCH 2/2] i3c: mipi-i3c-hci: Add support for MIPI I3C HCI on PCI bus Jarkko Nikula
  2025-01-12 23:04 ` [PATCH 1/2] i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Jarkko Nikula @ 2024-12-31 11:59 UTC (permalink / raw)
  To: linux-i3c; +Cc: Alexandre Belloni, Jarkko Nikula

MIPI I3C HCI on Intel hardware requires a quirk where ring needs to stop
and set to run again after resuming the halted controller. This is not
expected from the MIPI I3C HCI specification and is Intel specific.

Add this quirk to generic aborted transfer handling and execute it only
when ring is not in running state after a transfer error and attempted
controller resume. This is the case on Intel hardware.

It is not fully clear to me what is the ring running state in generic
hardware in such case. I would expect if ring is not running, then stop
request is a no-op and run request is either required or does the same
what controller resume would do.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i3c/master/mipi-i3c-hci/dma.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index e8e56a8d2057..491dfe70b660 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -758,9 +758,26 @@ static bool hci_dma_irq_handler(struct i3c_hci *hci)
 			complete(&rh->op_done);
 
 		if (status & INTR_TRANSFER_ABORT) {
+			u32 ring_status;
+
 			dev_notice_ratelimited(&hci->master.dev,
 				"ring %d: Transfer Aborted\n", i);
 			mipi_i3c_hci_resume(hci);
+			ring_status = rh_reg_read(RING_STATUS);
+			if (!(ring_status & RING_STATUS_RUNNING) &&
+			    status & INTR_TRANSFER_COMPLETION &&
+			    status & INTR_TRANSFER_ERR) {
+				/*
+				 * Ring stop followed by run is an Intel
+				 * specific required quirk after resuming the
+				 * halted controller. Do it only when the ring
+				 * is not in running state after a transfer
+				 * error.
+				 */
+				rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE);
+				rh_reg_write(RING_CONTROL, RING_CTRL_ENABLE |
+							   RING_CTRL_RUN_STOP);
+			}
 		}
 		if (status & INTR_WARN_INS_STOP_MODE)
 			dev_warn_ratelimited(&hci->master.dev,
-- 
2.45.2


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-12 23:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-31 11:59 [PATCH 1/2] i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming Jarkko Nikula
2024-12-31 11:59 ` [PATCH 2/2] i3c: mipi-i3c-hci: Add support for MIPI I3C HCI on PCI bus Jarkko Nikula
2025-01-12 23:04 ` [PATCH 1/2] i3c: mipi-i3c-hci: Add Intel specific quirk to ring resuming Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox