Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=68.232.154.123 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796373314; b=gxzw+ar+vmiT9r8EQOBlsQtHHdoBb9A9AmBKE4krnO13Zf6u68b52JT94t2DMZqX1YFd nvhV4zDf39n+ExOpg/OUCqerOW0y4ZWWnvS26KYTnDemXaDxPyZ4uGTXcIgshPF6DT83Q Wqt6D2ExTzgq+Ht6t5QopmBtn557ckht8PdYYxlJVZEEHNH4c/aRc0rQf6encIv6TFQND p92LMwAE3VSNPopm8arSPEfaVwNVHtD5kXCQDzDW/Fq9rpPr2t26km+I74+VKxByzJ1JM 8q3NJH372wJ7T/xuZzobZGpPf/fWO7GHcgRXQUm98gFXgMn3l1cdS1sFuOPBf46tQuw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796373314; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-Amp-Result:Received:Received:Received:From:To:CC: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type; bh=qPODA/6+WPxylJOyjjblZZF9RWYepyxd6DEXSYuRpaQ=; b=Lgw2id43cxROTjTHla7O96kfZ4jUxZQ2vTMcT/hGUhxuE0oa0cQqCN8IC/YCZWz9GMGW t+ij5SztlhN92+2NFDss+iybdVumdNbfyoHhT0E08Wm36aez2QbLBK7KO6DTBV4Yydd7K CPQ7ieSX6eVV9BMIRWsc9hbttXpI8rSWrCHU4mlMEK7/J5UB4zy66vOPB0EJBgFLuIKXb d2lCihLmZcIfQTY+JeCw5ukLO2YHBEErHrtShZ6A+AY76q9QNUWa1WWCOnosTC6Scn35E LXIdvkhj3Agw9txhqs6m3Iz6gUegAf8+X3rEuCbPMP2lvREObYqjmIPQ3NNJKsFXCBQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=Grj5Bbo2; arc=none smtp.remote-ip=68.232.154.123 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D674606A33A for ; Fri, 4 Dec 2026 08:35:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7D674606A33A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=Grj5Bbo2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1796373314; x=1827909314; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V9Puyy5J7feRPJU0KQpfpRMDF9TksppI8cBcyRTHckc=; b=Grj5Bbo2Bvgt3h1Thc4S4YrxjqR8UHK9rmOnGQYX+pCrWryn1u2ftxrn wRYwa52sittwpCAiwIMhW6bvABmCTO/p0fMXbwi9jd0LNlwAvH6Fr7J3x JPXV9xR5x1IQz1nX59e2AkWSXHlMytbVMfl3sVycPtjZ7i5vpiGb3wclp 6Gkr8I99K4iA2kfAUKKeJCqI8w+3uLwZ2KlNdVTl12RS8Vf2zRxcEwO2G W6zpT+39W06hs8brB3dcK+hzz27syt43ENXiNpHn7OCyGDW2WTKN8j/fn IUyxwMlbqcj+H3q7S1M1ZulaFn9Tx7gQqekdHoJOgtafbL8fn5j5k0/E0 w==; X-CSE-ConnectionGUID: nimRo+n3SzyrKok2i3AEBg== X-CSE-MsgGUID: QLhx/D5YRm+5K9NIPOxoJA== X-IronPort-AV: E=Sophos;i="6.29,78,1794898800"; d="scan'208";a="66461662" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 01:35:13 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.87.71) by chn-vm-ex2.mchp-main.com (10.10.87.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.57; Fri, 4 Dec 2026 01:35:13 -0700 Received: from che-ll-i67131.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.58 via Frontend Transport; Fri, 4 Dec 2026 01:35:10 -0700 From: Manikandan Muralidharan To: , , , , , , CC: Subject: [PATCH 3/3] i3c: mipi-i3c-hci: add Microchip quirk to set response buffer threshold Date: Fri, 4 Dec 2026 14:04:49 +0530 Message-ID: <20261204083449.933526-4-manikandan.m@microchip.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261204083449.933526-1-manikandan.m@microchip.com> References: <20261204083449.933526-1-manikandan.m@microchip.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 --- 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