Re: [PATCH] i3c: mipi-i3c-hci-pci: Skip Intel bus instance whose SCL is not muxed

From: Frank Li

Date: Tue Dec 01 2026 - 15:50:23 EST


On Fri, Nov 27, 2026 at 09:23:55AM +0200, Adrian Hunter wrote:
> Intel LPSS I3C PCI functions may expose a second bus instance even when
> it is not pinned out on the platform. When the instance's SCL pad is not
> muxed to the controller, the mipi-i3c-hci driver still creates a device
> for it and probe eventually fails:
>
> i3c intel-lpss-i3c.1: i3c_hci_process_xfer: timeout error
> mipi-i3c-hci intel-lpss-i3c.1: probe with driver mipi-i3c-hci failed with error -110
>
> The controller's SCL input is a clock loopback. If the SCL pad is not
> muxed to the controller, the loopback input stays low, so the controller
> has no clock to sample the bus with and the first CCC transfer times out.
>
> This condition can be detected from the HCI Debug extended capability.
> After reset, the PRESENT_STATE_DEBUG register reports
> SCL_LINE_SIGNAL_LEVEL before the bus is enabled, and it reads low for an
> instance whose SCL pad is not muxed.
>
> Firmware does not describe which instances are pinned out, and MIPI
> DisCo provides no property for it. Detect an unconnected second instance
> from the hardware instead by checking SCL_LINE_SIGNAL_LEVEL after reset.
> If the second instance reports SCL low, do not create a device for it.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> ---

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 32 +++++++++++++++++--
> 1 file changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> index 78fa42b2dc94..ea3e14c65313 100644
> --- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> +++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
> @@ -39,6 +39,7 @@ struct mipi_i3c_hci_pci {
> void __iomem *base;
> const struct mipi_i3c_hci_pci_info *info;
> struct mipi_i3c_hci_pci_instance instance[INST_MAX];
> + int instance_count;
> void *private;
> };
>
> @@ -163,6 +164,29 @@ static void intel_reset(void __iomem *priv)
> writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
> }
>
> +#define INTEL_PRESENT_STATE_DEBUG 0x24c
> +#define INTEL_SCL_LINE_SIGNAL_LEVEL BIT(0)
> +
> +/*
> + * BIOS enables the PCI function only if the 1st instance is enabled, but the
> + * 2nd instance may not be pinned out, in which case its probe times out.
> + */
> +static void intel_check_2nd_instance(struct mipi_i3c_hci_pci *hci)
> +{
> + for (int i = 1; i < hci->instance_count; i++) {
> + void __iomem *base = hci->base + hci->info->instance_offset[i];
> + u32 st = readl(base + INTEL_PRESENT_STATE_DEBUG);
> +
> + /* Reads the SCL clock loopback, which is held low if SCL is not muxed */
> + if (!(st & INTEL_SCL_LINE_SIGNAL_LEVEL)) {
> + hci->instance_count = i;
> + dev_notice(&hci->pci->dev, "%s.%d: SCL not connected, skipping\n",
> + hci->info->name, hci->info->id[i]);
> + break;
> + }
> + }
> +}
> +
> static int intel_i3c_init(struct mipi_i3c_hci_pci *hci)
> {
> struct intel_host *host = devm_kzalloc_obj(&hci->pci->dev, *host);
> @@ -181,6 +205,8 @@ static int intel_i3c_init(struct mipi_i3c_hci_pci *hci)
>
> intel_reset(priv);
>
> + intel_check_2nd_instance(hci);
> +
> intel_ltr_expose(&hci->pci->dev);
> intel_add_debugfs(hci);
>
> @@ -402,14 +428,14 @@ static void mipi_i3c_hci_pci_setup_cell(struct mipi_i3c_hci_pci *hci, int idx,
> cell->resources = &data->res;
> }
>
> -#define mipi_i3c_hci_pci_alloc(h, x) kzalloc_objs(*(x), (h)->info->instance_count)
> +#define mipi_i3c_hci_pci_alloc(h, x) kzalloc_objs(*(x), (h)->instance_count)
>
> static int mipi_i3c_hci_pci_add_instances(struct mipi_i3c_hci_pci *hci)
> {
> struct mipi_i3c_hci_pci_cell_data *data __free(kfree) = mipi_i3c_hci_pci_alloc(hci, data);
> struct mfd_cell *cells __free(kfree) = mipi_i3c_hci_pci_alloc(hci, cells);
> int irq = pci_irq_vector(hci->pci, 0);
> - int nr = hci->info->instance_count;
> + int nr = hci->instance_count;
>
> if (!cells || !data)
> return -ENOMEM;
> @@ -450,6 +476,8 @@ static int mipi_i3c_hci_pci_probe(struct pci_dev *pci,
>
> hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data;
>
> + hci->instance_count = hci->info->instance_count;
> +
> ret = hci->info->init ? hci->info->init(hci) : 0;
> if (ret)
> return ret;
> --
> 2.53.0
>