RE: [PATCH v2] i3c: dw-i3c-master: Fix IBI count register selection for versalnet

From: Datta, Shubhrajyoti

Date: Thu Apr 02 2026 - 03:47:03 EST


[Public]

> -----Original Message-----
> From: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, April 1, 2026 2:44 PM
> To: Datta, Shubhrajyoti <shubhrajyoti.datta@xxxxxxx>; linux-
> kernel@xxxxxxxxxxxxxxx
> Cc: git (AMD-Xilinx) <git@xxxxxxx>; Alexandre Belloni
> <alexandre.belloni@xxxxxxxxxxx>; Frank Li <Frank.Li@xxxxxxx>; Joel Stanley
> <joel@xxxxxxxxx>; linux-i3c@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2] i3c: dw-i3c-master: Fix IBI count register selection for
> versalnet
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi Shubhrajyoti,
>
> > On DesignWare I3C controllers where IC_HAS_IBI_DATA=0 (such as
> > versalnet), the IBI_STS_CNT field (bits [28:24] of QUEUE_STATUS_LEVEL)
> > is hardwired to 0. The IBI status entry count is instead reported via
> > IBI_BUF_BLR (bits [23:16] of the same register).
> >
> > irq_handle_ibis() was unconditionally reading IBI_STS_CNT, causing it
> > to always see 0 pending IBIs on versalnet and return early without
> > draining the IBI buffer. Since INTR_IBI_THLD_STAT is level-triggered
> > against the buffer fill level, this left the interrupt permanently asserted.
> >
> > Detect IBI data capability at probe time by writing the IBI data
> > threshold field in QUEUE_THLD_CTRL and reading it back. Use the result
> > to select the correct register field in irq_handle_ibis().
> >
> > Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxx>
> > ---
...

> > + writel(ret, master->regs + QUEUE_THLD_CTRL);
> > + ret = readl(master->regs + QUEUE_THLD_CTRL);
> > + if (ret & QUEUE_THLD_CTRL_IBI_DATA_MASK)
> > + master->has_ibi_data = true;
> > + writel(thld_ctrl, master->regs + QUEUE_THLD_CTRL);
>
> How are you binding the driver to this device? Are you using a unique OF
> compatible string, or something ACPI-based?
>
> ... and if that can be specific to this hardware instance, would that be an
> effective mechanism to select the IBI read method instead?
Hi Jeremy,

VersalNet currently uses the generic "snps,dw-i3c-master-1.00a" compatible string — there is no unique compatible string for this hardware instance. The DTS
entry looks like:

compatible = "snps,dw-i3c-master-1.00a";

So the compatible-string approach, as it stands, cannot distinguish VersalNet from other DesignWare instances.

We could introduce a VersalNet-specific compatible with a generic fallback:

compatible = "xlnx,versalnet-dw-i3c-master", "snps,dw-i3c-master-1.00a";

and pass a quirk flag via of_device_id.data to select the IBI read method. However, the probe-time detection avoids having to enumerate all affected
variants — the IC_HAS_IBI_DATA=0 configuration is a synthesizable option in the IP and may appear in other SoCs using the same core.

Do you have a preference? If the DTS change is acceptable, I can go with the compatible + match-data approach .

However I thought that detecting it will be helpful for backward compatible.

Thanks,
Shubhrajyoti

>
> Cheers,
>
>
> Jeremy