Re: [PATCH v5 2/6] PCI: spacemit-k1: Add multiple PHY handles support
From: Inochi Amaoto
Date: Wed Sep 09 2026 - 04:09:35 EST
On Tue, Sep 08, 2026 at 01:29:27PM +0300, Andy Shevchenko wrote:
> On Mon, Sep 07, 2026 at 07:26:01PM +0800, Inochi Amaoto wrote:
> > The PCIe controller on Spacemit K3 may use multiple PHYs at the
> > same time. The feature is not supported by the current driver.
> > So extend the PHY definition to support multiple PHY handles.
>
> ...
>
> > +static int k1_pcie_get_phy_handle(struct k1_pcie *k1, struct device_node *node)
> > +{
> > + const struct k1_pcie_device_data *data = k1->data;
> > + struct device *dev = k1->pci.dev;
> > + int count;
> > +
> > + count = devm_of_phy_bulk_get_all(dev, node, &k1->phys);
> > + if (count < 0)
> > + return count;
> > + if (count == 0 || count > data->max_phy_count)
> > + return -EINVAL;
>
> Elsewhere we distinguish count == 0 with -ENOENT.
>
Is there is an example? I think it is suitable for its internal check
to translate -ENOENT to count 0, because no phys property means no
phy. For a get helper with optional semantics. I think it is fine
to return 0.
Regards,
Inochi
> > + k1->phy_count = count;
> > +
> > + return 0;
> > +}
>
> --
> With Best Regards,
> Andy Shevchenko
>
>