[PATCH 3/3] i3c: mipi-i3c-hci: add Microchip quirk to set response buffer threshold
From: Manikandan Muralidharan
Date: Fri Dec 04 2026 - 03:35:24 EST
The SAMA7D65 I3C controller interprets RESP_BUF_THLD in QUEUE_THLD_CTRL
as N+1 entries, so the default threshold of 1 delays the response
interrupt until two responses are queued. It must be set to 0 to get an
interrupt after every transfer completion.
Add HCI_QUIRK_MCHP_RESP_BUF_THLD and select the response threshold
directly in __hci_pio_init(), so that the register and its cached copy
stay consistent across IBI threshold updates, runtime resume and
controller reset and restore.
Signed-off-by: Manikandan Muralidharan <manikandan.m@xxxxxxxxxxxxx>
---
drivers/i3c/master/mipi-i3c-hci/core.c | 2 +-
drivers/i3c/master/mipi-i3c-hci/hci.h | 1 +
drivers/i3c/master/mipi-i3c-hci/pio.c | 8 ++++++--
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index bc71871be2f0..159645b21362 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -1284,7 +1284,7 @@ static const __maybe_unused struct of_device_id i3c_hci_of_match[] = {
{ .compatible = "mipi-i3c-hci", },
{ .compatible = "microchip,sama7d65-i3c-hci",
.data = (void *)(ulong)(HCI_QUIRK_PIO_MODE | HCI_QUIRK_MCHP_OD_PP_TIMING |
- HCI_QUIRK_RESP_BUF_THLD) },
+ HCI_QUIRK_MCHP_RESP_BUF_THLD) },
{},
};
MODULE_DEVICE_TABLE(of, i3c_hci_of_match);
diff --git a/drivers/i3c/master/mipi-i3c-hci/hci.h b/drivers/i3c/master/mipi-i3c-hci/hci.h
index 0137c91e84cf..10015a43cc7e 100644
--- a/drivers/i3c/master/mipi-i3c-hci/hci.h
+++ b/drivers/i3c/master/mipi-i3c-hci/hci.h
@@ -181,6 +181,7 @@ struct i3c_hci_dev_data {
#define HCI_QUIRK_DMA_ABORT_REQUIRES_PIO_RESET BIT(8) /* Do PIO queue SW resets after DMA abort */
#define HCI_QUIRK_DMA_REQUIRES_HC_ABORT BIT(9) /* Use HC_CONTROL ABORT to abort DMA */
#define HCI_QUIRK_MCHP_OD_PP_TIMING BIT(10) /* Set OD and PP timings from gclk for Microchip */
+#define HCI_QUIRK_MCHP_RESP_BUF_THLD BIT(11) /* Set resp buf thld to 0 for Microchip platforms */
/* Vendor-specific SCL timing registers shared by the quirk files */
#define HCI_SCL_I3C_OD_TIMING 0x214
diff --git a/drivers/i3c/master/mipi-i3c-hci/pio.c b/drivers/i3c/master/mipi-i3c-hci/pio.c
index 439578a6eb54..cf6e97711ea2 100644
--- a/drivers/i3c/master/mipi-i3c-hci/pio.c
+++ b/drivers/i3c/master/mipi-i3c-hci/pio.c
@@ -146,7 +146,7 @@ struct hci_pio_data {
static void __hci_pio_init(struct i3c_hci *hci, u32 *size_val_ptr)
{
- u32 val, size_val, rx_thresh, tx_thresh, ibi_val;
+ u32 val, size_val, rx_thresh, tx_thresh, resp_thresh, ibi_val;
struct hci_pio_data *pio = hci->io_data;
size_val = pio_reg_read(QUEUE_SIZE);
@@ -192,9 +192,13 @@ static void __hci_pio_init(struct i3c_hci *hci, u32 *size_val_ptr)
}
pio->max_ibi_thresh = clamp_val(ibi_val/2, 1, 63);
+
+ /* Microchip encodes RESP_BUF_THLD as N+1, so 0 means one response */
+ resp_thresh = (hci->quirks & HCI_QUIRK_MCHP_RESP_BUF_THLD) ? 0 : 1;
+
val = FIELD_PREP(QUEUE_IBI_STATUS_THLD, 1) |
FIELD_PREP(QUEUE_IBI_DATA_THLD, pio->max_ibi_thresh) |
- FIELD_PREP(QUEUE_RESP_BUF_THLD, 1) |
+ FIELD_PREP(QUEUE_RESP_BUF_THLD, resp_thresh) |
FIELD_PREP(QUEUE_CMD_EMPTY_BUF_THLD, 1);
pio_reg_write(QUEUE_THLD_CTRL, val);
pio->reg_queue_thresh = val;
--
2.43.0