From: Frank Li <Frank.li@oss.nxp.com>
To: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Frank Li <Frank.Li@nxp.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-i3c@lists.infradead.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] i3c: mipi-i3c-hci: Add a quirk to clear the TX start threshold
Date: Tue, 1 Sep 2026 16:58:10 -0400 [thread overview]
Message-ID: <apc8YiMT_8aBukeE@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260901-b4-i3c-hci-ast2700-v1-4-19909e7cbd7e@aspeedtech.com>
On Tue, Sep 01, 2026 at 07:35:31PM +0800, Billy Tsai wrote:
> The DATA_TX_START_THLD field of the PIO data buffer threshold register
> holds off the start of a TX transfer until the FIFO holds a set amount
> of data, which in PIO mode cuts down on the number of software writes.
> The field resets to 0x1, requiring at least (2 ^ 2) DWORDs (16 bytes)
> in the FIFO before transmission starts.
>
> HCI controllers that support both PIO and DMA can expose the two as
> separate register blocks; nothing in the specification says selecting
> DMA mode disables the PIO block's own gating logic. On ASPEED
> platforms it doesn't: DATA_TX_START_THLD still holds up transfer
> start regardless of which mode feeds the FIFO, and in DMA mode that
> threshold is never satisfied for some transfer sizes:
>
> - 1-4 bytes: uses the Immediate Data Transfer Command.
> - 13+ bytes: since the hardware fetches data in 4-byte chunks, a
> 13-byte transfer fetches 16 bytes into the FIFO and reaches the
> threshold.
> - 5-12 bytes: the threshold is never reached and the transfer stalls.
>
> Add HCI_QUIRK_TX_START_THLD to clear the field whenever DMA mode is
> selected. The clear lives in i3c_hci_set_io_mode() rather than in
> probe so the reset-and-restore recovery path also reapplies it after
> a controller soft reset. Move the PIO Access Area register and
> bitfield definitions from pio.c to a new pio.h so this quirk can reuse
> PIO_DATA_BUFFER_THLD_CTRL and DATA_TX_START_THLD instead of
> redefining them.
>
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> Assisted-by: Claude:claude-fable-5
> ---
> drivers/i3c/master/mipi-i3c-hci/core.c | 14 +++++
> drivers/i3c/master/mipi-i3c-hci/hci.h | 1 +
> drivers/i3c/master/mipi-i3c-hci/pio.c | 97 +----------------------------
> drivers/i3c/master/mipi-i3c-hci/pio.h | 109 +++++++++++++++++++++++++++++++++
> 4 files changed, 125 insertions(+), 96 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index c03c3a9cbe4f..2290a889701c 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -26,6 +26,7 @@
> #include "cmd.h"
> #include "dat.h"
> #include "ibi.h"
> +#include "pio.h"
>
> /*
> * Host Controller Capabilities and Operation Registers
> @@ -823,6 +824,19 @@ static int i3c_hci_set_io_mode(struct i3c_hci *hci, bool dma)
> else
> reg_set(HC_CONTROL, HC_CONTROL_PIO_MODE);
>
> + /*
> + * On the ASPEED AST2700 the TX start threshold gates transfer start
> + * even in DMA mode. Clear it so DMA transfers are not held back
> + * waiting for a PIO FIFO level that will never be reached.
> + */
> + if (dma && (hci->quirks & HCI_QUIRK_TX_START_THLD) && hci->PIO_regs) {
> + void __iomem *thld_reg = hci->PIO_regs + PIO_DATA_BUFFER_THLD_CTRL;
> + u32 thld_val = readl(thld_reg);
> +
> + thld_val &= ~DATA_TX_START_THLD;
> + writel(thld_val, thld_reg);
don't move these defination, original isolate is quite good. Add API or
callback to implement clean DATA_TX_START_THLD.
Frank
WARNING: multiple messages have this Message-ID (diff)
From: Frank Li <Frank.li@oss.nxp.com>
To: Billy Tsai <billy_tsai@aspeedtech.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Frank Li <Frank.Li@nxp.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Joel Stanley <joel@jms.id.au>,
Andrew Jeffery <andrew@codeconstruct.com.au>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-i3c@lists.infradead.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] i3c: mipi-i3c-hci: Add a quirk to clear the TX start threshold
Date: Tue, 1 Sep 2026 16:58:10 -0400 [thread overview]
Message-ID: <apc8YiMT_8aBukeE@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260901-b4-i3c-hci-ast2700-v1-4-19909e7cbd7e@aspeedtech.com>
On Tue, Sep 01, 2026 at 07:35:31PM +0800, Billy Tsai wrote:
> The DATA_TX_START_THLD field of the PIO data buffer threshold register
> holds off the start of a TX transfer until the FIFO holds a set amount
> of data, which in PIO mode cuts down on the number of software writes.
> The field resets to 0x1, requiring at least (2 ^ 2) DWORDs (16 bytes)
> in the FIFO before transmission starts.
>
> HCI controllers that support both PIO and DMA can expose the two as
> separate register blocks; nothing in the specification says selecting
> DMA mode disables the PIO block's own gating logic. On ASPEED
> platforms it doesn't: DATA_TX_START_THLD still holds up transfer
> start regardless of which mode feeds the FIFO, and in DMA mode that
> threshold is never satisfied for some transfer sizes:
>
> - 1-4 bytes: uses the Immediate Data Transfer Command.
> - 13+ bytes: since the hardware fetches data in 4-byte chunks, a
> 13-byte transfer fetches 16 bytes into the FIFO and reaches the
> threshold.
> - 5-12 bytes: the threshold is never reached and the transfer stalls.
>
> Add HCI_QUIRK_TX_START_THLD to clear the field whenever DMA mode is
> selected. The clear lives in i3c_hci_set_io_mode() rather than in
> probe so the reset-and-restore recovery path also reapplies it after
> a controller soft reset. Move the PIO Access Area register and
> bitfield definitions from pio.c to a new pio.h so this quirk can reuse
> PIO_DATA_BUFFER_THLD_CTRL and DATA_TX_START_THLD instead of
> redefining them.
>
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> Assisted-by: Claude:claude-fable-5
> ---
> drivers/i3c/master/mipi-i3c-hci/core.c | 14 +++++
> drivers/i3c/master/mipi-i3c-hci/hci.h | 1 +
> drivers/i3c/master/mipi-i3c-hci/pio.c | 97 +----------------------------
> drivers/i3c/master/mipi-i3c-hci/pio.h | 109 +++++++++++++++++++++++++++++++++
> 4 files changed, 125 insertions(+), 96 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
> index c03c3a9cbe4f..2290a889701c 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/core.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/core.c
> @@ -26,6 +26,7 @@
> #include "cmd.h"
> #include "dat.h"
> #include "ibi.h"
> +#include "pio.h"
>
> /*
> * Host Controller Capabilities and Operation Registers
> @@ -823,6 +824,19 @@ static int i3c_hci_set_io_mode(struct i3c_hci *hci, bool dma)
> else
> reg_set(HC_CONTROL, HC_CONTROL_PIO_MODE);
>
> + /*
> + * On the ASPEED AST2700 the TX start threshold gates transfer start
> + * even in DMA mode. Clear it so DMA transfers are not held back
> + * waiting for a PIO FIFO level that will never be reached.
> + */
> + if (dma && (hci->quirks & HCI_QUIRK_TX_START_THLD) && hci->PIO_regs) {
> + void __iomem *thld_reg = hci->PIO_regs + PIO_DATA_BUFFER_THLD_CTRL;
> + u32 thld_val = readl(thld_reg);
> +
> + thld_val &= ~DATA_TX_START_THLD;
> + writel(thld_val, thld_reg);
don't move these defination, original isolate is quite good. Add API or
callback to implement clean DATA_TX_START_THLD.
Frank
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2026-09-01 20:58 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 11:35 [PATCH 0/8] i3c: mipi-i3c-hci: Add Aspeed AST2700 support Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 1/8] dt-bindings: i3c: Document the AST2700 I3C controller Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 20:41 ` Frank Li
2026-09-01 20:41 ` Frank Li
2026-09-09 5:33 ` 回覆: " Billy Tsai
2026-09-09 5:33 ` Billy Tsai
2026-09-07 6:28 ` Krzysztof Kozlowski
2026-09-07 6:28 ` Krzysztof Kozlowski
2026-09-09 5:35 ` 回覆: " Billy Tsai
2026-09-09 5:35 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 2/8] i3c: mipi-i3c-hci: Support address-indexed DAT slots Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:49 ` sashiko-bot
2026-09-01 11:49 ` sashiko-bot
2026-09-01 20:47 ` Frank Li
2026-09-01 20:47 ` Frank Li
2026-09-09 5:36 ` 回覆: " Billy Tsai
2026-09-09 5:36 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 3/8] i3c: mipi-i3c-hci: Add a quirk for 64-bit DMA addressing Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:55 ` sashiko-bot
2026-09-01 11:55 ` sashiko-bot
2026-09-01 20:51 ` Frank Li
2026-09-01 20:51 ` Frank Li
2026-09-09 5:37 ` 回覆: " Billy Tsai
2026-09-09 5:37 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 4/8] i3c: mipi-i3c-hci: Add a quirk to clear the TX start threshold Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:49 ` sashiko-bot
2026-09-01 11:49 ` sashiko-bot
2026-09-01 20:58 ` Frank Li [this message]
2026-09-01 20:58 ` Frank Li
2026-09-09 5:37 ` 回覆: " Billy Tsai
2026-09-09 5:37 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 5/8] i3c: mipi-i3c-hci: Add support for the AST2700 I3C controller Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:52 ` sashiko-bot
2026-09-01 11:52 ` sashiko-bot
2026-09-01 21:18 ` Frank Li
2026-09-01 21:18 ` Frank Li
2026-09-09 5:38 ` 回覆: " Billy Tsai
2026-09-09 5:38 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 6/8] i3c: mipi-i3c-hci: Program AST2700 IBI termination threshold Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:35 ` [PATCH 7/8] i3c: mipi-i3c-hci: Improve AST2700 PIO TX queue utilization Billy Tsai
2026-09-01 11:35 ` Billy Tsai
2026-09-01 11:51 ` sashiko-bot
2026-09-01 11:51 ` sashiko-bot
2026-09-01 11:35 ` [PATCH 8/8] i3c: mipi-i3c-hci: Support the AST2700 internal pull-ups Billy Tsai
2026-09-01 11:35 ` Billy Tsai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apc8YiMT_8aBukeE@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@codeconstruct.com.au \
--cc=billy_tsai@aspeedtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joel@jms.id.au \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.