Thread (28 messages) flat view 28 messages, 5 authors, 2d ago

Re: [PATCH v5 2/6] PCI: spacemit-k1: Add multiple PHY handles support

From: Inochi Amaoto <inochiama@gmail.com>
Date: 2026-09-09 08:00:48
Also in: linux-pci, linux-riscv, lkml, spacemit

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:
quoted
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.
...
quoted
+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
quoted
+	k1->phy_count = count;
+
+	return 0;
+}
-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help